BMP581 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Classes | Enumerations | Functions | Variables
Driver types

Errors, results, configuration and measurements. More...

Classes

struct  bmp581::Result< T >
 The value of a call, or why there is none. More...
 
struct  bmp581::Result< void >
 The result of a call that returns no value. More...
 
struct  bmp581::InterruptStatus
 The interrupt status flags, INT_STATUS (section 7.21), decoded. Reading INT_STATUS clears them on the chip (the FIFO flags stay while their condition holds, section 4.7.3.2). More...
 
struct  bmp581::Measurement
 One measurement in the chip's own units, as the data registers hold it (section 4.5). More...
 
struct  bmp581::FifoSample
 One FIFO frame, with its own validity: a multi-item read reports each item. More...
 
struct  bmp581::Config
 Everything EnsureInitialized() and ApplyConfig() write to the chip. More...
 
class  bmp581::CheckedConfig
 A configuration proven valid at build time. More...
 

Enumerations

enum class  bmp581::Error : uint8_t {
  bmp581::Error::Ok = 0 , bmp581::Error::NotInitialized = 1 , bmp581::Error::InvalidArgument = 2 , bmp581::Error::Bus = 3 ,
  bmp581::Error::Timeout = 4 , bmp581::Error::DeviceIdMismatch = 5 , bmp581::Error::Crc = 6 , bmp581::Error::Busy = 7 ,
  bmp581::Error::DeviceFault = 8 , bmp581::Error::Unsupported = 9 , bmp581::Error::DeviceReset = 16 , bmp581::Error::InvalidReply = 17 ,
  bmp581::Error::NoDevice = 18 , bmp581::Error::NoData = 19 , bmp581::Error::OutOfRange = 20 , bmp581::Error::WriteMismatch = 21 ,
  bmp581::Error::StateUnknown = 22 , bmp581::Error::ConfigRejected = 23
}
 Why a call failed. Every call of the driver returns one of these in its Result. More...
 
enum class  bmp581::LogLevel : uint8_t { bmp581::LogLevel::Error = 0 , bmp581::LogLevel::Warning , bmp581::LogLevel::Info , bmp581::LogLevel::Debug }
 Severity passed to the optional Log() hook. More...
 
enum class  bmp581::Verify : uint8_t { bmp581::Verify::None = 0 , bmp581::Verify::ReadBack = 1 }
 Extra traffic a call may spend to check what it did (handbook KB-ARCH-041). More...
 
enum class  bmp581::PowerMode : uint8_t { bmp581::PowerMode::Standby = 0 , bmp581::PowerMode::Normal = 1 , bmp581::PowerMode::Forced = 2 , bmp581::PowerMode::Continuous = 3 }
 The power mode, ODR_CONFIG.pwr_mode (sections 4.3, 7.34). More...
 
enum class  bmp581::Oversampling : uint8_t {
  bmp581::Oversampling::X1 = 0 , bmp581::Oversampling::X2 , bmp581::Oversampling::X4 , bmp581::Oversampling::X8 ,
  bmp581::Oversampling::X16 , bmp581::Oversampling::X32 , bmp581::Oversampling::X64 , bmp581::Oversampling::X128
}
 Oversampling ratio, OSR_CONFIG.osr_p and osr_t (section 7.33). More...
 
