environment  2.0.0.0
environment.h
Go to the documentation of this file.
1 /*
2  * MikroSDK - MikroE Software Development Kit
3  * Copyright (c) 2019, MikroElektronika - www.mikroe.com
4  * All rights reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 
33 // ----------------------------------------------------------------------------
34 
35 #ifndef ENVIRONMENT_H
36 #define ENVIRONMENT_H
37 
42 #ifdef PREINIT_SUPPORTED
43 #include "preinit.h"
44 #endif
45 
46 #ifdef MikroCCoreVersion
47  #if MikroCCoreVersion >= 1
48  #include "delays.h"
49  #endif
50 #endif
51 
52 #include "drv_digital_out.h"
53 #include "drv_digital_in.h"
54 #include "drv_i2c_master.h"
55 #include "drv_spi_master.h"
56 
57 // -------------------------------------------------------------- PUBLIC MACROS
68 #define ENVIRONMENT_MAP_MIKROBUS( cfg, mikrobus ) \
69  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
70  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
71  cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
72  cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
73  cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
74  cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS )
75 
81 #define ENVIRONMENT_MASTER_I2C 0
82 #define ENVIRONMENT_MASTER_SPI 1
83 
89 #define ENVIRONMENT_RETVAL uint8_t
90 
91 #define ENVIRONMENT_OK 0x00
92 #define ENVIRONMENT_INIT_ERROR 0xFF
93 
95 #define ENVIRONMENT_POLL_PERIOD_MS 10
96 
101 #define ENVIRONMENT_DEVICE_SLAVE_ADDR_0 0x76
102 #define ENVIRONMENT_DEVICE_SLAVE_ADDR_1 0x77
103 #define ENVIRONMENT_CHIP_ID 0x61
104 #define ENVIRONMENT_COEFF_SIZE 41
105 #define ENVIRONMENT_COEFF_ADDR1_LEN 25
106 #define ENVIRONMENT_COEFF_ADDR2_LEN 16
107 #define ENVIRONMENT_FIELD_LENGTH 15
108 #define ENVIRONMENT_FIELD_ADDR_OFFSET 17
109 #define ENVIRONMENT_SOFT_RESET_CMD 0xB6
110 #define ENVIRONMENT_DEVICE_OK 0
111 #define ENVIRONMENT_DEVICE_ERROR 1
112 #define ENVIRONMENT_E_NULL_PTR -1
113 #define ENVIRONMENT_E_COM_FAIL -2
114 #define ENVIRONMENT_E_DEV_NOT_FOUND -3
115 #define ENVIRONMENT_E_INVALID_LENGTH -4
116 #define ENVIRONMENT_W_DEFINE_PWR_MODE 1
117 #define ENVIRONMENT_W_NO_NEW_DATA 2
118 #define ENVIRONMENT_I_MIN_CORRECTION 1
119 #define ENVIRONMENT_I_MAX_CORRECTION 2
120 
126 #define ENVIRONMENT_ADDR_RES_HEAT_VAL_ADDR 0x00
127 #define ENVIRONMENT_ADDR_RES_HEAT_RANGE_ADDR 0x02
128 #define ENVIRONMENT_ADDR_RANGE_SW_ERR_ADDR 0x04
129 #define ENVIRONMENT_ADDR_SENS_CONF_START 0x5A
130 #define ENVIRONMENT_ADDR_GAS_CONF_START 0x64
131 #define ENVIRONMENT_FIELD0_ADDR 0x1d
132 #define ENVIRONMENT_RES_HEAT0_ADDR 0x5a
133 #define ENVIRONMENT_GAS_WAIT0_ADDR 0x64
134 #define ENVIRONMENT_CONF_HEAT_CTRL_ADDR 0x70
135 #define ENVIRONMENT_CONF_ODR_RUN_GAS_NBC_ADDR 0x71
136 #define ENVIRONMENT_CONF_OS_H_ADDR 0x72
137 #define ENVIRONMENT_MEM_PAGE_ADDR 0xf3
138 #define ENVIRONMENT_CONF_T_P_MODE_ADDR 0x74
139 #define ENVIRONMENT_CONF_ODR_FILT_ADDR 0x75
140 #define ENVIRONMENT_COEFF_ADDR1 0x89
141 #define ENVIRONMENT_COEFF_ADDR2 0xe1
142 #define ENVIRONMENT_CHIP_ID_ADDR 0xd0
143 #define ENVIRONMENT_SOFT_RESET_ADDR 0xe0
144 
150 #define ENVIRONMENT_ENABLE_HEATER 0x00
151 #define ENVIRONMENT_DISABLE_HEATER 0x08
152 #define ENVIRONMENT_DISABLE_GAS_MEAS 0x00
153 #define ENVIRONMENT_ENABLE_GAS_MEAS 0x01
154 #define ENVIRONMENT_OS_NONE 0
155 #define ENVIRONMENT_OS_1X 1
156 #define ENVIRONMENT_OS_2X 2
157 #define ENVIRONMENT_OS_4X 3
158 #define ENVIRONMENT_OS_8X 4
159 #define ENVIRONMENT_OS_16X 5
160 #define ENVIRONMENT_FILTER_SIZE_0 0
161 #define ENVIRONMENT_FILTER_SIZE_1 1
162 #define ENVIRONMENT_FILTER_SIZE_3 2
163 #define ENVIRONMENT_FILTER_SIZE_7 3
164 #define ENVIRONMENT_FILTER_SIZE_15 4
165 #define ENVIRONMENT_FILTER_SIZE_31 5
166 #define ENVIRONMENT_FILTER_SIZE_63 6
167 #define ENVIRONMENT_FILTER_SIZE_127 7
168 #define ENVIRONMENT_SLEEP_MODE 0
169 #define ENVIRONMENT_FORCED_MODE 1
170 #define ENVIRONMENT_RESET_PERIOD 10
171 #define ENVIRONMENT_MEM_PAGE0 0x10
172 #define ENVIRONMENT_MEM_PAGE1 0x00
173 #define ENVIRONMENT_HUM_REG_SHIFT_VAL 4
174 #define ENVIRONMENT_RUN_GAS_DISABLE 0
175 #define ENVIRONMENT_RUN_GAS_ENABLE 1
176 #define ENVIRONMENT_TMP_BUFFER_LENGTH 40
177 #define ENVIRONMENT_REG_BUFFER_LENGTH 6
178 #define ENVIRONMENT_FIELD_DATA_LENGTH 3
179 #define ENVIRONMENT_GAS_REG_BUF_LENGTH 20
180 #define ENVIRONMENT_OST_SEL 1
181 #define ENVIRONMENT_OSP_SEL 2
182 #define ENVIRONMENT_OSH_SEL 4
183 #define ENVIRONMENT_GAS_MEAS_SEL 8
184 #define ENVIRONMENT_FILTER_SEL 16
185 #define ENVIRONMENT_HCNTRL_SEL 32
186 #define ENVIRONMENT_RUN_GAS_SEL 64
187 #define ENVIRONMENT_NBCONV_SEL 128
188 #define ENVIRONMENT_GAS_SENSOR_SEL ( ENVIRONMENT_GAS_MEAS_SEL | \
189  ENVIRONMENT_RUN_GAS_SEL | \
190  ENVIRONMENT_NBCONV_SEL )
191 #define ENVIRONMENT_NBCONV_MIN 0
192 #define ENVIRONMENT_NBCONV_MAX 10
193 #define ENVIRONMENT_GAS_MEAS_MSK 0x30
194 #define ENVIRONMENT_NBCONV_MSK 0X0F
195 #define ENVIRONMENT_FILTER_MSK 0X1C
196 #define ENVIRONMENT_OST_MSK 0XE0
197 #define ENVIRONMENT_OSP_MSK 0X1C
198 #define ENVIRONMENT_OSH_MSK 0X07
199 #define ENVIRONMENT_HCTRL_MSK 0x08
200 #define ENVIRONMENT_RUN_GAS_MSK 0x10
201 #define ENVIRONMENT_MODE_MSK 0x03
202 #define ENVIRONMENT_RHRANGE_MSK 0x30
203 #define ENVIRONMENT_RSERROR_MSK 0xf0
204 #define ENVIRONMENT_NEW_DATA_MSK 0x80
205 #define ENVIRONMENT_GAS_INDEX_MSK 0x0f
206 #define ENVIRONMENT_GAS_RANGE_MSK 0x0f
207 #define ENVIRONMENT_GASM_VALID_MSK 0x20
208 #define ENVIRONMENT_HEAT_STAB_MSK 0x10
209 #define ENVIRONMENT_MEM_PAGE_MSK 0x10
210 #define ENVIRONMENT_SPI_RD_MSK 0x80
211 #define ENVIRONMENT_SPI_WR_MSK 0x7f
212 #define ENVIRONMENT_BIT_H1_DATA_MSK 0x0F
213 #define ENVIRONMENT_GAS_MEAS_POS 4
214 #define ENVIRONMENT_FILTER_POS 2
215 #define ENVIRONMENT_OST_POS 5
216 #define ENVIRONMENT_OSP_POS 2
217 #define ENVIRONMENT_RUN_GAS_POS 4
218 #define ENVIRONMENT_T2_LSB_REG 1
219 #define ENVIRONMENT_T2_MSB_REG 2
220 #define ENVIRONMENT_T3_REG 3
221 #define ENVIRONMENT_P1_LSB_REG 5
222 #define ENVIRONMENT_P1_MSB_REG 6
223 #define ENVIRONMENT_P2_LSB_REG 7
224 #define ENVIRONMENT_P2_MSB_REG 8
225 #define ENVIRONMENT_P3_REG 9
226 #define ENVIRONMENT_P4_LSB_REG 11
227 #define ENVIRONMENT_P4_MSB_REG 12
228 #define ENVIRONMENT_P5_LSB_REG 13
229 #define ENVIRONMENT_P5_MSB_REG 14
230 #define ENVIRONMENT_P7_REG 15
231 #define ENVIRONMENT_P6_REG 16
232 #define ENVIRONMENT_P8_LSB_REG 19
233 #define ENVIRONMENT_P8_MSB_REG 20
234 #define ENVIRONMENT_P9_LSB_REG 21
235 #define ENVIRONMENT_P9_MSB_REG 22
236 #define ENVIRONMENT_P10_REG 23
237 #define ENVIRONMENT_H2_MSB_REG 25
238 #define ENVIRONMENT_H2_LSB_REG 26
239 #define ENVIRONMENT_H1_LSB_REG 26
240 #define ENVIRONMENT_H1_MSB_REG 27
241 #define ENVIRONMENT_H3_REG 28
242 #define ENVIRONMENT_H4_REG 29
243 #define ENVIRONMENT_H5_REG 30
244 #define ENVIRONMENT_H6_REG 31
245 #define ENVIRONMENT_H7_REG 32
246 #define ENVIRONMENT_T1_LSB_REG 33
247 #define ENVIRONMENT_T1_MSB_REG 34
248 #define ENVIRONMENT_GH2_LSB_REG 35
249 #define ENVIRONMENT_GH2_MSB_REG 36
250 #define ENVIRONMENT_GH1_REG 37
251 #define ENVIRONMENT_GH3_REG 38
252 #define ENVIRONMENT_REG_FILTER_INDEX 5
253 #define ENVIRONMENT_REG_TEMP_INDEX 4
254 #define ENVIRONMENT_REG_PRES_INDEX 4
255 #define ENVIRONMENT_REG_HUM_INDEX 2
256 #define ENVIRONMENT_REG_NBCONV_INDEX 1
257 #define ENVIRONMENT_REG_RUN_GAS_INDEX 1
258 #define ENVIRONMENT_REG_HCTRL_INDEX 0
259 #define ENVIRONMENT_MAX_OVERFLOW_VAL 0x40000000
260 #define ENVIRONMENT_DATA_TEMPERATURE 0x01
261 #define ENVIRONMENT_DATA_PRESSURE 0x02
262 #define ENVIRONMENT_DATA_HUMIDITY 0x03
263 #define BME680_CONCAT_BYTES(msb, lsb) (((uint16_t)msb << 8) | (uint16_t)lsb)
264 #define BME680_SET_BITS(reg_data, bitname, data) \
265  ((reg_data & ~(bitname##_MSK)) | \
266  ((data << bitname##_POS) & bitname##_MSK))
267 #define BME680_SET_BITS_POS_0(reg_data, bitname, data) \
268  ((reg_data & ~(bitname##_MSK)) | \
269  (data & bitname##_MSK))
270  // End group macro
272 // --------------------------------------------------------------- PUBLIC TYPES
278 typedef struct
279 {
280  uint8_t status;
281  uint8_t gas_index;
282  uint8_t meas_index;
283  int16_t temperature;
284  float pressure;
285  uint32_t humidity;
286  uint32_t gas_resistance;
287 
289 
290 typedef struct
291 {
292  uint16_t par_h1;
293  uint16_t par_h2;
294  int8_t par_h3;
295  int8_t par_h4;
296  int8_t par_h5;
297  uint8_t par_h6;
298  int8_t par_h7;
299  int8_t par_gh1;
300  int16_t par_gh2;
301  int8_t par_gh3;
302  uint16_t par_t1;
303  int16_t par_t2;
304  int8_t par_t3;
305  uint16_t par_p1;
306  int16_t par_p2;
307  int8_t par_p3;
308  int16_t par_p4;
309  int16_t par_p5;
310  int8_t par_p6;
311  int8_t par_p7;
312  int16_t par_p8;
313  int16_t par_p9;
314  uint8_t par_p10;
315  int32_t t_fine;
316  uint8_t res_heat_range;
317  int8_t res_heat_val;
318  int8_t range_sw_err;
319 
321 
322 typedef struct
323 {
324  uint8_t os_hum;
325  uint8_t os_temp;
326  uint8_t os_pres;
327  uint8_t filter;
328 
330 
331 
332 typedef struct
333 {
334  uint8_t nb_conv;
335  uint8_t heatr_ctrl;
336  uint8_t run_gas;
337  uint16_t heatr_temp;
338  uint16_t heatr_dur;
339 
341 
345 typedef uint8_t environment_select_t;
346 
350 typedef void ( *environment_master_io_t )( struct environment_s*, uint8_t, uint8_t*, uint8_t );
351 
355 typedef struct environment_s
356 {
357  digital_out_t cs;
358 
359  // Modules
360 
361  i2c_master_t i2c;
362  spi_master_t spi;
363 
364  // ctx variable
365 
366  uint8_t slave_address;
367  pin_name_t chip_select;
371 
376 
379 
381 
385 typedef struct
386 {
387  // Communication gpio pins
388 
389  pin_name_t scl;
390  pin_name_t sda;
391  pin_name_t miso;
392  pin_name_t mosi;
393  pin_name_t sck;
394  pin_name_t cs;
395 
396  // static variable
397 
398  uint32_t i2c_speed;
399  uint8_t i2c_address;
400 
401  uint32_t spi_speed;
402  spi_master_mode_t spi_mode;
403  spi_master_chip_select_polarity_t cs_polarity;
404 
406 
408  // End types group
410 
411 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
417 #ifdef __cplusplus
418 extern "C"{
419 #endif
420 
430 
439 
449 
460 void environment_generic_write ( environment_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
461 
472 void environment_generic_read ( environment_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
473 
486 void environment_write_byte ( environment_t *ctx, uint8_t reg_address, uint8_t write_data );
487 
501 uint8_t environment_read_byte ( environment_t *ctx, uint8_t reg_address );
502 
517 
533 
544 
559 
574 
590 float environment_get_ambient_data ( environment_t *ctx, uint8_t data_in );
591 
605 
619 
632 
645 
646 #ifdef __cplusplus
647 }
648 #endif
649 #endif // _ENVIRONMENT_H_
650  // End public_function group
653 
654 // ------------------------------------------------------------------------- END
T_ENVIRONMENT_BME680_CALIB_DATA::par_t3
int8_t par_t3
Definition: environment.h:304
T_ENVIRONMENT_BME680_CALIB_DATA::par_p5
int16_t par_p5
Definition: environment.h:309
environment_cfg_t::sel
environment_select_t sel
Definition: environment.h:405
T_ENVIRONMENT_BME680_CALIB_DATA::par_p7
int8_t par_p7
Definition: environment.h:311
T_ENVIRONMENT_BME680_GAS_SETTINGS::run_gas
uint8_t run_gas
Definition: environment.h:336
T_ENVIRONMENT_BME680_CALIB_DATA::par_h1
uint16_t par_h1
Definition: environment.h:292
T_ENVIRONMENT_BME680_CALIB_DATA::par_gh3
int8_t par_gh3
Definition: environment.h:301
environment_cfg_t::i2c_speed
uint32_t i2c_speed
Definition: environment.h:398
environment_master_io_t
void(* environment_master_io_t)(struct environment_s *, uint8_t, uint8_t *, uint8_t)
Master Input/Output type.
Definition: environment.h:350
T_ENVIRONMENT_BME680_FIELD_DATA::status
uint8_t status
Definition: environment.h:280
environment_s::d_data
T_ENVIRONMENT_BME680_FIELD_DATA d_data
Definition: environment.h:372
T_ENVIRONMENT_BME680_CALIB_DATA::par_p4
int16_t par_p4
Definition: environment.h:308
environment_select_t
uint8_t environment_select_t
Communication type.
Definition: environment.h:345
environment_cfg_t::sda
pin_name_t sda
Definition: environment.h:390
T_ENVIRONMENT_BME680_FIELD_DATA
Definition: environment.h:279
environment_init
ENVIRONMENT_RETVAL environment_init(environment_t *ctx, environment_cfg_t *cfg)
Initialization function.
T_ENVIRONMENT_BME680_TPH_SETTINGS::filter
uint8_t filter
Definition: environment.h:327
T_ENVIRONMENT_BME680_GAS_SETTINGS
Definition: environment.h:333
T_ENVIRONMENT_BME680_FIELD_DATA::humidity
uint32_t humidity
Definition: environment.h:285
environment_s::device_power_mode
uint8_t device_power_mode
Definition: environment.h:378
T_ENVIRONMENT_BME680_CALIB_DATA::t_fine
int32_t t_fine
Definition: environment.h:315
environment_cfg_t::miso
pin_name_t miso
Definition: environment.h:391
T_ENVIRONMENT_BME680_CALIB_DATA::par_p10
uint8_t par_p10
Definition: environment.h:314
T_ENVIRONMENT_BME680_CALIB_DATA::par_p2
int16_t par_p2
Definition: environment.h:306
T_ENVIRONMENT_BME680_CALIB_DATA::par_t1
uint16_t par_t1
Definition: environment.h:302
environment_t
struct environment_s environment_t
Click ctx object definition.
environment_s::slave_address
uint8_t slave_address
Definition: environment.h:366
T_ENVIRONMENT_BME680_CALIB_DATA
Definition: environment.h:291
environment_get_humidity
float environment_get_humidity(environment_t *ctx)
Gets humidity in percentage [ % ] function.
environment_s::gas_sett
T_ENVIRONMENT_BME680_GAS_SETTINGS gas_sett
Definition: environment.h:375
T_ENVIRONMENT_BME680_CALIB_DATA::par_p1
uint16_t par_p1
Definition: environment.h:305
T_ENVIRONMENT_BME680_CALIB_DATA::range_sw_err
int8_t range_sw_err
Definition: environment.h:318
T_ENVIRONMENT_BME680_FIELD_DATA::temperature
int16_t temperature
Definition: environment.h:283
environment_s::cs
digital_out_t cs
Definition: environment.h:357
T_ENVIRONMENT_BME680_FIELD_DATA::gas_index
uint8_t gas_index
Definition: environment.h:281
T_ENVIRONMENT_BME680_CALIB_DATA::par_h4
int8_t par_h4
Definition: environment.h:295
environment_get_ambient_data
float environment_get_ambient_data(environment_t *ctx, uint8_t data_in)
Get ambient data function.
environment_s::chip_select
pin_name_t chip_select
Definition: environment.h:367
T_ENVIRONMENT_BME680_CALIB_DATA::par_t2
int16_t par_t2
Definition: environment.h:303
T_ENVIRONMENT_BME680_TPH_SETTINGS::os_temp
uint8_t os_temp
Definition: environment.h:325
T_ENVIRONMENT_BME680_CALIB_DATA::par_gh1
int8_t par_gh1
Definition: environment.h:299
environment_s::write_f
environment_master_io_t write_f
Definition: environment.h:368
environment_generic_write
void environment_generic_write(environment_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
T_ENVIRONMENT_BME680_CALIB_DATA::par_gh2
int16_t par_gh2
Definition: environment.h:300
T_ENVIRONMENT_BME680_CALIB_DATA::par_p8
int16_t par_p8
Definition: environment.h:312
environment_cfg_t::mosi
pin_name_t mosi
Definition: environment.h:392
environment_write_byte
void environment_write_byte(environment_t *ctx, uint8_t reg_address, uint8_t write_data)
Generic the write byte of data function.
environment_s::i2c
i2c_master_t i2c
Definition: environment.h:361
environment_check_id
uint8_t environment_check_id(environment_t *ctx)
Check device ID function.
environment_cfg_t::cs
pin_name_t cs
Definition: environment.h:394
T_ENVIRONMENT_BME680_CALIB_DATA::par_h5
int8_t par_h5
Definition: environment.h:296
environment_cfg_t::cs_polarity
spi_master_chip_select_polarity_t cs_polarity
Definition: environment.h:403
environment_cfg_t::scl
pin_name_t scl
Definition: environment.h:389
environment_cfg_t::sck
pin_name_t sck
Definition: environment.h:393
T_ENVIRONMENT_BME680_CALIB_DATA::res_heat_range
uint8_t res_heat_range
Definition: environment.h:316
T_ENVIRONMENT_BME680_CALIB_DATA::par_h6
uint8_t par_h6
Definition: environment.h:297
environment_s::master_sel
environment_select_t master_sel
Definition: environment.h:370
environment_cfg_setup
void environment_cfg_setup(environment_cfg_t *cfg)
Config Object Initialization function.
T_ENVIRONMENT_BME680_CALIB_DATA::par_p3
int8_t par_p3
Definition: environment.h:307
environment_cfg_t
Click configuration structure definition.
Definition: environment.h:386
T_ENVIRONMENT_BME680_FIELD_DATA::meas_index
uint8_t meas_index
Definition: environment.h:282
T_ENVIRONMENT_BME680_GAS_SETTINGS::heatr_ctrl
uint8_t heatr_ctrl
Definition: environment.h:335
T_ENVIRONMENT_BME680_CALIB_DATA::par_p6
int8_t par_p6
Definition: environment.h:310
environment_get_gas_resistance
uint32_t environment_get_gas_resistance(environment_t *ctx)
Gets gas resistance data function.
T_ENVIRONMENT_BME680_GAS_SETTINGS::heatr_temp
uint16_t heatr_temp
Definition: environment.h:337
environment_default_cfg
void environment_default_cfg(environment_t *ctx)
Click Default Configuration function.
environment_s::device_mem_page
uint8_t device_mem_page
Definition: environment.h:377
environment_s::read_f
environment_master_io_t read_f
Definition: environment.h:369
environment_cfg_t::spi_mode
spi_master_mode_t spi_mode
Definition: environment.h:402
T_ENVIRONMENT_BME680_GAS_SETTINGS::heatr_dur
uint16_t heatr_dur
Definition: environment.h:338
environment_s::tph_sett
T_ENVIRONMENT_BME680_TPH_SETTINGS tph_sett
Definition: environment.h:374
T_ENVIRONMENT_BME680_FIELD_DATA::gas_resistance
uint32_t gas_resistance
Definition: environment.h:286
environment_get_device_id
uint8_t environment_get_device_id(environment_t *ctx)
Get device ID function.
T_ENVIRONMENT_BME680_TPH_SETTINGS
Definition: environment.h:323
environment_get_pressure
float environment_get_pressure(environment_t *ctx)
Gets pressure in degrees Celsius function.
T_ENVIRONMENT_BME680_GAS_SETTINGS::nb_conv
uint8_t nb_conv
Definition: environment.h:334
T_ENVIRONMENT_BME680_FIELD_DATA::pressure
float pressure
Definition: environment.h:284
environment_soft_reset
void environment_soft_reset(environment_t *ctx)
Software reset function.
T_ENVIRONMENT_BME680_TPH_SETTINGS::os_hum
uint8_t os_hum
Definition: environment.h:324
environment_read_byte
uint8_t environment_read_byte(environment_t *ctx, uint8_t reg_address)
Generic the read byte of data function.
T_ENVIRONMENT_BME680_CALIB_DATA::par_h7
int8_t par_h7
Definition: environment.h:298
environment_s::calib
T_ENVIRONMENT_BME680_CALIB_DATA calib
Definition: environment.h:373
environment_cfg_t::i2c_address
uint8_t i2c_address
Definition: environment.h:399
environment_default_config
void environment_default_config(environment_t *ctx)
Set default configuration for the BMP680 sensor function.
environment_cfg_t::spi_speed
uint32_t spi_speed
Definition: environment.h:401
environment_generic_read
void environment_generic_read(environment_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
environment_s::spi
spi_master_t spi
Definition: environment.h:362
environment_get_temperature
float environment_get_temperature(environment_t *ctx)
Gets temperature in degrees Celsius function.
environment_s
Click ctx object definition.
Definition: environment.h:356
T_ENVIRONMENT_BME680_CALIB_DATA::par_p9
int16_t par_p9
Definition: environment.h:313
T_ENVIRONMENT_BME680_CALIB_DATA::par_h3
int8_t par_h3
Definition: environment.h:294
T_ENVIRONMENT_BME680_CALIB_DATA::par_h2
uint16_t par_h2
Definition: environment.h:293
T_ENVIRONMENT_BME680_CALIB_DATA::res_heat_val
int8_t res_heat_val
Definition: environment.h:317
ENVIRONMENT_RETVAL
#define ENVIRONMENT_RETVAL
Definition: environment.h:89
T_ENVIRONMENT_BME680_TPH_SETTINGS::os_pres
uint8_t os_pres
Definition: environment.h:326
environment_get_calibration_data
void environment_get_calibration_data(environment_t *ctx)
Get factory calibration parameters function.