59 #ifndef __BME280DRIVER_H__
60 #define __BME280DRIVER_H__
77 #include <linux/types.h>
78 #include <linux/math64.h>
79 #define BME280_64BITSUPPORT_PRESENT
87 typedef u_int16_t
u16;
88 typedef u_int32_t
u32;
89 typedef u_int64_t
u64;
98 # if !defined(__STDC_VERSION__)
103 #if (__STDC_VERSION__ == 201112L)
111 typedef uint16_t
u16;
112 typedef uint32_t
u32;
113 typedef uint64_t
u64;
120 #define BME280_64BITSUPPORT_PRESENT
125 #elif (__STDC_VERSION__ == 199901L)
135 typedef uint16_t
u16;
136 typedef uint32_t
u32;
137 typedef uint64_t
u64;
144 #define BME280_64BITSUPPORT_PRESENT
155 #define MACHINE_32_BIT
161 #ifdef MACHINE_16_BIT
164 typedef signed char s8;
165 typedef signed short int s16;
166 typedef signed long int s32;
168 #if defined(LONG_MAX) && LONG_MAX == 0x7fffffffffffffffL
169 typedef long int s64;
170 typedef unsigned long int u64;
171 #define BME280_64BITSUPPORT_PRESENT
172 #elif defined(LLONG_MAX) && (LLONG_MAX == 0x7fffffffffffffffLL)
173 typedef long long int s64;
174 typedef unsigned long long int u64;
175 #define BME280_64BITSUPPORT_PRESENT
177 #warning Either the correct data type for signed 64 bit integer \
178 could not be found, or 64 bit integers are not supported in your environment.
179 #warning The API will only offer 32 bit pressure calculation.This will \
180 slightly impede accuracy(noise of ~1 pascal RMS will be added to output).
181 #warning If 64 bit integers are supported on your platform, \
182 please set s64 manually and "#define(BMPE80_64BITSUPPORT_PRESENT)" manually.
186 typedef unsigned char u8;
187 typedef unsigned short int u16;
188 typedef unsigned long int u32;
192 #elif defined MACHINE_32_BIT
194 typedef signed char s8;
195 typedef signed short int s16;
197 typedef signed long long int s64;
200 typedef unsigned char u8;
201 typedef unsigned short int u16;
203 typedef unsigned long long int u64;
208 #define BME280_64BITSUPPORT_PRESENT
212 #elif defined MACHINE_64_BIT
214 typedef signed char s8;
215 typedef signed short int s16;
216 typedef signed int s32;
217 typedef signed long int s64;
220 typedef unsigned char u8;
221 typedef unsigned short int u16;
222 typedef unsigned int u32;
223 typedef unsigned long int u64;
224 #define BME280_64BITSUPPORT_PRESENT
227 #warning The data types defined above which not supported \
228 define the data types manually
241 #define MACHINE_32_BIT
245 #ifdef MACHINE_16_BIT
248 typedef signed char s8;
249 typedef signed short int s16;
250 typedef signed long int s32;
252 #if defined(LONG_MAX) && LONG_MAX == 0x7fffffffffffffffL
253 typedef long int s64;
254 typedef unsigned long int u64;
255 #define BME280_64BITSUPPORT_PRESENT
256 #elif defined(LLONG_MAX) && (LLONG_MAX == 0x7fffffffffffffffLL)
257 typedef long long int s64;
258 typedef unsigned long long int u64;
259 #define BME280_64BITSUPPORT_PRESENT
261 #warning Either the correct data type for signed 64 bit integer \
262 could not be found, or 64 bit integers are not supported in your environment.
263 #warning The API will only offer 32 bit pressure calculation.This will \
264 slightly impede accuracy(noise of ~1 pascal RMS will be added to output).
265 #warning If 64 bit integers are supported on your platform, \
266 please set s64 manually and "#define(BME280_64BITSUPPORT_PRESENT)" manually.
270 typedef unsigned char u8;
271 typedef unsigned short int u16;
272 typedef unsigned long int u32;
276 #elif defined MACHINE_32_BIT
278 typedef signed char s8;
279 typedef signed short int s16;
280 typedef signed int s32;
281 typedef signed long long int s64;
284 typedef unsigned char u8;
285 typedef unsigned short int u16;
286 typedef unsigned int u32;
287 typedef unsigned long long int u64;
288 #define BME280_64BITSUPPORT_PRESENT
292 #elif defined MACHINE_64_BIT
294 typedef signed char s8;
295 typedef signed short int s16;
296 typedef signed int s32;
297 typedef signed long int s64;
300 typedef unsigned char u8;
301 typedef unsigned short int u16;
302 typedef unsigned int u32;
303 typedef unsigned long int u64;
304 #define BME280_64BITSUPPORT_PRESENT
307 #warning The data types defined above which not supported \
308 define the data types manually
320 #define BME280_ENABLE_FLOAT
327 #define BME280_ENABLE_INT64
352 #define BME280_BUS_WR_RETURN_TYPE s8
356 #define BME280_BUS_WR_PARAM_TYPES u8, u8,\
361 #define BME280_BUS_WR_PARAM_ORDER(device_addr, register_addr,\
362 register_data, wr_len)
365 #define BME280_BUS_WRITE_FUNC(device_addr, register_addr,\
366 register_data, wr_len) bus_write(device_addr, register_addr,\
367 register_data, wr_len)
394 #define BME280_BUS_RD_RETURN_TYPE s8
398 #define BME280_BUS_RD_PARAM_TYPES (u8, u8,\
404 #define BME280_BUS_RD_PARAM_ORDER (device_addr, register_addr,\
408 #define BME280_BUS_READ_FUNC(device_addr, register_addr,\
409 register_data, rd_len)bus_read(device_addr, register_addr,\
410 register_data, rd_len)
416 #define BME280_DELAY_RETURN_TYPE void
420 #define BME280_DELAY_PARAM_TYPES u16
425 #define BME280_DELAY_FUNC(delay_in_msec)\
426 delay_func(delay_in_msec)
428 #define BME280_GET_BITSLICE(regvar, bitname)\
429 ((regvar & bitname##__MSK) >> bitname##__POS)
431 #define BME280_SET_BITSLICE(regvar, bitname, val)\
432 ((regvar & ~bitname##__MSK) | ((val<<bitname##__POS)&bitname##__MSK))
438 #define BME280_NULL (0)
439 #define BME280_RETURN_FUNCTION_TYPE s8
441 #define BME280_SHIFT_BIT_POSITION_BY_01_BIT (1)
442 #define BME280_SHIFT_BIT_POSITION_BY_02_BITS (2)
443 #define BME280_SHIFT_BIT_POSITION_BY_03_BITS (3)
444 #define BME280_SHIFT_BIT_POSITION_BY_04_BITS (4)
445 #define BME280_SHIFT_BIT_POSITION_BY_07_BITS (7)
446 #define BME280_SHIFT_BIT_POSITION_BY_08_BITS (8)
447 #define BME280_SHIFT_BIT_POSITION_BY_10_BITS (10)
448 #define BME280_SHIFT_BIT_POSITION_BY_11_BITS (11)
449 #define BME280_SHIFT_BIT_POSITION_BY_12_BITS (12)
450 #define BME280_SHIFT_BIT_POSITION_BY_13_BITS (13)
451 #define BME280_SHIFT_BIT_POSITION_BY_14_BITS (14)
452 #define BME280_SHIFT_BIT_POSITION_BY_15_BITS (15)
453 #define BME280_SHIFT_BIT_POSITION_BY_16_BITS (16)
454 #define BME280_SHIFT_BIT_POSITION_BY_17_BITS (17)
455 #define BME280_SHIFT_BIT_POSITION_BY_18_BITS (18)
456 #define BME280_SHIFT_BIT_POSITION_BY_19_BITS (19)
457 #define BME280_SHIFT_BIT_POSITION_BY_20_BITS (20)
458 #define BME280_SHIFT_BIT_POSITION_BY_25_BITS (25)
459 #define BME280_SHIFT_BIT_POSITION_BY_31_BITS (31)
460 #define BME280_SHIFT_BIT_POSITION_BY_33_BITS (33)
461 #define BME280_SHIFT_BIT_POSITION_BY_35_BITS (35)
462 #define BME280_SHIFT_BIT_POSITION_BY_47_BITS (47)
465 #define BME280_PRESSURE_TEMPERATURE_CALIB_DATA_LENGTH (26)
466 #define BME280_HUMIDITY_CALIB_DATA_LENGTH (7)
467 #define BME280_GEN_READ_WRITE_DATA_LENGTH (1)
468 #define BME280_HUMIDITY_DATA_LENGTH (2)
469 #define BME280_TEMPERATURE_DATA_LENGTH (3)
470 #define BME280_PRESSURE_DATA_LENGTH (3)
471 #define BME280_ALL_DATA_FRAME_LENGTH (8)
472 #define BME280_INIT_VALUE (0)
473 #define BME280_INVALID_DATA (0)
478 #define SUCCESS ((u8)0)
479 #define E_BME280_NULL_PTR ((s8)-127)
480 #define E_BME280_COMM_RES ((s8)-1)
481 #define E_BME280_OUT_OF_RANGE ((s8)-2)
482 #define ERROR ((s8)-1)
486 #define BME280_I2C_ADDRESS1 (0x76)
487 #define BME280_I2C_ADDRESS2 (0x77)
492 #define BME280_SLEEP_MODE (0x00)
493 #define BME280_FORCED_MODE (0x01)
494 #define BME280_NORMAL_MODE (0x03)
495 #define BME280_SOFT_RESET_CODE (0xB6)
499 #define BME280_STANDBY_TIME_1_MS (0x00)
500 #define BME280_STANDBY_TIME_63_MS (0x01)
501 #define BME280_STANDBY_TIME_125_MS (0x02)
502 #define BME280_STANDBY_TIME_250_MS (0x03)
503 #define BME280_STANDBY_TIME_500_MS (0x04)
504 #define BME280_STANDBY_TIME_1000_MS (0x05)
505 #define BME280_STANDBY_TIME_10_MS (0x06)
506 #define BME280_STANDBY_TIME_20_MS (0x07)
510 #define BME280_OVERSAMP_SKIPPED (0x00)
511 #define BME280_OVERSAMP_1X (0x01)
512 #define BME280_OVERSAMP_2X (0x02)
513 #define BME280_OVERSAMP_4X (0x03)
514 #define BME280_OVERSAMP_8X (0x04)
515 #define BME280_OVERSAMP_16X (0x05)
540 #define BME280_STANDARD_OVERSAMP_HUMIDITY BME280_OVERSAMP_1X
544 #define BME280_FILTER_COEFF_OFF (0x00)
545 #define BME280_FILTER_COEFF_2 (0x01)
546 #define BME280_FILTER_COEFF_4 (0x02)
547 #define BME280_FILTER_COEFF_8 (0x03)
548 #define BME280_FILTER_COEFF_16 (0x04)
552 #define T_INIT_MAX (20)
554 #define T_MEASURE_PER_OSRS_MAX (37)
557 #define T_SETUP_PRESSURE_MAX (10)
560 #define T_SETUP_HUMIDITY_MAX (10)
565 #define BME280_HUMIDITY_DATA_SIZE (2)
566 #define BME280_TEMPERATURE_DATA_SIZE (3)
567 #define BME280_PRESSURE_DATA_SIZE (3)
568 #define BME280_DATA_FRAME_SIZE (8)
571 #define BME280_CALIB_DATA_SIZE (26)
573 #define BME280_TEMPERATURE_MSB_DATA (0)
574 #define BME280_TEMPERATURE_LSB_DATA (1)
575 #define BME280_TEMPERATURE_XLSB_DATA (2)
576 #define BME280_PRESSURE_MSB_DATA (0)
577 #define BME280_PRESSURE_LSB_DATA (1)
578 #define BME280_PRESSURE_XLSB_DATA (2)
579 #define BME280_HUMIDITY_MSB_DATA (0)
580 #define BME280_HUMIDITY_LSB_DATA (1)
582 #define BME280_DATA_FRAME_PRESSURE_MSB_BYTE (0)
583 #define BME280_DATA_FRAME_PRESSURE_LSB_BYTE (1)
584 #define BME280_DATA_FRAME_PRESSURE_XLSB_BYTE (2)
585 #define BME280_DATA_FRAME_TEMPERATURE_MSB_BYTE (3)
586 #define BME280_DATA_FRAME_TEMPERATURE_LSB_BYTE (4)
587 #define BME280_DATA_FRAME_TEMPERATURE_XLSB_BYTE (5)
588 #define BME280_DATA_FRAME_HUMIDITY_MSB_BYTE (6)
589 #define BME280_DATA_FRAME_HUMIDITY_LSB_BYTE (7)
593 #define BME280_TEMPERATURE_CALIB_DIG_T1_LSB (0)
594 #define BME280_TEMPERATURE_CALIB_DIG_T1_MSB (1)
595 #define BME280_TEMPERATURE_CALIB_DIG_T2_LSB (2)
596 #define BME280_TEMPERATURE_CALIB_DIG_T2_MSB (3)
597 #define BME280_TEMPERATURE_CALIB_DIG_T3_LSB (4)
598 #define BME280_TEMPERATURE_CALIB_DIG_T3_MSB (5)
599 #define BME280_PRESSURE_CALIB_DIG_P1_LSB (6)
600 #define BME280_PRESSURE_CALIB_DIG_P1_MSB (7)
601 #define BME280_PRESSURE_CALIB_DIG_P2_LSB (8)
602 #define BME280_PRESSURE_CALIB_DIG_P2_MSB (9)
603 #define BME280_PRESSURE_CALIB_DIG_P3_LSB (10)
604 #define BME280_PRESSURE_CALIB_DIG_P3_MSB (11)
605 #define BME280_PRESSURE_CALIB_DIG_P4_LSB (12)
606 #define BME280_PRESSURE_CALIB_DIG_P4_MSB (13)
607 #define BME280_PRESSURE_CALIB_DIG_P5_LSB (14)
608 #define BME280_PRESSURE_CALIB_DIG_P5_MSB (15)
609 #define BME280_PRESSURE_CALIB_DIG_P6_LSB (16)
610 #define BME280_PRESSURE_CALIB_DIG_P6_MSB (17)
611 #define BME280_PRESSURE_CALIB_DIG_P7_LSB (18)
612 #define BME280_PRESSURE_CALIB_DIG_P7_MSB (19)
613 #define BME280_PRESSURE_CALIB_DIG_P8_LSB (20)
614 #define BME280_PRESSURE_CALIB_DIG_P8_MSB (21)
615 #define BME280_PRESSURE_CALIB_DIG_P9_LSB (22)
616 #define BME280_PRESSURE_CALIB_DIG_P9_MSB (23)
617 #define BME280_HUMIDITY_CALIB_DIG_H1 (25)
618 #define BME280_HUMIDITY_CALIB_DIG_H2_LSB (0)
619 #define BME280_HUMIDITY_CALIB_DIG_H2_MSB (1)
620 #define BME280_HUMIDITY_CALIB_DIG_H3 (2)
621 #define BME280_HUMIDITY_CALIB_DIG_H4_MSB (3)
622 #define BME280_HUMIDITY_CALIB_DIG_H4_LSB (4)
623 #define BME280_HUMIDITY_CALIB_DIG_H5_MSB (5)
624 #define BME280_HUMIDITY_CALIB_DIG_H6 (6)
625 #define BME280_MASK_DIG_H4 (0x0F)
630 #define BME280_TEMPERATURE_CALIB_DIG_T1_LSB_REG (0x88)
631 #define BME280_TEMPERATURE_CALIB_DIG_T1_MSB_REG (0x89)
632 #define BME280_TEMPERATURE_CALIB_DIG_T2_LSB_REG (0x8A)
633 #define BME280_TEMPERATURE_CALIB_DIG_T2_MSB_REG (0x8B)
634 #define BME280_TEMPERATURE_CALIB_DIG_T3_LSB_REG (0x8C)
635 #define BME280_TEMPERATURE_CALIB_DIG_T3_MSB_REG (0x8D)
636 #define BME280_PRESSURE_CALIB_DIG_P1_LSB_REG (0x8E)
637 #define BME280_PRESSURE_CALIB_DIG_P1_MSB_REG (0x8F)
638 #define BME280_PRESSURE_CALIB_DIG_P2_LSB_REG (0x90)
639 #define BME280_PRESSURE_CALIB_DIG_P2_MSB_REG (0x91)
640 #define BME280_PRESSURE_CALIB_DIG_P3_LSB_REG (0x92)
641 #define BME280_PRESSURE_CALIB_DIG_P3_MSB_REG (0x93)
642 #define BME280_PRESSURE_CALIB_DIG_P4_LSB_REG (0x94)
643 #define BME280_PRESSURE_CALIB_DIG_P4_MSB_REG (0x95)
644 #define BME280_PRESSURE_CALIB_DIG_P5_LSB_REG (0x96)
645 #define BME280_PRESSURE_CALIB_DIG_P5_MSB_REG (0x97)
646 #define BME280_PRESSURE_CALIB_DIG_P6_LSB_REG (0x98)
647 #define BME280_PRESSURE_CALIB_DIG_P6_MSB_REG (0x99)
648 #define BME280_PRESSURE_CALIB_DIG_P7_LSB_REG (0x9A)
649 #define BME280_PRESSURE_CALIB_DIG_P7_MSB_REG (0x9B)
650 #define BME280_PRESSURE_CALIB_DIG_P8_LSB_REG (0x9C)
651 #define BME280_PRESSURE_CALIB_DIG_P8_MSB_REG (0x9D)
652 #define BME280_PRESSURE_CALIB_DIG_P9_LSB_REG (0x9E)
653 #define BME280_PRESSURE_CALIB_DIG_P9_MSB_REG (0x9F)
655 #define BME280_HUMIDITY_CALIB_DIG_H1_REG (0xA1)
657 #define BME280_HUMIDITY_CALIB_DIG_H2_LSB_REG (0xE1)
658 #define BME280_HUMIDITY_CALIB_DIG_H2_MSB_REG (0xE2)
659 #define BME280_HUMIDITY_CALIB_DIG_H3_REG (0xE3)
660 #define BME280_HUMIDITY_CALIB_DIG_H4_MSB_REG (0xE4)
661 #define BME280_HUMIDITY_CALIB_DIG_H4_LSB_REG (0xE5)
662 #define BME280_HUMIDITY_CALIB_DIG_H5_MSB_REG (0xE6)
663 #define BME280_HUMIDITY_CALIB_DIG_H6_REG (0xE7)
667 #define BME280_CHIP_ID_REG (0xD0)
668 #define BME280_RST_REG (0xE0)
669 #define BME280_STAT_REG (0xF3)
670 #define BME280_CTRL_MEAS_REG (0xF4)
671 #define BME280_CTRL_HUMIDITY_REG (0xF2)
672 #define BME280_CONFIG_REG (0xF5)
673 #define BME280_PRESSURE_MSB_REG (0xF7)
674 #define BME280_PRESSURE_LSB_REG (0xF8)
675 #define BME280_PRESSURE_XLSB_REG (0xF9)
676 #define BME280_TEMPERATURE_MSB_REG (0xFA)
677 #define BME280_TEMPERATURE_LSB_REG (0xFB)
678 #define BME280_TEMPERATURE_XLSB_REG (0xFC)
679 #define BME280_HUMIDITY_MSB_REG (0xFD)
680 #define BME280_HUMIDITY_LSB_REG (0xFE)
685 #define BME280_STAT_REG_MEASURING__POS (3)
686 #define BME280_STAT_REG_MEASURING__MSK (0x08)
687 #define BME280_STAT_REG_MEASURING__LEN (1)
688 #define BME280_STAT_REG_MEASURING__REG (BME280_STAT_REG)
690 #define BME280_STAT_REG_IM_UPDATE__POS (0)
691 #define BME280_STAT_REG_IM_UPDATE__MSK (0x01)
692 #define BME280_STAT_REG_IM_UPDATE__LEN (1)
693 #define BME280_STAT_REG_IM_UPDATE__REG (BME280_STAT_REG)
699 #define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__POS (5)
700 #define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__MSK (0xE0)
701 #define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__LEN (3)
702 #define BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__REG \
703 (BME280_CTRL_MEAS_REG)
708 #define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__POS (2)
709 #define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__MSK (0x1C)
710 #define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__LEN (3)
711 #define BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__REG \
712 (BME280_CTRL_MEAS_REG)
717 #define BME280_CTRL_MEAS_REG_POWER_MODE__POS (0)
718 #define BME280_CTRL_MEAS_REG_POWER_MODE__MSK (0x03)
719 #define BME280_CTRL_MEAS_REG_POWER_MODE__LEN (2)
720 #define BME280_CTRL_MEAS_REG_POWER_MODE__REG \
721 (BME280_CTRL_MEAS_REG)
726 #define BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY__POS (0)
727 #define BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY__MSK (0x07)
728 #define BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY__LEN (3)
729 #define BME280_CTRL_HUMIDITY_REG_OVERSAMP_HUMIDITY__REG \
730 (BME280_CTRL_HUMIDITY_REG)
736 #define BME280_CONFIG_REG_TSB__POS (5)
737 #define BME280_CONFIG_REG_TSB__MSK (0xE0)
738 #define BME280_CONFIG_REG_TSB__LEN (3)
739 #define BME280_CONFIG_REG_TSB__REG (BME280_CONFIG_REG)
744 #define BME280_CONFIG_REG_FILTER__POS (2)
745 #define BME280_CONFIG_REG_FILTER__MSK (0x1C)
746 #define BME280_CONFIG_REG_FILTER__LEN (3)
747 #define BME280_CONFIG_REG_FILTER__REG (BME280_CONFIG_REG)
752 #define BME280_CONFIG_REG_SPI3_ENABLE__POS (0)
753 #define BME280_CONFIG_REG_SPI3_ENABLE__MSK (0x01)
754 #define BME280_CONFIG_REG_SPI3_ENABLE__LEN (1)
755 #define BME280_CONFIG_REG_SPI3_ENABLE__REG (BME280_CONFIG_REG)
761 #define BME280_PRESSURE_XLSB_REG_DATA__POS (4)
762 #define BME280_PRESSURE_XLSB_REG_DATA__MSK (0xF0)
763 #define BME280_PRESSURE_XLSB_REG_DATA__LEN (4)
764 #define BME280_PRESSURE_XLSB_REG_DATA__REG (BME280_PRESSURE_XLSB_REG)
766 #define BME280_TEMPERATURE_XLSB_REG_DATA__POS (4)
767 #define BME280_TEMPERATURE_XLSB_REG_DATA__MSK (0xF0)
768 #define BME280_TEMPERATURE_XLSB_REG_DATA__LEN (4)
769 #define BME280_TEMPERATURE_XLSB_REG_DATA__REG (BME280_TEMPERATURE_XLSB_REG)
773 #define BME280_WR_FUNC_PTR\
774 s8 (*bus_write)(u8, u8,\
777 #define BME280_RD_FUNC_PTR\
778 s8 (*bus_read)(u8, u8,\
781 #define BME280_MDELAY_DATA_TYPE u16
783 #define BME280_3MS_DELAY 3
887 s32 *v_uncomp_temperature_s32);
919 s32 v_uncomp_temperature_s32);
943 s32 *v_uncomp_pressure_s32);
985 s32 *v_uncomp_humidity_s32);
1019 s32 v_uncomp_humidity_s32);
1044 s32 *v_uncomp_pressure_s32,
1045 s32 *v_uncomp_temperature_s32,
s32 *v_uncomp_humidity_s32);
1068 u32 *v_pressure_u32,
s32 *v_temperature_s32,
u32 *v_humidity_u32);
1546 BME280_RETURN_FUNCTION_TYPE
1548 s32 *v_uncom_pressure_s32,
1549 s32 *v_uncom_temperature_s32,
s32 *v_uncom_humidity_s32);
1571 u8 *v_data_u8,
u8 v_len_u8);
1590 u8 *v_data_u8,
u8 v_len_u8);
1594 #ifdef BME280_ENABLE_FLOAT
1610 s32 v_uncom_temperature_s32);
1648 #if defined(BME280_ENABLE_INT64) && defined(BME280_64BITSUPPORT_PRESENT)
1684 s32 v_uncom_pressure_s32);
BME280_RETURN_FUNCTION_TYPE bme280_set_filter(u8 v_value_u8)
This API is used to write filter setting in the register 0xF5 bit 3 and 4.
Definition: bme280driver.cxx:1522
BME280_RETURN_FUNCTION_TYPE bme280_init(struct bme280_t *bme280)
This function is used for initialize the bus read and bus write functions and assign the chip id and ...
Definition: bme280driver.cxx:82
u8 ctrl_hum_reg
Definition: bme280driver.h:826
BME280_RETURN_FUNCTION_TYPE bme280_get_forced_uncomp_pressure_temperature_humidity(s32 *v_uncom_pressure_s32, s32 *v_uncom_temperature_s32, s32 *v_uncom_humidity_s32)
This API used to read uncompensated temperature,pressure and humidity in forced mode.
Definition: bme280driver.cxx:1820
BME280_RETURN_FUNCTION_TYPE bme280_get_oversamp_humidity(u8 *v_value_u8)
This API is used to get the humidity oversampling setting in the register 0xF2 bits from 0 to 2...
Definition: bme280driver.cxx:1039
BME280_RD_FUNC_PTR
Definition: bme280driver.h:831
BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_pressure(s32 *v_uncomp_pressure_s32)
This API is used to read uncompensated pressure. in the registers 0xF7, 0xF8 and 0xF9.
Definition: bme280driver.cxx:236
s16 dig_P9
Definition: bme280driver.h:802
double bme280_compensate_pressure_double(s32 v_uncom_pressure_s32)
Reads actual pressure from uncompensated pressure.
Definition: bme280driver.cxx:2015
s16 dig_P3
Definition: bme280driver.h:796
s16 dig_P7
Definition: bme280driver.h:800
s32 t_fine
Definition: bme280driver.h:811
s16 dig_P4
Definition: bme280driver.h:797
s16 dig_P8
Definition: bme280driver.h:801
BME280_RETURN_FUNCTION_TYPE bme280_get_spi3(u8 *v_enable_disable_u8)
This API used to get the sensor SPI mode(communication type) in the register 0xF5 bit 0...
Definition: bme280driver.cxx:1355
u8 oversamp_temperature
Definition: bme280driver.h:823
u8 chip_id
Definition: bme280driver.h:820
BME280_RETURN_FUNCTION_TYPE bme280_set_soft_rst(void)
Used to reset the sensor The value 0xB6 is written to the 0xE0 register the device is reset using the...
Definition: bme280driver.cxx:1319
u8 dev_addr
Definition: bme280driver.h:821
u16 bme280_compensate_humidity_int32_sixteen_bit_output(s32 v_uncomp_humidity_s32)
Reads actual humidity from uncompensated humidity.
Definition: bme280driver.cxx:456
BME280_RETURN_FUNCTION_TYPE bme280_set_power_mode(u8 v_power_mode_u8)
This API used to set the Operational Mode from the sensor in the register 0xF4 bit 0 and 1...
Definition: bme280driver.cxx:1229
s16 dig_T2
Definition: bme280driver.h:792
signed short int s16
Definition: bme280driver.h:195
BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_temperature(s32 *v_uncomp_temperature_s32)
This API is used to read uncompensated temperature in the registers 0xFA, 0xFB and 0xFC...
Definition: bme280driver.cxx:117
s16 dig_P2
Definition: bme280driver.h:795
u8 ctrl_meas_reg
Definition: bme280driver.h:827
s16 bme280_compensate_temperature_int32_sixteen_bit_output(s32 v_uncomp_temperature_s32)
Reads actual temperature from uncompensated temperature.
Definition: bme280driver.cxx:204
BME280_RETURN_FUNCTION_TYPE bme280_set_oversamp_pressure(u8 v_value_u8)
This API is used to set the pressure oversampling setting in the register 0xF4 bits from 2 to 4...
Definition: bme280driver.cxx:947
BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_humidity(s32 *v_uncomp_humidity_s32)
This API is used to read uncompensated humidity. in the registers 0xF7, 0xF8 and 0xF9.
Definition: bme280driver.cxx:371
BME280_RETURN_FUNCTION_TYPE bme280_set_oversamp_humidity(u8 v_value_u8)
This API is used to set the humidity oversampling setting in the register 0xF2 bits from 0 to 2...
Definition: bme280driver.cxx:1100
u32 bme280_compensate_pressure_int64_twentyfour_bit_output(s32 v_uncom_pressure_s32)
Reads actual pressure from uncompensated pressure.
Definition: bme280driver.cxx:2168
BME280_RETURN_FUNCTION_TYPE bme280_set_standby_durn(u8 v_standby_durn_u8)
This API used to write the standby duration time from the sensor in the register 0xF5 bit 5 to 7...
Definition: bme280driver.cxx:1660
BME280_RETURN_FUNCTION_TYPE bme280_write_register(u8 v_addr_u8, u8 *v_data_u8, u8 v_len_u8)
This API write the data to the given register.
Definition: bme280driver.cxx:1920
s16 dig_P6
Definition: bme280driver.h:799
signed long long int s64
Definition: bme280driver.h:197
unsigned char u8
Definition: bme280driver.h:200
void(* delay_msec)(BME280_MDELAY_DATA_TYPE)
Definition: bme280driver.h:832
u16 dig_P1
Definition: bme280driver.h:794
double bme280_compensate_humidity_double(s32 v_uncom_humidity_s32)
Reads actual humidity from uncompensated humidity.
Definition: bme280driver.cxx:2060
BME280_RETURN_FUNCTION_TYPE bme280_read_uncomp_pressure_temperature_humidity(s32 *v_uncomp_pressure_s32, s32 *v_uncomp_temperature_s32, s32 *v_uncomp_humidity_s32)
This API used to read uncompensated pressure,temperature and humidity.
Definition: bme280driver.cxx:485
BME280_RETURN_FUNCTION_TYPE bme280_read_register(u8 v_addr_u8, u8 *v_data_u8, u8 v_len_u8)
This API reads the data from the given register.
Definition: bme280driver.cxx:1952
This structure holds all device specific calibration parameters.
Definition: bme280driver.h:790
unsigned long long int u64
Definition: bme280driver.h:203
u8 oversamp_pressure
Definition: bme280driver.h:824
BME280_RETURN_FUNCTION_TYPE bme280_set_oversamp_temperature(u8 v_value_u8)
This API is used to set the temperature oversampling setting in the register 0xF4 bits from 5 to 7...
Definition: bme280driver.cxx:808
u8 config_reg
Definition: bme280driver.h:828
BME280_RETURN_FUNCTION_TYPE bme280_get_filter(u8 *v_value_u8)
This API is used to reads filter setting in the register 0xF5 bit 3 and 4.
Definition: bme280driver.cxx:1482
u16 dig_T1
Definition: bme280driver.h:791
u32 bme280_compensate_pressure_int64(s32 v_uncom_pressure_s32)
Reads actual pressure from uncompensated pressure.
Definition: bme280driver.cxx:2102
BME280_RETURN_FUNCTION_TYPE bme280_read_pressure_temperature_humidity(u32 *v_pressure_u32, s32 *v_temperature_s32, u32 *v_humidity_u32)
This API used to read true pressure, temperature and humidity.
Definition: bme280driver.cxx:565
This structure holds BME280 initialization parameters.
Definition: bme280driver.h:816
s16 dig_H5
Definition: bme280driver.h:808
signed int s32
Definition: bme280driver.h:196
BME280_RETURN_FUNCTION_TYPE bme280_get_oversamp_pressure(u8 *v_value_u8)
This API is used to get the pressure oversampling setting in the register 0xF4 bits from 2 to 4...
Definition: bme280driver.cxx:900
unsigned int u32
Definition: bme280driver.h:202
BME280_RETURN_FUNCTION_TYPE bme280_get_standby_durn(u8 *v_standby_durn_u8)
This API used to Read the standby duration time from the sensor in the register 0xF5 bit 5 to 7...
Definition: bme280driver.cxx:1609
u32 bme280_compensate_humidity_int32(s32 v_uncomp_humidity_s32)
Reads actual humidity from uncompensated humidity.
Definition: bme280driver.cxx:411
s16 dig_T3
Definition: bme280driver.h:793
BME280_RETURN_FUNCTION_TYPE bme280_get_calib_param(void)
This API is used to calibration parameters used for calculation in the registers. ...
Definition: bme280driver.cxx:622
signed char s8
If your machine support 16 bit define the MACHINE_16_BIT.
Definition: bme280driver.h:194
s16 dig_P5
Definition: bme280driver.h:798
s32 bme280_compensate_temperature_int32(s32 v_uncomp_temperature_s32)
Reads actual temperature from uncompensated temperature.
Definition: bme280driver.cxx:161
u8 oversamp_humidity
Definition: bme280driver.h:825
BME280_RETURN_FUNCTION_TYPE bme280_compute_wait_time(u8 *v_delaytime_u8r)
Computing waiting time for sensor data read.
Definition: bme280driver.cxx:2192
BME280_RETURN_FUNCTION_TYPE bme280_set_spi3(u8 v_enable_disable_u8)
This API used to set the sensor SPI mode(communication type) in the register 0xF5 bit 0...
Definition: bme280driver.cxx:1394
s16 dig_H4
Definition: bme280driver.h:807
s16 dig_H2
Definition: bme280driver.h:805
s8 dig_H6
Definition: bme280driver.h:809
double bme280_compensate_temperature_double(s32 v_uncom_temperature_s32)
Reads actual temperature from uncompensated temperature.
Definition: bme280driver.cxx:1982
struct bme280_calibration_param_t cal_param
Definition: bme280driver.h:817
u32 bme280_compensate_pressure_int32(s32 v_uncomp_pressure_s32)
Reads actual pressure from uncompensated pressure.
Definition: bme280driver.cxx:281
unsigned short int u16
Definition: bme280driver.h:201
u8 dig_H3
Definition: bme280driver.h:806
BME280_RETURN_FUNCTION_TYPE bme280_get_power_mode(u8 *v_power_mode_u8)
This API used to get the Operational Mode from the sensor in the register 0xF4 bit 0 and 1...
Definition: bme280driver.cxx:1192
BME280_WR_FUNC_PTR
Definition: bme280driver.h:830
BME280_RETURN_FUNCTION_TYPE bme280_get_oversamp_temperature(u8 *v_value_u8)
This API is used to get the temperature oversampling setting in the register 0xF4 bits from 5 to 7...
Definition: bme280driver.cxx:762
u8 dig_H1
Definition: bme280driver.h:804