enum class  bmp581::OutputDataRate : uint8_t {
  bmp581::OutputDataRate::Hz240 = 0x00 , bmp581::OutputDataRate::Hz218p5 = 0x01 , bmp581::OutputDataRate::Hz199p1 = 0x02 , bmp581::OutputDataRate::Hz179p2 = 0x03 ,
  bmp581::OutputDataRate::Hz160 = 0x04 , bmp581::OutputDataRate::Hz149p3 = 0x05 , bmp581::OutputDataRate::Hz140 = 0x06 , bmp581::OutputDataRate::Hz129p9 = 0x07 ,
  bmp581::OutputDataRate::Hz120 = 0x08 , bmp581::OutputDataRate::Hz110p2 = 0x09 , bmp581::OutputDataRate::Hz100p3 = 0x0A , bmp581::OutputDataRate::Hz89p6 = 0x0B ,
  bmp581::OutputDataRate::Hz80 = 0x0C , bmp581::OutputDataRate::Hz70 = 0x0D , bmp581::OutputDataRate::Hz60 = 0x0E , bmp581::OutputDataRate::Hz50p1 = 0x0F ,
  bmp581::OutputDataRate::Hz45 = 0x10 , bmp581::OutputDataRate::Hz40 = 0x11 , bmp581::OutputDataRate::Hz35 = 0x12 , bmp581::OutputDataRate::Hz30 = 0x13 ,
  bmp581::OutputDataRate::Hz25 = 0x14 , bmp581::OutputDataRate::Hz20 = 0x15 , bmp581::OutputDataRate::Hz15 = 0x16 , bmp581::OutputDataRate::Hz10 = 0x17 ,
  bmp581::OutputDataRate::Hz5 = 0x18 , bmp581::OutputDataRate::Hz4 = 0x19 , bmp581::OutputDataRate::Hz3 = 0x1A , bmp581::OutputDataRate::Hz2 = 0x1B ,
  bmp581::OutputDataRate::Hz1 = 0x1C , bmp581::OutputDataRate::Hz0p5 = 0x1D , bmp581::OutputDataRate::Hz0p25 = 0x1E , bmp581::OutputDataRate::Hz0p125 = 0x1F
}
 Output data rate in normal mode, ODR_CONFIG.odr (section 7.34). More...
 
enum class  bmp581::IirFilter : uint8_t {
  bmp581::IirFilter::Bypass = 0 , bmp581::IirFilter::Coef1 , bmp581::IirFilter::Coef3 , bmp581::IirFilter::Coef7 ,
  bmp581::IirFilter::Coef15 , bmp581::IirFilter::Coef31 , bmp581::IirFilter::Coef63 , bmp581::IirFilter::Coef127
}
 IIR low-pass filter coefficient, DSP_IIR.set_iir_p and set_iir_t (table 10). More...
 
enum class  bmp581::FifoFrame : uint8_t { bmp581::FifoFrame::Disabled = 0 , bmp581::FifoFrame::Temperature = 1 , bmp581::FifoFrame::Pressure = 2 , bmp581::FifoFrame::PressureAndTemperature = 3 }
 What the FIFO stores, FIFO_SEL.fifo_frame_sel (section 4.6.1). More...
 
enum class  bmp581::FifoMode : uint8_t { bmp581::FifoMode::Streaming = 0 , bmp581::FifoMode::StopOnFull = 1 }
 What a full FIFO does with a new frame, FIFO_CONFIG.fifo_mode (section 4.6.1). More...
 
enum class  bmp581::IntMode : uint8_t { bmp581::IntMode::Pulsed = 0 , bmp581::IntMode::Latched = 1 }
 INT pin timing, INT_CONFIG.int_mode (section 4.7.3.2). More...
 
enum class  bmp581::IntPolarity : uint8_t { bmp581::IntPolarity::ActiveLow = 0 , bmp581::IntPolarity::ActiveHigh = 1 }
 INT pin polarity, INT_CONFIG.int_pol (section 7.5). More...
 
enum class  bmp581::IntDrive : uint8_t { bmp581::IntDrive::PushPull = 0 , bmp581::IntDrive::OpenDrain = 1 }
 INT pin output stage, INT_CONFIG.int_od (section 7.5). More...
 
enum class  bmp581::OorCount : uint8_t { bmp581::OorCount::Samples1 = 0 , bmp581::OorCount::Samples3 , bmp581::OorCount::Samples7 , bmp581::OorCount::Samples15 }
 Consecutive out-of-range samples before the interrupt, OOR_CONFIG.cnt_lim (7.32). More...
 

Functions

constexpr const char * bmp581::ToString (Error error) noexcept
 The name of an error, for logs.
 
constexpr uint32_t bmp581::OdrMilliHz (OutputDataRate odr) noexcept
 An output data rate in millihertz (section 7.34).
 
constexpr uint32_t bmp581::MaxOdrMilliHz (Oversampling pressure, Oversampling temperature) noexcept
 The fastest data rate normal mode accepts with this oversampling (table 7).
 
