LibDriver BMP280
Loading...
Searching...
No Matches
bmp280 base driver function

bmp280 base driver modules More...

Collaboration diagram for bmp280 base driver function:

Data Structures

struct  bmp280_handle_s
 bmp280 handle structure definition More...
struct  bmp280_info_s
 bmp280 information structure definition More...

Typedefs

typedef struct bmp280_handle_s bmp280_handle_t
 bmp280 handle structure definition
typedef struct bmp280_info_s bmp280_info_t
 bmp280 information structure definition

Enumerations

enum  bmp280_interface_t { BMP280_INTERFACE_IIC = 0x00 , BMP280_INTERFACE_SPI = 0x01 }
 bmp280 interface enumeration definition More...
enum  bmp280_address_t { BMP280_ADDRESS_ADO_LOW = (0x76 << 1) , BMP280_ADDRESS_ADO_HIGH = (0x77 << 1) }
 bmp280 address enumeration definition More...
enum  bmp280_status_t { BMP280_STATUS_MEASURING = (1 << 3) , BMP280_STATUS_IM_UPDATE = (1 << 0) }
 bmp280 status enumeration definition More...
enum  bmp280_oversampling_t {
  BMP280_OVERSAMPLING_SKIP = 0x00 , BMP280_OVERSAMPLING_x1 = 0x01 , BMP280_OVERSAMPLING_x2 = 0x02 , BMP280_OVERSAMPLING_x4 = 0x03 ,
  BMP280_OVERSAMPLING_x8 = 0x04 , BMP280_OVERSAMPLING_x16 = 0x05
}
 bmp280 oversampling enumeration definition More...
enum  bmp280_mode_t { BMP280_MODE_SLEEP = 0x00 , BMP280_MODE_FORCED = 0x01 , BMP280_MODE_NORMAL = 0x03 }
 bmp280 mode enumeration definition More...
enum  bmp280_standby_time_t {
  BMP280_STANDBY_TIME_0P5_MS = 0x00 , BMP280_STANDBY_TIME_62P5_MS = 0x01 , BMP280_STANDBY_TIME_125_MS = 0x02 , BMP280_STANDBY_TIME_250_MS = 0x03 ,
  BMP280_STANDBY_TIME_500_MS = 0x04 , BMP280_STANDBY_TIME_1000_MS = 0x05 , BMP280_STANDBY_TIME_2000_MS = 0x06 , BMP280_STANDBY_TIME_4000_MS = 0x07
}
 bmp280 standby time enumeration definition More...
enum  bmp280_filter_t {
  BMP280_FILTER_OFF = 0x00 , BMP280_FILTER_COEFF_2 = 0x01 , BMP280_FILTER_COEFF_4 = 0x02 , BMP280_FILTER_COEFF_8 = 0x03 ,
  BMP280_FILTER_COEFF_16 = 0x04
}
 bmp280 filter enumeration definition More...
enum  bmp280_spi_wire_t { BMP280_SPI_WIRE_4 = 0x00 , BMP280_SPI_WIRE_3 = 0x01 }
 bmp280 spi wire enumeration definition More...

Functions

uint8_t bmp280_info (bmp280_info_t *info)
 get chip's information
uint8_t bmp280_set_interface (bmp280_handle_t *handle, bmp280_interface_t interface)
 set the interface
uint8_t bmp280_get_interface (bmp280_handle_t *handle, bmp280_interface_t *interface)
 get the interface
uint8_t bmp280_set_addr_pin (bmp280_handle_t *handle, bmp280_address_t addr_pin)
 set the iic address pin
uint8_t bmp280_get_addr_pin (bmp280_handle_t *handle, bmp280_address_t *addr_pin)
 get the iic address pin
uint8_t bmp280_init (bmp280_handle_t *handle)
 initialize the chip
uint8_t bmp280_deinit (bmp280_handle_t *handle)
 close the chip
uint8_t bmp280_read_temperature_pressure (bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c, uint32_t *pressure_raw, float *pressure_pa)
 read the temperature and pressure data
uint8_t bmp280_read_pressure (bmp280_handle_t *handle, uint32_t *pressure_raw, float *pressure_pa)
 read the pressure data
uint8_t bmp280_read_temperature (bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c)
 read the temperature data
uint8_t bmp280_soft_reset (bmp280_handle_t *handle)
 soft reset
uint8_t bmp280_get_status (bmp280_handle_t *handle, uint8_t *status)
 get status
