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 
10 #pragma once
11 
23 #include "board.h"
24 #include "bme680.h"
25 #include "saul_reg.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
36 #if MODULE_PERIPH_I2C || DOXYGEN
37 #ifndef BME680_PARAM_I2C_DEV
38 #define BME680_PARAM_I2C_DEV (I2C_DEV(0))
39 #endif
40 
41 #ifndef BME680_PARAM_I2C_ADDR
42 #define BME680_PARAM_I2C_ADDR (BME680_I2C_ADDR_2)
43 #endif
44 #endif /* MODULE_PERIPH_I2C */
45 
46 #if MODULE_PERIPH_SPI || DOXYGEN
47 #ifndef BME680_PARAM_SPI_DEV
48 #define BME680_PARAM_SPI_DEV (SPI_DEV(0))
49 #endif
50 
51 #ifndef BME680_PARAM_SPI_NSS_PIN
52 #define BME680_PARAM_SPI_NSS_PIN GPIO_PIN(0, 5)
53 #endif
54 #endif /* MODULE_PERIPH_SPI */
55 
59 #define BME680_PARAMS_I2C \
60 { \
61  .ifsel = BME680_I2C_INTF, \
62  .temp_os = BME680_OS_8X, \
63  .hum_os = BME680_OS_2X, \
64  .pres_os = BME680_OS_4X, \
65  .filter = BME680_FILTER_SIZE_3, \
66  .gas_measure = BME680_ENABLE_GAS_MEAS, \
67  .heater_dur = 320, \
68  .heater_temp = 150, \
69  .settings = BME680_OST_SEL | \
70  BME680_OSP_SEL | \
71  BME680_OSH_SEL | \
72  BME680_FILTER_SEL | \
73  BME680_GAS_SENSOR_SEL, \
74  .intf.i2c.dev = BME680_PARAM_I2C_DEV, \
75  .intf.i2c.addr = BME680_PARAM_I2C_ADDR, \
76 }
77 
81 #define BME680_PARAMS_SPI \
82 { \
83  .ifsel = BME680_SPI_INTF, \
84  .temp_os = BME680_OS_8X, \
85  .hum_os = BME680_OS_2X, \
86  .pres_os = BME680_OS_4X, \
87  .filter = BME680_FILTER_SIZE_3, \
88  .gas_measure = BME680_ENABLE_GAS_MEAS, \
89  .heater_dur = 320, \
90  .heater_temp = 150, \
91  .settings = BME680_OST_SEL | \
92  BME680_OSP_SEL | \
93  BME680_OSH_SEL | \
94  BME680_FILTER_SEL | \
95  BME680_GAS_SENSOR_SEL, \
96  .intf.spi.dev = BME680_PARAM_SPI_DEV, \
97  .intf.spi.nss_pin = BME680_PARAM_SPI_NSS_PIN, \
98 }
99 
103 #ifndef BME680_SAUL_INFO
104 #if MODULE_BME680_I2C && MODULE_BME680_SPI
105 #define BME680_SAUL_INFO { .name = "bme680:0" }, \
106  { .name = "bme680:1" },
107 #else /* MODULE_BME680_I2C && MODULE_BME680_SPI */
108 #define BME680_SAUL_INFO { .name = "bme680" }
109 #endif /* MODULE_BME680_I2C && MODULE_BME680_SPI */
110 #endif /* BME680_SAUL_INFO */
117 {
118 #if MODULE_BME680_I2C || DOXYGEN
120 #endif
121 #if MODULE_BME680_SPI || DOXYGEN
123 #endif
124 };
125 
130 {
132 };
133 
137 #define BME680_NUMOF ARRAY_SIZE(bme680_params)
138 
139 #ifdef __cplusplus
140 }
141 #endif
142 
Interface definition for the Bosch BME680 sensor.
#define BME680_SAUL_INFO
Default SAUL meta information.
#define BME680_PARAMS_I2C
Defaults I2C parameters if none provided.
Definition: bme680_params.h:59
#define BME680_PARAMS_SPI
Defaults SPI parameters if none provided.
Definition: bme680_params.h:81
static const saul_reg_info_t bme680_saul_info[]
Additional meta information to keep in the SAUL registry.
static const bme680_params_t bme680_params[]
Configure params for BME680.
SAUL registry interface definition.
BME680 device initialization parameters.
Definition: bme680.h:215
Additional data to collect for each entry.
Definition: saul_reg.h:48