constexpr uint32_t bmp581::ConversionTimeMaxUs (Oversampling pressure, Oversampling temperature) noexcept
 The longest pressure-and-temperature conversion, t_conv_p + t_conv_t, with the +5 % of table 4, rounded up.
 
constexpr bool bmp581::EntersDeepStandby (const Config &config) noexcept
 Whether the chip enters deep standby with this configuration (section 4.3.2): deep standby allowed, a data rate below 5 Hz, the FIFO off and both IIR filters bypassed.
 
constexpr uint32_t bmp581::ForcedMeasurementMaxUs (const Config &config) noexcept
 The longest forced measurement: the start-up from (deep) standby, then the conversion (table 4).
 
constexpr int32_t bmp581::SignExtend24 (uint32_t raw) noexcept
 A 24-bit two's complement register value as a signed integer, the one place the driver reinterprets wire bits as signed (KB-CPP20-024).
 
constexpr float bmp581::PressurePa (int32_t raw) noexcept
 A pressure in pascals: raw / 2^6, exact (section 4.5).
 
constexpr float bmp581::TemperatureC (int32_t raw) noexcept
 A temperature in degrees Celsius: raw / 2^16, exact (section 4.5).
 
constexpr bool bmp581::PressureInRange (int32_t raw) noexcept
 Whether a raw pressure lies in the measurement range, 30 to 125 kPa (table 1).
 
constexpr bool bmp581::TemperatureInRange (int32_t raw) noexcept
 Whether a raw temperature lies in the measurement range, -40 to 85 °C (table 2).
 
constexpr Error bmp581::Validate (const Config &config) noexcept
 Check a configuration without touching the chip.
 
constexpr Config bmp581::ForcedPreset () noexcept
 Measurements on request: standby between MeasureOnce() calls, deep standby, the standard-resolution oversampling of table 9 (pressure x4, temperature x1).
 
constexpr Config bmp581::LowPowerPreset () noexcept
 Low power at 1 Hz in normal mode with deep standby between measurements (section 4.3.5).
 
constexpr Config bmp581::HighResolutionPreset () noexcept
 High resolution at 25 Hz: pressure x16 (table 9), the IIR on the data registers, data ready reported.
 
constexpr Config bmp581::FifoPreset () noexcept
 Pressure and temperature frames into the FIFO at 10 Hz, threshold at 8 frames.
 
void bmp581::ConfigIsInvalid () noexcept
 Reached only when a CheckedConfig is built from an invalid configuration: it is never defined, so the build fails and names it (KB-CPP20-013).
 
constexpr const char * bmp581::GetDriverVersion () noexcept
 
constexpr uint32_t bmp581::GetDriverVersionMajor () noexcept
 
constexpr uint32_t bmp581::GetDriverVersionMinor () noexcept
 
constexpr uint32_t bmp581::GetDriverVersionPatch () noexcept
 

Variables

constexpr uint8_t bmp581::kChipId = 0x50
 CHIP_ID of every BMP581 (section 7.1).
 
constexpr int32_t bmp581::kPressureCountsPerPa = 64
 Pressure LSBs per pascal: the registers hold Pa x 2^6 (section 4.5).
 
constexpr int32_t bmp581::kTemperatureCountsPerDegreeC = 65536
 Temperature LSBs per degree Celsius: the registers hold °C x 2^16 (section 4.5).
 
constexpr int32_t bmp581::kPressureMinPa = 30'000
 Lowest pressure the chip measures, in pascals (table 1).
 
constexpr int32_t bmp581::kPressureMaxPa = 125'000
 Highest pressure the chip measures, in pascals (table 1).
 
constexpr int32_t bmp581::kTemperatureMinC = -40
 Lowest temperature the chip measures, in °C (table 2).
 
constexpr int32_t bmp581::kTemperatureMaxC = 85
 Highest temperature the chip measures, in °C (table 2).
 
constexpr uint32_t bmp581::kOorReferenceMaxPa = 0x1'FFFF
 Highest out-of-range reference: 17 bits of pascals (section 4.7.2.3).
 