uint8_t bmp280_set_temperatue_oversampling (bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
 set temperatue oversampling
uint8_t bmp280_get_temperatue_oversampling (bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
 get temperatue oversampling
uint8_t bmp280_set_pressure_oversampling (bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
 set pressure oversampling
uint8_t bmp280_get_pressure_oversampling (bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
 get pressure oversampling
uint8_t bmp280_set_mode (bmp280_handle_t *handle, bmp280_mode_t mode)
 set mode
uint8_t bmp280_get_mode (bmp280_handle_t *handle, bmp280_mode_t *mode)
 get mode
uint8_t bmp280_set_standby_time (bmp280_handle_t *handle, bmp280_standby_time_t standby_time)
 set standby time
uint8_t bmp280_get_standby_time (bmp280_handle_t *handle, bmp280_standby_time_t *standby_time)
 get standby time
uint8_t bmp280_set_filter (bmp280_handle_t *handle, bmp280_filter_t filter)
 set filter
uint8_t bmp280_get_filter (bmp280_handle_t *handle, bmp280_filter_t *filter)
 get filter
uint8_t bmp280_set_spi_wire (bmp280_handle_t *handle, bmp280_spi_wire_t spi)
 set spi wire
uint8_t bmp280_get_spi_wire (bmp280_handle_t *handle, bmp280_spi_wire_t *spi)
 get spi wire

Detailed Description

bmp280 base driver modules

Typedef Documentation

◆ bmp280_handle_t

bmp280 handle structure definition

◆ bmp280_info_t

typedef struct bmp280_info_s bmp280_info_t

bmp280 information structure definition

Enumeration Type Documentation

◆ bmp280_address_t

bmp280 address enumeration definition

Enumerator
BMP280_ADDRESS_ADO_LOW 

ADO is low

BMP280_ADDRESS_ADO_HIGH 

ADO is HIGH

Definition at line 71 of file driver_bmp280.h.

◆ bmp280_filter_t

bmp280 filter enumeration definition

Enumerator
BMP280_FILTER_OFF 

off

BMP280_FILTER_COEFF_2 

coeff 2

BMP280_FILTER_COEFF_4 

coeff 4

BMP280_FILTER_COEFF_8 

coeff 8

BMP280_FILTER_COEFF_16 

coeff 16

Definition at line 127 of file driver_bmp280.h.

◆ bmp280_interface_t

bmp280 interface enumeration definition

Enumerator
BMP280_INTERFACE_IIC 

iic interface

BMP280_INTERFACE_SPI 

spi interface

Definition at line 62 of file driver_bmp280.h.

◆ bmp280_mode_t

bmp280 mode enumeration definition

Enumerator
BMP280_MODE_SLEEP 

sleep mode

BMP280_MODE_FORCED 

forced mode

BMP280_MODE_NORMAL 

normal mode

Definition at line 102 of file driver_bmp280.h.

◆ bmp280_oversampling_t

bmp280 oversampling enumeration definition

Enumerator
BMP280_OVERSAMPLING_SKIP 

oversampling x1

BMP280_OVERSAMPLING_x1 

oversampling x1

BMP280_OVERSAMPLING_x2 

oversampling x2

BMP280_OVERSAMPLING_x4 

oversampling x4

BMP280_OVERSAMPLING_x8 

oversampling x8

BMP280_OVERSAMPLING_x16 

oversampling x16

Definition at line 89 of file driver_bmp280.h.

◆ bmp280_spi_wire_t

bmp280 spi wire enumeration definition

Enumerator
BMP280_SPI_WIRE_4 

4 wire

BMP280_SPI_WIRE_3 

3 wire

Definition at line 139 of file driver_bmp280.h.

◆ bmp280_standby_time_t

bmp280 standby time enumeration definition

Enumerator
BMP280_STANDBY_TIME_0P5_MS 

0.5ms

BMP280_STANDBY_TIME_62P5_MS 

62.5ms

BMP280_STANDBY_TIME_125_MS 

125ms

BMP280_STANDBY_TIME_250_MS 

250ms

BMP280_STANDBY_TIME_500_MS 

500ms

BMP280_STANDBY_TIME_1000_MS 

1000ms

BMP280_STANDBY_TIME_2000_MS 

2000ms

BMP280_STANDBY_TIME_4000_MS 

4000ms

Definition at line 112 of file driver_bmp280.h.

◆ bmp280_status_t

bmp280 status enumeration definition

Enumerator
BMP280_STATUS_MEASURING 

measuring

BMP280_STATUS_IM_UPDATE 

im update

Definition at line 80 of file driver_bmp280.h.

Function Documentation

◆ bmp280_deinit()

uint8_t bmp280_deinit ( bmp280_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to a bmp280 handle structure
Returns
status code
  • 0 success
  • 1 iic deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 power down failed
Note
none

Definition at line 584 of file driver_bmp280.c.

◆ bmp280_get_addr_pin()

uint8_t bmp280_get_addr_pin ( bmp280_handle_t * handle,
bmp280_address_t * addr_pin )

get the iic address pin

Parameters
[in]*handlepointer to a bmp280 handle structure
[out]*addr_pinpointer to an iic address pin buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 385 of file driver_bmp280.c.

◆ bmp280_get_filter()

uint8_t bmp280_get_filter ( bmp280_handle_t * handle,
bmp280_filter_t * filter )

get filter

Parameters
[in]*handlepointer to a bmp280 handle structure
[out]*filterpointer to a filter buffer
Returns
status code
  • 0 success
  • 1 get filter failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1062 of file driver_bmp280.c.

◆ bmp280_get_interface()

uint8_t bmp280_get_interface ( bmp280_handle_t * handle,
bmp280_interface_t * interface )

get the interface

Parameters
[in]*handlepointer to a bmp280 handle structure
[out]*interfacepointer to a chip interface buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 427 of file driver_bmp280.c.

◆ bmp280_get_mode()

uint8_t bmp280_get_mode ( bmp280_handle_t * handle,
bmp280_mode_t * mode )

get mode

Parameters
[in]*handlepointer to a bmp280 handle structure
[out]*modepointer to a mode buffer
Returns
status code
  • 0 success
  • 1 get mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 908 of file driver_bmp280.c.

◆ bmp280_get_pressure_oversampling()

uint8_t bmp280_get_pressure_oversampling ( bmp280_handle_t * handle,
bmp280_oversampling_t * oversampling )

get pressure oversampling

Parameters
[in]*handlepointer to a bmp280 handle structure
[out]*oversamplingpointer to a oversampling buffer
Returns
status code
  • 0 success
  • 1 get pressure oversampling failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 831 of file driver_bmp280.c.

◆ bmp280_get_spi_wire()

uint8_t bmp280_get_spi_wire ( bmp280_handle_t * handle,
bmp280_spi_wire_t * spi )

get spi wire

Parameters
[in]*handlepointer to a bmp280 handle structure
[out]*spipointer to a spi wire buffer
Returns
status code
  • 0 success
  • 1 get spi wire failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1139 of file driver_bmp280.c.

◆ bmp280_get_standby_time()

uint8_t bmp280_get_standby_time ( bmp280_handle_t * handle,
bmp280_standby_time_t * standby_time )

get standby time

Parameters
[in]*handlepointer to a bmp280 handle structure
[out]*standby_timepointer to a standby time buffer
Returns
status code
  • 0 success
  • 1 get standby time failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 985 of file driver_bmp280.c.

◆ bmp280_get_status()

uint8_t bmp280_get_status ( bmp280_handle_t * handle,
uint8_t * status )

get status

Parameters
[in]*handlepointer to a bmp280 handle structure
[out]*statuspointer to a status buffer
Returns
status code
  • 0 success
  • 1 get status failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 680 of file driver_bmp280.c.

◆ bmp280_get_temperatue_oversampling()

uint8_t bmp280_get_temperatue_oversampling ( bmp280_handle_t * handle,
bmp280_oversampling_t * oversampling )

get temperatue oversampling

Parameters
[in]*handlepointer to a bmp280 handle structure
[out]*oversamplingpointer to a oversampling buffer
Returns
status code
  • 0 success
  • 1 get temperatue oversampling failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 754 of file driver_bmp280.c.

◆ bmp280_info()

uint8_t bmp280_info ( bmp280_info_t * info)

get chip's information

Parameters
[out]*infopointer to a bmp280 info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 1616 of file driver_bmp280.c.

◆ bmp280_init()

uint8_t bmp280_init ( bmp280_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to a bmp280 handle structure
Returns
status code
  • 0 success
  • 1 iic or spi initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
  • 4 id is error
  • 5 get nvm calibration failed
  • 6 read calibration failed
Note
none

Definition at line 452 of file driver_bmp280.c.

◆ bmp280_read_pressure()

uint8_t bmp280_read_pressure ( bmp280_handle_t * handle,
uint32_t * pressure_raw,
float * pressure_pa )

read the pressure data

Parameters
[in]*handlepointer to a bmp280 handle structure
[out]*pressure_rawpointer to a raw pressure buffer
[out]*pressure_papointer to a converted pressure buffer
Returns
status code
  • 0 success
  • 1 pressure read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 compensate pressure failed
  • 5 read timeout
Note
none

Definition at line 1177 of file driver_bmp280.c.

◆ bmp280_read_temperature()

uint8_t bmp280_read_temperature ( bmp280_handle_t * handle,
uint32_t * temperature_raw,
float * temperature_c )

read the temperature data

Parameters
[in]*handlepointer to a bmp280 handle structure
[out]*temperature_rawpointer to a raw temperature buffer
[out]*temperature_cpointer to a converted temperature buffer
Returns
status code
  • 0 success
  • 1 temperature read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 compensate pressure failed
  • 5 read timeout
Note
none

Definition at line 1315 of file driver_bmp280.c.

◆ bmp280_read_temperature_pressure()

uint8_t bmp280_read_temperature_pressure ( bmp280_handle_t * handle,
uint32_t * temperature_raw,
float * temperature_c,
uint32_t * pressure_raw,
float * pressure_pa )

read the temperature and pressure data

Parameters
[in]*handlepointer to a bmp280 handle structure
[out]*temperature_rawpointer to a raw temperature buffer
[out]*temperature_cpointer to a converted temperature buffer
[out]*pressure_rawpointer to a raw pressure buffer
[out]*pressure_papointer to a converted pressure buffer
Returns
status code
  • 0 success
  • 1 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 compensate pressure failed
  • 5 read timeout
Note
none

Definition at line 1433 of file driver_bmp280.c.

◆ bmp280_set_addr_pin()

uint8_t bmp280_set_addr_pin ( bmp280_handle_t * handle,
bmp280_address_t addr_pin )

set the iic address pin

Parameters
[in]*handlepointer to a bmp280 handle structure
[in]addr_piniic address pin
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 364 of file driver_bmp280.c.

◆ bmp280_set_filter()

uint8_t bmp280_set_filter ( bmp280_handle_t * handle,
bmp280_filter_t filter )

set filter

Parameters
[in]*handlepointer to a bmp280 handle structure
[in]filterinput filter
Returns
status code
  • 0 success
  • 1 set filter failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1020 of file driver_bmp280.c.

◆ bmp280_set_interface()

uint8_t bmp280_set_interface ( bmp280_handle_t * handle,
bmp280_interface_t interface )

set the interface

Parameters
[in]*handlepointer to a bmp280 handle structure
[in]interfacechip interface
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 406 of file driver_bmp280.c.

◆ bmp280_set_mode()

uint8_t bmp280_set_mode ( bmp280_handle_t * handle,
bmp280_mode_t mode )

set mode

Parameters
[in]*handlepointer to a bmp280 handle structure
[in]modechip mode
Returns
status code
  • 0 success
  • 1 set mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 866 of file driver_bmp280.c.

◆ bmp280_set_pressure_oversampling()

uint8_t bmp280_set_pressure_oversampling ( bmp280_handle_t * handle,
bmp280_oversampling_t oversampling )

set pressure oversampling

Parameters
[in]*handlepointer to a bmp280 handle structure
[in]oversamplingpressure oversampling
Returns
status code
  • 0 success
  • 1 set pressure oversampling failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 789 of file driver_bmp280.c.

◆ bmp280_set_spi_wire()

uint8_t bmp280_set_spi_wire ( bmp280_handle_t * handle,
bmp280_spi_wire_t spi )

set spi wire

Parameters
[in]*handlepointer to a bmp280 handle structure
[in]spispi wire
Returns
status code
  • 0 success
  • 1 set spi wire failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1097 of file driver_bmp280.c.

◆ bmp280_set_standby_time()

uint8_t bmp280_set_standby_time ( bmp280_handle_t * handle,
bmp280_standby_time_t standby_time )

set standby time

Parameters
[in]*handlepointer to a bmp280 handle structure
[in]standby_timestandby time
Returns
status code
  • 0 success
  • 1 set standby time failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 943 of file driver_bmp280.c.

◆ bmp280_set_temperatue_oversampling()

uint8_t bmp280_set_temperatue_oversampling ( bmp280_handle_t * handle,
bmp280_oversampling_t oversampling )

set temperatue oversampling

Parameters
[in]*handlepointer to a bmp280 handle structure
[in]oversamplingtemperatue oversampling
Returns
status code
  • 0 success
  • 1 set temperatue oversampling failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 712 of file driver_bmp280.c.

◆ bmp280_soft_reset()

uint8_t bmp280_soft_reset ( bmp280_handle_t * handle)

soft reset

Parameters
[in]*handlepointer to a bmp280 handle structure
Returns
status code
  • 0 success
  • 1 soft reset failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 644 of file driver_bmp280.c.