|
BMP581 Driver 1.0.0
API reference
|
CRTP register transport for the Bosch BMP581 (I2C or SPI). More...
#include <cstddef>#include <cstdint>#include <type_traits>Go to the source code of this file.
Classes | |
| struct | bmp581::detail::DeclaredInterface< Bus, typename > |
| struct | bmp581::detail::DeclaredInterface< Bus, std::void_t< decltype(Bus::kInterface)> > |
| class | bmp581::BusInterface< Derived > |
| CRTP base for the BMP581 register transport. More... | |
Namespaces | |
| namespace | bmp581 |
| namespace | bmp581::detail |
Enumerations | |
| enum class | bmp581::Interface : uint8_t { bmp581::Unspecified = 0 , bmp581::I2c = 1 , bmp581::Spi = 2 } |
Bus an adapter drives, declared as static constexpr Interface kInterface (optional). More... | |
Variables | |
| template<typename Bus > | |
| constexpr Interface | bmp581::kBusInterface = detail::DeclaredInterface<Bus>::value |
The interface adapter Bus declares, or Interface::Unspecified. | |
CRTP register transport for the Bosch BMP581 (I2C or SPI).
The BMP581 is register addressed, so one adapter shape serves both buses. The platform adapter implements:
bool WriteRegs(uint8_t reg, const uint8_t* data, std::size_t len);bool ReadRegs(uint8_t reg, uint8_t* out, std::size_t len);void DelayUs(uint32_t us);bool EnsureInitialized();I2C: WriteRegs sends [reg, data…] (auto-increment); ReadRegs writes reg then reads len bytes (7-bit address 0x46 or 0x47 selected by SDO). SPI: reads send reg | 0x80 and the data follows the address byte directly (no dummy byte), with auto-increment. Writes do not auto-increment: send (reg + i) & 0x7F before each data byte. The device starts in I2C mode after power-up and after a soft reset; one dummy SPI read selects SPI (its data is invalid). I2C: the device does not acknowledge a write of 0xB6 to CMD.
The adapter may also declare which bus it drives:
static constexpr bmp581::Interface kInterface = bmp581::Interface::Spi;The driver uses it for the two interface-specific steps: on SPI it performs the interface-selecting dummy read in Init() and after a soft reset; on I2C it accepts the missing acknowledge of the soft-reset command. An adapter without kInterface gets both (Interface::Unspecified), which is correct on either bus. Neither step is left to the adapter.