constexpr uint32_t bmp581::kFifoFramesSingle = 32
 Frames the FIFO holds with 3-byte frames (section 4.6).
 
constexpr uint32_t bmp581::kFifoFramesBoth = 16
 Frames the FIFO holds with 6-byte frames (section 4.6).
 
constexpr uint32_t bmp581::kFifoMaxBytes = 96
 Bytes of a full FIFO, either frame size.
 
constexpr uint32_t bmp581::kPowerUpUs = 2000
 t_powup: power-up to the first communication, maximum (table 4).
 
constexpr uint32_t bmp581::kSoftResetUs = 2000
 t_soft_res: soft reset to ready, maximum (table 4).
 
constexpr uint32_t bmp581::kStandbyUs = 2500
 t_standby: any mode to standby, maximum (table 4).
 
constexpr uint32_t bmp581::kStartupUs = 3000
 t_startup: standby to the start of a measurement, maximum (table 4).
 
constexpr uint32_t bmp581::kStartupDeepUs = 4000
 t_startup_deep: deep standby to the start of a measurement, maximum (table 4).
 
constexpr uint32_t bmp581::kReconfUs = 3000
 
constexpr uint32_t bmp581::kReadBackIdleUs = 1
 Idle time before INT_CONFIG may be read back after a write (sections 5.5.4, 7.5).
 
constexpr uint32_t bmp581::kPollUs = 500
 Time between two polls of the chip.
 
constexpr uint32_t bmp581::kTimeoutMaxMs = 10'000
 

Detailed Description

Errors, results, configuration and measurements.

Enumeration Type Documentation

◆ Error

enum class bmp581::Error : uint8_t
strong

Why a call failed. Every call of the driver returns one of these in its Result.

Values 0 to 9 are the shared base set; chip-specific values start at 16. [[nodiscard]] on the type: a function that returns a bare Error cannot have it ignored either (KB-CPP20-037).

Enumerator
Ok 

The call succeeded.

NotInitialized 

EnsureInitialized() has not succeeded, or Deinitialize() ran or a reset was found since.

InvalidArgument 

An argument, the address or a Config field is out of range; nothing was sent.

Bus 

A port hook returned false: a bus error or a NACK the port cannot place.

Timeout 

The chip did not become ready (NVM), finish a forced measurement, reach standby or report data ready within the allowed time.

DeviceIdMismatch 

At start-up, CHIP_ID did not read 0x50, or INT_STATUS did not show the soft reset (0x10, then 0x00): no BMP581 answers.

Crc 

Not returned by this driver (the bus carries no CRC).

Busy 

A forced measurement needs standby, and the chip measures (normal or continuous mode, or a forced measurement still runs); nothing was sent.

DeviceFault 

At start-up, STATUS reports an NVM error (status_nvm_err or status_nvm_cmd_err): the trimming data did not load.

Unsupported 

WaitDataReady() without the data-ready source in Config: the chip reports data ready only for an enabled source (section 4.7.1).

DeviceReset 

The chip went through a power-on or soft reset since the start, confirmed by a second read: OSR_CONFIG.press_en reads 0 (the driver always writes 1), seen directly or after INT_STATUS.por. The driver is uninitialised and wrote nothing over the reset chip: call EnsureInitialized().

InvalidReply 

A read returned what the chip cannot send: a reserved bit set, a reserved register not 0x00, a frame of all 0x00 or all 0xFF, a FIFO count above its capacity, or flags that contradict each other. A floating, stuck or disturbed line; never data.

NoDevice 

Nothing acknowledged the I2C address byte: no chip at the address, or it is unpowered. Needs a port with the optional GetLastFailure() hook; without it this is Bus.

NoData 

The data registers or a FIFO frame hold their reset value 0x7F7F7F: no measurement since the reset (sections 7.11 to 7.16, 4.6.3).

OutOfRange 

A decoded value is outside the measurement range, 30 to 125 kPa or -40 to 85 °C (tables 1 and 2): returned as an error, never clamped.

WriteMismatch 

A register read back differently from what was just written: a write the chip acknowledged but did not keep. The configuration is then in doubt (IsConfigKnown()).

