|
BMP581 Driver 0.1.0
API reference
|
The SPI port of the BMP581 driver: the CRTP base, the SpiPort concept, the bus requirements and the register framing.
More...
#include <array>#include <concepts>#include <cstddef>#include <cstdint>#include <span>#include "bmp581_detail.hpp"#include "bmp581_registers.hpp"#include "bmp581_types.hpp"Go to the source code of this file.
Classes | |
| class | bmp581::SpiInterface< Derived > |
| CRTP base of the platform SPI port. More... | |
Namespaces | |
| namespace | bmp581 |
The BMP581 driver: everything it declares lives here; internals in detail. | |
| namespace | bmp581::spi |
What the BMP581 needs from the SPI bus (sections 5.2.1, 5.5, table 18). A port and a board configuration check their settings against these with static_assert (handbook KB-CPP-123). | |
Concepts | |
| concept | bmp581::SpiPort |
Satisfied by a class that derives from SpiInterface<Port> and implements the required hooks with exactly the types above, noexcept and returning bool (KB-CPP20-006). | |
Variables | |
| constexpr uint8_t | bmp581::spi::kSpiMode = 0 |
| constexpr bool | bmp581::spi::kMsbFirst = true |
| Each byte is clocked most significant bit first (figures 8 to 11). | |
| constexpr uint32_t | bmp581::spi::kMaxClockHz = 12'000'000 |
| Highest SCK frequency with VDDIO at or above 1.62 V and C_bus up to 80 pF (table 4, f_spi). | |
| constexpr uint32_t | bmp581::spi::kMaxClockLowVoltageHz = 7'000'000 |
| Highest SCK frequency below VDDIO 1.62 V with C_bus up to 40 pF (table 4, f_spi_lowv). | |
| constexpr uint32_t | bmp581::spi::kMinCsHighNs = 80 |
| constexpr uint32_t | bmp581::spi::kCsSetupNs = 40 |
| constexpr uint32_t | bmp581::spi::kCsHoldNs = 40 |
| Last SCK edge to CSB high, the CSB lag time (table 18, T_hold_csb). | |
| constexpr bool | bmp581::spi::kContinuousWord = false |
false: SCK may pause between the bytes of one frame while CSB stays low (section 5.5). | |
The SPI port of the BMP581 driver: the CRTP base, the SpiPort concept, the bus requirements and the register framing.
The driver never calls an SDK. On SPI it calls hooks on a class you derive from bmp581::SpiInterface<Self>:
| Hook | Contract |
|---|---|
bool EnsureInitialized() noexcept | Bring the bus up on the first call, CSB high before the first frame; true at once afterwards |
bool Transfer(const uint8_t* tx, uint8_t* rx, std::size_t len) noexcept | One full-duplex frame, CSB low for all len bytes; rx may be nullptr |
Four-wire SPI only (section 6.2.2): the driver never sets DRIVE_CONFIG.spi3_en. The chip starts in I2C mode after a power-on or soft reset and changes to SPI on the first frame with at least 16 SCK edges, whose data is invalid (section 5.1); the driver sends that dummy read itself, in EnsureInitialized() and after each soft reset. The port moves raw bytes: it never retries and never interprets the frame. What the chip needs from the bus is below as constexpr values in bmp581::spi; a port checks its settings against them with static_assert.
Section, table and figure numbers refer to the Bosch BMP581 datasheet, document BST-BMP581-DS004-13, revision 1.13.