EFM32 Wonder Gecko Software Documentation  efm32wg-doc-5.1.2
bmp.h
1 /***************************************************************************/
16 #ifndef __BMP_H_
17 #define __BMP_H_
18 
19 /**************************************************************************/
24 #include "bmp_config.h"
25 #include "thunderboard/bmp_regs.h"
26 
27 /***************************************************************************/
33 #ifndef BMP_CONFIG_I2C_DEVICE
34  #define BMP_CONFIG_I2C_DEVICE (I2C0)
35 #endif
36 
37 #ifndef BMP_CONFIG_I2C_BUS_ADDRESS
38  #define BMP_CONFIG_I2C_BUS_ADDRESS (0xEE)
39 #endif
40 
41 #define BMP_I2C_DEVICE (BMP_CONFIG_I2C_DEVICE)
42 #define BMP_I2C_BUS_ADDRESS (BMP_CONFIG_I2C_BUS_ADDRESS)
44 #define BMP_DEVICE_ID_BMP280 0x58
48 /***************************************************************************/
54 #define BMP_OK 0x0000
55 #define BMP_ERROR_DRIVER_NOT_INITIALIZED 0x0001
56 #define BMP_ERROR_I2C_TRANSACTION_FAILED 0x0002
57 #define BMP_ERROR_DEVICE_ID_MISMATCH 0x0003
61 /***************************************************************************/
67 /***************************************************************************/
71 typedef struct __BMP_Config {
72 
73  uint8_t oversampling;
74  uint8_t powerMode;
75  uint8_t standbyTime;
77 } BMP_Config;
78 
81 /***************************************************************************/
86 uint32_t BMP_init ( uint8_t *deviceId );
87 void BMP_deInit ( void );
88 uint32_t BMP_config ( BMP_Config *cfg );
89 uint32_t BMP_getTemperature ( float *temperature );
90 uint32_t BMP_getPressure ( float *pressure );
91 
96 #endif /* __BMP_H_ */
uint8_t powerMode
Definition: bmp.h:74
uint8_t oversampling
Definition: bmp.h:73
void BMP_deInit(void)
De-initializes the barometric pressure module.
Definition: bmp.c:124
uint32_t BMP_getPressure(float *pressure)
Initiates pressure measurement on the barometric pressure sensor and reads pressure from it...
Definition: bmp.c:205
uint32_t BMP_getTemperature(float *temperature)
Initiates temperature measurement on the barometric pressure sensor and reads pressure from it...
Definition: bmp.c:167
Structure to configure the BMP280 device.
Definition: bmp.h:71
Register definitions for the BMP280 pressure sensor.
uint8_t standbyTime
Definition: bmp.h:75
EMSTATUS BMP_init(uint8_t *palette, uint32_t paletteSize, EMSTATUS(*fp)(uint8_t buffer[], uint32_t bufLength, uint32_t bytesToRead))
Initializes BMP Module.
Definition: bmp.c:99
struct __BMP_Config BMP_Config
Structure to configure the BMP280 device.
uint32_t BMP_config(BMP_Config *cfg)
Configure the barometric pressure sensor.
Definition: bmp.c:140