StateUnknown 

The call depends on the chip's configuration, which a failed write left in doubt; nothing was sent. ApplyConfig() or EnsureInitialized() makes it known again.

ConfigRejected 

In normal mode the chip found the data rate too fast for the oversampling (OSR_EFF.odr_is_valid = 0) and measures with its own defaults (section 4.3.4). The chip was put back in standby.

◆ FifoFrame

enum class bmp581::FifoFrame : uint8_t
strong

What the FIFO stores, FIFO_SEL.fifo_frame_sel (section 4.6.1).

Enumerator
Disabled 

FIFO off. Reset value.

Temperature 

3-byte temperature frames, up to 32.

Pressure 

3-byte pressure frames, up to 32.

PressureAndTemperature 

6-byte frames, temperature first, up to 16.

◆ FifoMode

enum class bmp581::FifoMode : uint8_t
strong

What a full FIFO does with a new frame, FIFO_CONFIG.fifo_mode (section 4.6.1).

Enumerator
Streaming 

The oldest frame is dropped. Reset value.

StopOnFull 

The new frame is dropped.

◆ IirFilter

enum class bmp581::IirFilter : uint8_t
strong

IIR low-pass filter coefficient, DSP_IIR.set_iir_p and set_iir_t (table 10).

Enumerator
Bypass 

No filter. Reset value.

Coef1 

Coefficient 1.

Coef3 

Coefficient 3.

Coef7 

Coefficient 7.

Coef15 

Coefficient 15.

Coef31 

Coefficient 31.

Coef63 

Coefficient 63.

Coef127 

Coefficient 127.

◆ IntDrive

enum class bmp581::IntDrive : uint8_t
strong

INT pin output stage, INT_CONFIG.int_od (section 7.5).

Enumerator
PushPull 

Driven both ways.

OpenDrain 

Needs a pull-up. Reset value.

◆ IntMode

enum class bmp581::IntMode : uint8_t
strong

INT pin timing, INT_CONFIG.int_mode (section 4.7.3.2).

Enumerator
Pulsed 

A pulse of t_int_pulse per event.

Latched 

Asserted while a condition holds. Reset value.

◆ IntPolarity

enum class bmp581::IntPolarity : uint8_t
strong

INT pin polarity, INT_CONFIG.int_pol (section 7.5).

Enumerator
ActiveLow 

Reset value.

ActiveHigh 

Asserted high.

◆ LogLevel

enum class bmp581::LogLevel : uint8_t
strong

Severity passed to the optional Log() hook.

Enumerator
Error 

A call failed.

Warning 

Something unexpected that the driver recovered from.

Info 

Lifecycle events: initialised, reset.

Debug 

Detail for bring-up.

◆ OorCount

enum class bmp581::OorCount : uint8_t
strong

Consecutive out-of-range samples before the interrupt, OOR_CONFIG.cnt_lim (7.32).

Enumerator
Samples1 

1 sample. Reset value.

Samples3 

3 samples.

Samples7 

7 samples.

Samples15 

15 samples.

◆ OutputDataRate

enum class bmp581::OutputDataRate : uint8_t
strong

Output data rate in normal mode, ODR_CONFIG.odr (section 7.34).

Enumerator
Hz240 

240.000 Hz.

Hz218p5 

218.537 Hz.

Hz199p1 

199.111 Hz.

Hz179p2 

179.200 Hz.

Hz160 

160.000 Hz.

Hz149p3 

149.333 Hz.

Hz140 

140.000 Hz.

Hz129p9 

129.855 Hz.

Hz120 

120.000 Hz.

Hz110p2 

110.164 Hz.

Hz100p3 

100.299 Hz.

Hz89p6 

89.600 Hz.

Hz80 

80.000 Hz.

Hz70 

70.000 Hz.

Hz60 

60.000 Hz.

Hz50p1 

50.056 Hz.

Hz45 

45.025 Hz.

Hz40 

40.000 Hz.

Hz35 

35.000 Hz.

Hz30 

30.000 Hz.

Hz25 

25.005 Hz.

Hz20 

20.000 Hz.

