BMP581 Driver 1.0.0
API reference
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Variables
bmp581_bus_interface.hpp File Reference

CRTP register transport for the Bosch BMP581 (I2C or SPI). More...

#include <cstddef>
#include <cstdint>
#include <type_traits>
Include dependency graph for bmp581_bus_interface.hpp:
This graph shows which files directly or indirectly include this file:

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.
 

Detailed Description

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:

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:

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.