90 lines
2.1 KiB
C
90 lines
2.1 KiB
C
#ifndef BMP280_H
|
|
#define BMP280_H
|
|
|
|
/* Device i2c address */
|
|
#define BMP280_I2C_ADDR 0x76
|
|
|
|
/* Device ID */
|
|
#define BMP280_ID 0x58
|
|
|
|
/* Device registers list */
|
|
#define BMP280_TEMP_XLSB 0xFC
|
|
#define BMP280_TEMP_LSB 0xFB
|
|
#define BMP280_TEMP_MSB 0xFA
|
|
#define BMP280_PRESS_XLSB 0xF9
|
|
#define BMP280_PRESS_LSB 0xF8
|
|
#define BMP280_PRESS_MSB 0xF7
|
|
#define BMP280_CONFIG 0xF5
|
|
#define BMP280_CTRL_MEAS 0xF4
|
|
#define BMP280_STATUS 0xF3
|
|
#define BMP280_RESET 0xE0
|
|
#define BMP280_ID_REG 0xD0
|
|
|
|
/* Device calibration registers list */
|
|
#define BMP280_DIG_T1 0x88
|
|
#define BMP280_DIG_T2 0x8A
|
|
#define BMP280_DIG_T3 0x8C
|
|
#define BMP280_DIG_P1 0x8E
|
|
#define BMP280_DIG_P2 0x90
|
|
#define BMP280_DIG_P3 0x92
|
|
#define BMP280_DIG_P4 0x94
|
|
#define BMP280_DIG_P5 0x96
|
|
#define BMP280_DIG_P6 0x98
|
|
#define BMP280_DIG_P7 0x9A
|
|
#define BMP280_DIG_P8 0x9C
|
|
#define BMP280_DIG_P9 0x9E
|
|
|
|
/* Field masks */
|
|
|
|
/* Configuration enumerations */
|
|
typedef enum
|
|
{
|
|
BMP280_Sleep = 0,
|
|
BMP280_Forced = 1,
|
|
BMP280_Normal = 3,
|
|
} BMP280_Mode_e;
|
|
|
|
typedef enum
|
|
{
|
|
BMP280_Oversampling_Skipped = 0,
|
|
BMP280_Oversampling_x1 = 1,
|
|
BMP280_Oversampling_x2 = 2,
|
|
BMP280_Oversampling_x4 = 3,
|
|
BMP280_Oversampling_x8 = 4,
|
|
BMP280_Oversampling_x16 = 5,
|
|
} BMP280_Oversampling_e;
|
|
|
|
typedef enum
|
|
{
|
|
BMP280_Filter_OFF = 0,
|
|
BMP280_Filter_x2 = 1,
|
|
BMP280_Filter_x4 = 2,
|
|
BMP280_Filter_x8 = 3,
|
|
BMP280_Filter_x16 = 4,
|
|
} BMP280_Filter_e;
|
|
|
|
typedef enum
|
|
{
|
|
BMP280_Standby_0_5MS = 0,
|
|
BMP280_Standby_62_5MS = 1,
|
|
BMP280_Standby_125MS = 2,
|
|
BMP280_Standby_250MS = 3,
|
|
BMP280_Standby_500MS = 4,
|
|
BMP280_Standby_1000MS = 5,
|
|
BMP280_Standby_2000MS = 6,
|
|
BMP280_Standby_4000MS = 7,
|
|
} BMP280_Standby_Duration_e;
|
|
|
|
|
|
|
|
bool BMP280_init(void);
|
|
|
|
bool BMP280_configure(BMP280_Mode_e mode, BMP280_Oversampling_e temperature_oversampling, BMP280_Oversampling_e pressure_oversampling, BMP280_Filter_e filter, BMP280_Standby_Duration_e standby_duration);
|
|
|
|
bool BMP280_trigger_measurement(void);
|
|
|
|
float BMP280_get_temperature(void);
|
|
|
|
bool BMP280_software_reset(void);
|
|
|
|
#endif //BMP280_H
|