bme680_params.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Mesotic SAS
3  * 2020 Gunar Schorcht
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
21 #ifndef BME680_PARAMS_H
22 #define BME680_PARAMS_H
23 
24 #include "board.h"
25 #include "bme680.h"
26 #include "saul_reg.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
37 #if MODULE_PERIPH_I2C || DOXYGEN
38 #ifndef BME680_PARAM_I2C_DEV
39 #define BME680_PARAM_I2C_DEV (I2C_DEV(0))
40 #endif
41 
42 #ifndef BME680_PARAM_I2C_ADDR
43 #define BME680_PARAM_I2C_ADDR (BME680_I2C_ADDR_2)
44 #endif
45 #endif /* MODULE_PERIPH_I2C */
46 
47 #if MODULE_PERIPH_SPI || DOXYGEN
48 #ifndef BME680_PARAM_SPI_DEV
49 #define BME680_PARAM_SPI_DEV (SPI_DEV(0))
50 #endif
51 
52 #ifndef BME680_PARAM_SPI_NSS_PIN
53 #define BME680_PARAM_SPI_NSS_PIN GPIO_PIN(0, 5)
54 #endif
55 #endif /* MODULE_PERIPH_SPI */
56 
60 #define BME680_PARAMS_I2C \
61 { \
62  .ifsel = BME680_I2C_INTF, \
63  .temp_os = BME680_OS_8X, \
64  .hum_os = BME680_OS_2X, \
65  .pres_os = BME680_OS_4X, \
66  .filter = BME680_FILTER_SIZE_3, \
67  .gas_measure = BME680_ENABLE_GAS_MEAS, \
68  .heater_dur = 320, \
69  .heater_temp = 150, \
70  .settings = BME680_OST_SEL | \
71  BME680_OSP_SEL | \
72  BME680_OSH_SEL | \
73  BME680_FILTER_SEL | \
74  BME680_GAS_SENSOR_SEL, \
75  .intf.i2c.dev = BME680_PARAM_I2C_DEV, \
76  .intf.i2c.addr = BME680_PARAM_I2C_ADDR, \
77 }
78 
82 #define BME680_PARAMS_SPI \
83 { \
84  .ifsel = BME680_SPI_INTF, \
85  .temp_os = BME680_OS_8X, \
86  .hum_os = BME680_OS_2X, \
87  .pres_os = BME680_OS_4X, \
88  .filter = BME680_FILTER_SIZE_3, \
89  .gas_measure = BME680_ENABLE_GAS_MEAS, \
90  .heater_dur = 320, \
91  .heater_temp = 150, \
92  .settings = BME680_OST_SEL | \
93  BME680_OSP_SEL | \
94  BME680_OSH_SEL | \
95  BME680_FILTER_SEL | \
96  BME680_GAS_SENSOR_SEL, \
97  .intf.spi.dev = BME680_PARAM_SPI_DEV, \
98  .intf.spi.nss_pin = BME680_PARAM_SPI_NSS_PIN, \
99 }
100 
104 #ifndef BME680_SAUL_INFO
105 #if MODULE_BME680_I2C && MODULE_BME680_SPI
106 #define BME680_SAUL_INFO { .name = "bme680:0" }, \
107  { .name = "bme680:1" },
108 #else /* MODULE_BME680_I2C && MODULE_BME680_SPI */
109 #define BME680_SAUL_INFO { .name = "bme680" }
110 #endif /* MODULE_BME680_I2C && MODULE_BME680_SPI */
111 #endif /* BME680_SAUL_INFO */
112 
118 {
119 #if MODULE_BME680_I2C || DOXYGEN
121 #endif
122 #if MODULE_BME680_SPI || DOXYGEN
124 #endif
125 };
126 
131 {
133 };
134 
138 #define BME680_NUMOF ARRAY_SIZE(bme680_params)
139 
140 #ifdef __cplusplus
141 }
142 #endif
143 
144 #endif /* BME680_PARAMS_H */
145 
BME680_SAUL_INFO
#define BME680_SAUL_INFO
Default SAUL meta information.
Definition: bme680_params.h:109
bme680_params_t
BME680 device initialization parameters.
Definition: bme680.h:216
saul_reg_info_t
Additional data to collect for each entry.
Definition: saul_reg.h:49
bme680.h
Interface definition for the Bosch BME680 sensor.
bme680_saul_info
static const saul_reg_info_t bme680_saul_info[]
Additional meta information to keep in the SAUL registry.
Definition: bme680_params.h:130
saul_reg.h
SAUL registry interface definition.
BME680_PARAMS_SPI
#define BME680_PARAMS_SPI
Defaults SPI parameters if none provided.
Definition: bme680_params.h:82
bme680_params
static const bme680_params_t bme680_params[]
Configure params for BME680.
Definition: bme680_params.h:117
BME680_PARAMS_I2C
#define BME680_PARAMS_I2C
Defaults I2C parameters if none provided.
Definition: bme680_params.h:60