Hz15 

15.000 Hz.

Hz10 

10.000 Hz.

Hz5 

5.000 Hz.

Hz4 

4.000 Hz: the fastest rate with deep standby between measurements.

Hz3 

3.000 Hz.

Hz2 

2.000 Hz.

Hz1 

1.000 Hz. Reset value.

Hz0p5 

0.500 Hz.

Hz0p25 

0.250 Hz.

Hz0p125 

0.125 Hz.

◆ Oversampling

enum class bmp581::Oversampling : uint8_t
strong

Oversampling ratio, OSR_CONFIG.osr_p and osr_t (section 7.33).

Enumerator
X1 

1 sample. Reset value.

X2 

2 samples.

X4 

4 samples.

X8 

8 samples.

X16 

16 samples.

X32 

32 samples.

X64 

64 samples.

X128 

128 samples.

◆ PowerMode

enum class bmp581::PowerMode : uint8_t
strong

The power mode, ODR_CONFIG.pwr_mode (sections 4.3, 7.34).

Enumerator
Standby 

No measurement; deep standby when its conditions hold (section 4.3.2). Reset value.

Normal 

One measurement per output data rate period.

Forced 

One measurement, then standby: MeasureOnce(), never a Config mode.

Continuous 

Back-to-back measurements as fast as the oversampling allows.

◆ Verify

enum class bmp581::Verify : uint8_t
strong

Extra traffic a call may spend to check what it did (handbook KB-ARCH-041).

Enumerator
None 

Only the traffic the datasheet needs.

ReadBack 

Also the reset check (one 3-byte read of OSR_CONFIG to OSR_EFF) and, for a measurement, a second read of the data registers.

Function Documentation

◆ ConversionTimeMaxUs()

constexpr uint32_t bmp581::ConversionTimeMaxUs ( Oversampling  pressure,
Oversampling  temperature 
)
constexprnoexcept

The longest pressure-and-temperature conversion, t_conv_p + t_conv_t, with the +5 % of table 4, rounded up.

Parameters
pressureOSR_CONFIG.osr_p.
temperatureOSR_CONFIG.osr_t.
Returns
Microseconds.

◆ EntersDeepStandby()

constexpr bool bmp581::EntersDeepStandby ( const Config &  config)
constexprnoexcept

Whether the chip enters deep standby with this configuration (section 4.3.2): deep standby allowed, a data rate below 5 Hz, the FIFO off and both IIR filters bypassed.

Parameters
configThe configuration.
Returns
true when standby phases are deep standby.

◆ FifoPreset()

constexpr Config bmp581::FifoPreset ( )
constexprnoexcept

Pressure and temperature frames into the FIFO at 10 Hz, threshold at 8 frames.

Returns
The preset.

◆ ForcedMeasurementMaxUs()

constexpr uint32_t bmp581::ForcedMeasurementMaxUs ( const Config &  config)
constexprnoexcept

The longest forced measurement: the start-up from (deep) standby, then the conversion (table 4).

Parameters
configThe configuration.
Returns
Microseconds.

◆ ForcedPreset()

constexpr Config bmp581::ForcedPreset ( )
constexprnoexcept

Measurements on request: standby between MeasureOnce() calls, deep standby, the standard-resolution oversampling of table 9 (pressure x4, temperature x1).

Returns
The preset.

◆ GetDriverVersion()

constexpr const char * bmp581::GetDriverVersion ( )
constexprnoexcept
Returns
The driver version, e.g. "0.1.0", from the generated bmp581_version.h. No I/O.

◆ GetDriverVersionMajor()

constexpr uint32_t bmp581::GetDriverVersionMajor ( )
constexprnoexcept
Returns
The major version. No I/O.

◆ GetDriverVersionMinor()

constexpr uint32_t bmp581::GetDriverVersionMinor ( )
constexprnoexcept
Returns
The minor version. No I/O.

◆ GetDriverVersionPatch()

constexpr uint32_t bmp581::GetDriverVersionPatch ( )
constexprnoexcept
Returns
The patch version. No I/O.

◆ HighResolutionPreset()

