53template <
typename Bus,
typename =
void>
58template <
typename Bus>
60 static_assert(std::is_same_v<std::remove_cv_t<
decltype(Bus::kInterface)>,
Interface>,
61 "bmp581: the adapter's kInterface must be a bmp581::Interface");
68template <
typename Bus>
75template <
typename Derived>
79 bool WriteRegs(uint8_t reg,
const uint8_t* data, std::size_t len)
noexcept {
80 return static_cast<Derived*
>(
this)->
WriteRegs(reg, data, len);
84 bool ReadRegs(uint8_t reg, uint8_t* out, std::size_t len)
noexcept {
85 return static_cast<Derived*
>(
this)->
ReadRegs(reg, out, len);
89 void DelayUs(uint32_t us)
noexcept {
static_cast<Derived*
>(
this)->
DelayUs(us); }
CRTP base for the BMP581 register transport.
Definition bmp581_bus_interface.hpp:76
bool WriteRegs(uint8_t reg, const uint8_t *data, std::size_t len) noexcept
Write len bytes starting at register reg (auto-increment).
Definition bmp581_bus_interface.hpp:79
bool ReadRegs(uint8_t reg, uint8_t *out, std::size_t len) noexcept
Read len bytes starting at register reg (auto-increment).
Definition bmp581_bus_interface.hpp:84
bool EnsureInitialized() noexcept
Lazy bus bring-up; must return true before any transfer.
Definition bmp581_bus_interface.hpp:92
void DelayUs(uint32_t us) noexcept
Blocking delay in microseconds (soft reset 2 ms, standby 2.5 ms, NVM 0.8 ms).
Definition bmp581_bus_interface.hpp:89
Interface
Bus an adapter drives, declared as static constexpr Interface kInterface (optional).
Definition bmp581_bus_interface.hpp:45
@ Unspecified
not declared: the driver handles both I2C and SPI behaviour
constexpr Interface kBusInterface
The interface adapter Bus declares, or Interface::Unspecified.
Definition bmp581_bus_interface.hpp:69
@ Bus
register read/write failed
Definition bmp581_bus_interface.hpp:54
static constexpr Interface value
Definition bmp581_bus_interface.hpp:55