bmx280_params.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Kees Bakker, SODAQ
3  * 2017 Inria
4  * 2018 Freie Universität Berlin
5  *
6  * This file is subject to the terms and conditions of the GNU Lesser
7  * General Public License v2.1. See the file LICENSE in the top level
8  * directory for more details.
9  */
10 
23 #ifndef BMX280_PARAMS_H
24 #define BMX280_PARAMS_H
25 
26 #include "board.h"
27 #include "bmx280.h"
28 #include "saul_reg.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
38 #ifdef BMX280_USE_SPI
39 /* SPI configuration */
40 #ifndef BMX280_PARAM_SPI
41 #define BMX280_PARAM_SPI SPI_DEV(0)
42 #endif
43 #ifndef BMX280_PARAM_CLK
44 #define BMX280_PARAM_CLK SPI_CLK_5MHZ
45 #endif
46 #ifndef BMX280_PARAM_CS
47 #define BMX280_PARAM_CS GPIO_PIN(0, 0)
48 #endif
49 #else
50 /* I2C configuration */
51 #ifndef BMX280_PARAM_I2C_DEV
52 #define BMX280_PARAM_I2C_DEV I2C_DEV(0)
53 #endif
54 #ifndef BMX280_PARAM_I2C_ADDR
55 #define BMX280_PARAM_I2C_ADDR (0x77)
56 #endif
57 #endif
58 
59 #define BMX280_PARAM_MISC \
60  .t_sb = BMX280_SB_0_5, \
61  .filter = BMX280_FILTER_OFF, \
62  .run_mode = BMX280_MODE_FORCED, \
63  .temp_oversample = BMX280_OSRS_X1, \
64  .press_oversample = BMX280_OSRS_X1, \
65  .humid_oversample = BMX280_OSRS_X1, \
66 
67 /* Defaults for Weather Monitoring */
68 #ifndef BMX280_PARAMS
69 #ifdef BMX280_USE_SPI
70 #define BMX280_PARAMS \
71  { \
72  .spi = BMX280_PARAM_SPI, \
73  .clk = BMX280_PARAM_CLK, \
74  .cs = BMX280_PARAM_CS, \
75  BMX280_PARAM_MISC \
76  }
77 #else
78 #define BMX280_PARAMS \
79  { \
80  .i2c_dev = BMX280_PARAM_I2C_DEV, \
81  .i2c_addr = BMX280_PARAM_I2C_ADDR, \
82  BMX280_PARAM_MISC \
83  }
84 #endif
85 #endif
86 
92 {
93  BMX280_PARAMS
94 };
95 
99 #define BMX280_NUMOF ARRAY_SIZE(bmx280_params)
100 
109 {
110 #if defined(MODULE_BME280_SPI) || defined(MODULE_BME280_I2C)
111  { .name = "bme280" }
112 #else
113  { .name = "bmp280" }
114 #endif
115 };
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 
121 #endif /* BMX280_PARAMS_H */
122 
bmx280_params
static const bmx280_params_t bmx280_params[]
Configure BMX280.
Definition: bmx280_params.h:91
bmx280.h
Device driver interface for the BMP280 and BME280 sensors.
bmx280_saul_reg_info
static const saul_reg_info_t bmx280_saul_reg_info[BMX280_NUMOF]
Configuration details of SAUL registry entries.
Definition: bmx280_params.h:108
saul_reg_info_t
Additional data to collect for each entry.
Definition: saul_reg.h:49
saul_reg_info_t::name
const char * name
string identifier for a device
Definition: saul_reg.h:50
bmx280_params_t
Parameters for the BMX280 sensor.
Definition: bmx280.h:183
saul_reg.h
SAUL registry interface definition.
BMX280_NUMOF
#define BMX280_NUMOF
The number of configured sensors.
Definition: bmx280_params.h:99