|
M5Unit-ENV 1.6.0 git rev:f6fd6b0
|
SPA06-003 measurement data + calibration/compensation (framework independent) More...
#include <array>#include <cstdint>#include <cmath>#include <limits>Go to the source code of this file.
Classes | |
| struct | m5::unit::spa06::coeffs_t |
| Factory calibration coefficients (all 2's complement, already sign-extended) More... | |
| struct | m5::unit::spa06::Data |
| One SPA06 sample: a 6-byte burst from PSR_B2 (0x00) = PSR(24) + TMP(24), big-endian. More... | |
Namespaces | |
| namespace | m5 |
| Top level namespace of M5Stack. | |
Enumerations | |
| enum class | m5::unit::spa06::Oversampling : uint8_t { X1 , X2 , X4 , X8 , X16 , X32 , X64 , X128 } |
| Oversampling factor; the enum value is the PM_PRC/TM_PRC nibble (datasheet Table 4) More... | |
| enum class | m5::unit::spa06::Rate : uint8_t { Rate1 , Rate2 , Rate4 , Rate8 , Rate16 , Rate32 , Rate64 , Rate128 } |
| Measurement rate; the enum value is the PM_RATE/TMP_RATE nibble (measurements per second) More... | |
| enum class | m5::unit::spa06::Mode : uint8_t { Pressure = 0x05 , Temperature = 0x06 , PressureAndTemperature = 0x07 } |
| Continuous measurement type; the enum value is the MEAS_CFG MEAS_CTRL[2:0] background-mode code. More... | |
Functions | |
| float | m5::unit::spa06::scale_factor (const Oversampling oversampling) |
| Compensation scale factor kP/kT for an oversampling rate (datasheet Table 4) | |
| uint32_t | m5::unit::spa06::measurement_time_x10 (const Oversampling oversampling) |
| Measurement time (ms x10) for an oversampling rate (datasheet Table 8), indexed by nibble. | |
| bool | m5::unit::spa06::valid_combination (const Oversampling osrs_p, const Oversampling osrs_t, const Rate rate, const Mode mode) |
| True if a rate/oversampling/mode combination fits the datasheet timing budget. | |
| int32_t | m5::unit::spa06::sign_extend (const uint32_t v, const uint8_t bits) |
Sign-extend the low bits of v (2's complement) | |
| coeffs_t | m5::unit::spa06::parse_coeffs (const std::array< uint8_t, 21 > &r) |
| Parse the 21 COEF register bytes (0x10..0x24) into coeffs_t (datasheet Table 10) | |
| float | m5::unit::spa06::compensate_temperature (const int32_t tmp_raw, const coeffs_t &c, const float kt) |
| Compensated temperature (degC) from a raw TMP reading and scale kT. | |
| float | m5::unit::spa06::compensate_pressure (const int32_t psr_raw, const int32_t tmp_raw, const coeffs_t &c, const float kp, const float kt) |
| Compensated pressure (Pa) from raw PSR/TMP readings and scales kP/kT (datasheet 4.6.1) | |
| float | m5::unit::spa06::altitude_m (const float pressure_hpa, const float sea_level_hpa) |
| Relative altitude (m) from a pressure and a reference (both hPa), barometric formula. | |
Variables | |
| constexpr int32_t | m5::unit::spa06::NOT_MEASURED {-8388608} |
| Sentinel value of psr_raw()/tmp_raw() for a register not measured yet (reset value 0x800000) | |
SPA06-003 measurement data + calibration/compensation (framework independent)
PSR/TMP are 24-bit 2's complement; 11 calibration coefficients (c0,c1 12-bit; c00,c10 20-bit; c01,c11,c20,c21,c30 16-bit; c31,c40 12-bit) drive a high-order compensation polynomial. Pressure is returned in Pa; the UnitSPA06 driver converts to hPa.
|
strong |
Continuous measurement type; the enum value is the MEAS_CFG MEAS_CTRL[2:0] background-mode code.
|
strong |
|
strong |
|
inline |
True if a rate/oversampling/mode combination fits the datasheet timing budget.
Background mode shares a 1-second timeline between pressure and temperature (single ADC). The active measurement type(s) must fit: Rate x (sum of active measurement times) < 1 second (datasheet 7.3 Note under Table 9). Pressure and temperature run at the same Rate in this driver.