91template <
typename Derived>
126 return static_cast<Derived*
>(
this)->
Open();
136 static_cast<Derived*
>(
this)->
Close();
149 int Write(
const uint8_t* data, uint32_t length)
noexcept {
150 return static_cast<Derived*
>(
this)->
Write(data, length);
165 int Read(uint8_t* data, uint32_t length)
noexcept {
166 return static_cast<Derived*
>(
this)->
Read(data, length);
189 static_cast<Derived*
>(
this)->
Delay(ms);
202 return static_cast<Derived*
>(
this)->
GetTimeUs();
225 static_cast<Derived*
>(
this)->
GpioSet(pin, signal);
BNO085Interface
Identifies the host interface type that a CommInterface provides.
Definition bno08x_comm_interface.hpp:25
@ UARTRVC
UART in RVC mode (PS1=1, PS0=0). RVC frames only.
@ SPI
SPI bus (PS1=1, PS0=1). Supports SH-2 and DFU.
@ UART
UART in SH-2 mode (PS1=0, PS0=1). Supports SH-2 and DFU.
@ I2C
I2C bus (PS1=0, PS0=0). Supports SH-2 and DFU.
CRTP base class for BNO08x communication interfaces.
Definition bno08x_comm_interface.hpp:92
void GpioSet(CtrlPin pin, GpioSignal signal) noexcept
Set a control pin to the specified signal state.
Definition bno08x_comm_interface.hpp:224
CommInterface()=default
Protected constructor – prevents direct instantiation.
bool DataAvailable() noexcept
Check whether the sensor has data ready.
Definition bno08x_comm_interface.hpp:177
CommInterface(CommInterface &&) noexcept=default
Movable.
CommInterface & operator=(const CommInterface &)=delete
Non-copyable.
void Close() noexcept
Close the communication bus and release resources.
Definition bno08x_comm_interface.hpp:135
CommInterface(const CommInterface &)=delete
Non-copyable.
uint32_t GetTimeUs() noexcept
Return the current monotonic time in microseconds.
Definition bno08x_comm_interface.hpp:201
void GpioSetActive(CtrlPin pin) noexcept
Assert a control pin (set to ACTIVE).
Definition bno08x_comm_interface.hpp:235
int Write(const uint8_t *data, uint32_t length) noexcept
Write raw bytes to the sensor.
Definition bno08x_comm_interface.hpp:149
bool Open() noexcept
Open and initialise the communication bus.
Definition bno08x_comm_interface.hpp:125
void GpioSetInactive(CtrlPin pin) noexcept
Deassert a control pin (set to INACTIVE).
Definition bno08x_comm_interface.hpp:246
~CommInterface()=default
Protected destructor – prevent polymorphic deletion through base.
void Delay(uint32_t ms) noexcept
Block for a specified duration.
Definition bno08x_comm_interface.hpp:188
int Read(uint8_t *data, uint32_t length) noexcept
Read raw bytes from the sensor.
Definition bno08x_comm_interface.hpp:165
BNO085Interface GetInterfaceType() noexcept
Report the transport type this implementation provides.
Definition bno08x_comm_interface.hpp:106
Definition bno08x_comm_interface.hpp:36
CtrlPin
Identifies the hardware control pins of the BNO08x.
Definition bno08x_comm_interface.hpp:58
@ PS0
Protocol select bit 0 (active-high on the physical pin)
@ BOOTN
Bootloader entry (active-low on the physical pin)
@ RSTN
Hardware reset (active-low on the physical pin)
@ PS1
Protocol select bit 1 (active-high on the physical pin)
@ WAKE
Wake from suspend, SPI mode only (active-low on the physical pin)
GpioSignal
Abstract signal level for control pins.
Definition bno08x_comm_interface.hpp:74
@ ACTIVE
Pin function is asserted.
@ INACTIVE
Pin function is deasserted.