Skip to main content

Module bmp280

Module bmp280 

Source
Expand description

Bosch BMP280 digital pressure sensor.

The BMP280 is the BME280’s sibling without the humidity element: a barometric pressure and temperature sensor that ships 20-bit raw ADC codes plus a block of per-chip trimming coefficients, and leaves the compensation to the host. The integer arithmetic here is a line for line port of the bmp280_compensate_T_int32 and bmp280_compensate_P_int64 reference code in section 3.11.3 of the data sheet (BST-BMP280-DS001), and the tests cross-check it against the data sheet’s floating-point form in appendix 8.1.

A caller reads the 24 calibration bytes once with Calibration::parse, then burst-reads the six data registers each cycle into a Measurement and calls Calibration::compensate for a Reading. CtrlMeas and Config build and decode the two control registers, and every decode has a matching builder so a node can be exercised with nothing wired. The measurement-time functions are here too, and the Bmp280 driver (the embedded-hal feature) runs the whole sequence, reset to reading, over an I2C or SPI bus.

Modules§

register
The BMP280 register addresses.
sim
A BMP280 that is not there.

Structs§

Bmp280
A BMP280 on an I2C or SPI bus, measuring on demand in forced mode.
Calibration
The per-chip trimming coefficients read from 0x88..=0x9F.
Config
The configuration register (0xF5, config).
CtrlMeas
The measurement control register (0xF4, ctrl_meas).
Measurement
The raw, uncompensated 20-bit codes from the BMP280 data registers.
Reading
A compensated BMP280 reading.

Enums§

Mode
The power mode selected by the mode[1:0] field.
Oversampling
An oversampling setting for the pressure or temperature measurement.
Standby
The inactive period between measurements in normal mode, the t_sb[2:0] field.

Constants§

CALIBRATION_LEN
The number of calibration bytes at register::CALIBRATION.
CHIP_ID
The value the chip-id register (0xD0) returns for a BMP280.
DATA_LEN
The number of data bytes at register::DATA.
I2C_ADDRESS_PRIMARY
The I2C address with the SDO pin tied to ground.
I2C_ADDRESS_SECONDARY
The I2C address with the SDO pin tied to VDDIO.
RESET_WORD
The word written to the reset register (0xE0) to run a full power-on reset.
SKIPPED_OUTPUT
The raw code a data register holds when its measurement is skipped.
STARTUP_MICROS
The start-up time from power-on or reset until the part accepts a transfer, in microseconds: Table 2’s t_startup, 2 ms at most, which the soft reset of section 4.3.2 incurs again since it runs the complete power-on-reset procedure.
STATUS_POLLS
How many times the status register is polled, 1 ms apart, before a conversion or a reset is called overdue.

Functions§

image_updating
Returns whether the status register reports the NVM image being copied.
max_measurement_micros
The longest one measurement cycle can take, in microseconds.
measuring
Returns whether the status register reports a conversion in progress.
typical_measurement_micros
The typical time one measurement cycle takes, in microseconds.