constexpr Config bmp581::HighResolutionPreset ( )
constexprnoexcept

High resolution at 25 Hz: pressure x16 (table 9), the IIR on the data registers, data ready reported.

Returns
The preset.

◆ LowPowerPreset()

constexpr Config bmp581::LowPowerPreset ( )
constexprnoexcept

Low power at 1 Hz in normal mode with deep standby between measurements (section 4.3.5).

Returns
The preset.

◆ MaxOdrMilliHz()

constexpr uint32_t bmp581::MaxOdrMilliHz ( Oversampling  pressure,
Oversampling  temperature 
)
constexprnoexcept

The fastest data rate normal mode accepts with this oversampling (table 7).

Parameters
pressureOSR_CONFIG.osr_p.
temperatureOSR_CONFIG.osr_t.
Returns
The rate in millihertz.

◆ OdrMilliHz()

constexpr uint32_t bmp581::OdrMilliHz ( OutputDataRate  odr)
constexprnoexcept

An output data rate in millihertz (section 7.34).

Parameters
odrThe rate; a value that is not an enumerator reads as the slowest rate.
Returns
The rate, for example 240000 for Hz240.

◆ PressureInRange()

constexpr bool bmp581::PressureInRange ( int32_t  raw)
constexprnoexcept

Whether a raw pressure lies in the measurement range, 30 to 125 kPa (table 1).

Parameters
rawPressure in 1/64 Pa.
Returns
true inside the range, both ends included.

◆ PressurePa()

constexpr float bmp581::PressurePa ( int32_t  raw)
constexprnoexcept

A pressure in pascals: raw / 2^6, exact (section 4.5).

Parameters
rawPressure in 1/64 Pa.
Returns
Pascals.

◆ SignExtend24()

constexpr int32_t bmp581::SignExtend24 ( uint32_t  raw)
constexprnoexcept

A 24-bit two's complement register value as a signed integer, the one place the driver reinterprets wire bits as signed (KB-CPP20-024).

Parameters
rawThe 24 bits; bits 31..24 are ignored.
Returns
-8388608 to 8388607.

◆ TemperatureC()

constexpr float bmp581::TemperatureC ( int32_t  raw)
constexprnoexcept

A temperature in degrees Celsius: raw / 2^16, exact (section 4.5).

Parameters
rawTemperature in 1/65536 °C.
Returns
Degrees Celsius.

◆ TemperatureInRange()

constexpr bool bmp581::TemperatureInRange ( int32_t  raw)
constexprnoexcept

Whether a raw temperature lies in the measurement range, -40 to 85 °C (table 2).

Parameters
rawTemperature in 1/65536 °C.
Returns
true inside the range, both ends included.

◆ ToString()

constexpr const char * bmp581::ToString ( Error  error)
constexprnoexcept

The name of an error, for logs.

Parameters
errorThe error.
Returns
A static string such as "Timeout"; "Unknown" for a value that is not an enumerator.

◆ Validate()

constexpr Error bmp581::Validate ( const Config &  config)
constexprnoexcept

Check a configuration without touching the chip.

Fails when an enumeration holds a value that is not an enumerator, the mode is Forced (use MeasureOnce()), the FIFO threshold is above 31 (15 with pressure-and-temperature frames), the decimation above 7, the INT pad drive above 15 (above 7 with push-pull, section 7.5), the out-of-range reference above 17 bits, a timeout is 0 or above kTimeoutMaxMs, or normal mode asks for a data rate above the one table 7 allows for the oversampling.

Parameters
configThe configuration.
Returns
Error::Ok or Error::InvalidArgument.

Variable Documentation

◆ kReconfUs

constexpr uint32_t bmp581::kReconfUs = 3000
inlineconstexpr

t_reconf: a configuration change to the first measurement, maximum (table 4); the FIFO flush completes within it (section 4.6.4).

◆ kTimeoutMaxMs

constexpr uint32_t bmp581::kTimeoutMaxMs = 10'000
inlineconstexpr

Longest Config::startup_timeout_ms and Config::data_ready_timeout_ms the driver accepts: the bound of every poll loop (KB-CPP20-058; the Kconfig ranges are the same).