|
HF-BNO08x
0.1.0-dev
|
CRTP base class for BNO08x communication interfaces. More...
#include <bno08x_comm_interface.hpp>
Public Member Functions | |
Interface Identification | |
| BNO085Interface | GetInterfaceType () noexcept |
| Report the transport type this implementation provides. | |
Bus I/O – Required Methods | |
| bool | Open () noexcept |
| Open and initialise the communication bus. | |
| void | Close () noexcept |
| Close the communication bus and release resources. | |
| int | Write (const uint8_t *data, uint32_t length) noexcept |
| Write raw bytes to the sensor. | |
| int | Read (uint8_t *data, uint32_t length) noexcept |
| Read raw bytes from the sensor. | |
| bool | DataAvailable () noexcept |
| Check whether the sensor has data ready. | |
| void | Delay (uint32_t ms) noexcept |
| Block for a specified duration. | |
| uint32_t | GetTimeUs () noexcept |
| Return the current monotonic time in microseconds. | |
GPIO Pin Control | |
Unified interface for controlling BNO08x hardware control pins. The platform bus implementation maps GpioSignal::ACTIVE/INACTIVE to the correct physical level for each pin based on its polarity. | |
| void | GpioSet (CtrlPin pin, GpioSignal signal) noexcept |
| Set a control pin to the specified signal state. | |
| void | GpioSetActive (CtrlPin pin) noexcept |
| Assert a control pin (set to ACTIVE). | |
| void | GpioSetInactive (CtrlPin pin) noexcept |
| Deassert a control pin (set to INACTIVE). | |
Protected Member Functions | |
| CommInterface ()=default | |
| Protected constructor – prevents direct instantiation. | |
| ~CommInterface ()=default | |
| Protected destructor – prevent polymorphic deletion through base. | |
| CommInterface (const CommInterface &)=delete | |
| Non-copyable. | |
| CommInterface & | operator= (const CommInterface &)=delete |
| Non-copyable. | |
| CommInterface (CommInterface &&) noexcept=default | |
| Movable. | |
| CommInterface & | operator= (CommInterface &&) noexcept=default |
| Movable. | |
CRTP base class for BNO08x communication interfaces.
Platform-specific implementations inherit from this template with themselves as the template parameter. All method calls are resolved at compile time via static_cast<Derived*>(this)->Method() – no vtable, no indirection.
| Derived | The concrete implementation class (CRTP pattern). |
GpioSet() method may be a no-op for pins that are not wired on the board.
|
protecteddefault |
Protected constructor – prevents direct instantiation.
|
protecteddefault |
Protected destructor – prevent polymorphic deletion through base.
|
protecteddelete |
Non-copyable.
|
protecteddefaultnoexcept |
Movable.
|
inlinenoexcept |
Close the communication bus and release resources.
Called during driver shutdown. Implementations should de-initialise the peripheral and release any allocated resources.
|
inlinenoexcept |
Check whether the sensor has data ready.
Typically checks the interrupt (INT) pin level. For transports without an interrupt pin, return true unconditionally to allow polling.
true if data is available (or if unknown), false otherwise.
|
inlinenoexcept |
Block for a specified duration.
Used by the driver for reset timing and post-DFU delays.
| [in] | ms | Delay duration in milliseconds. |
|
inlinenoexcept |
Report the transport type this implementation provides.
The BNO085 driver calls this once during Begin() or BeginRvc() to determine which operations to allow.
|
inlinenoexcept |
Return the current monotonic time in microseconds.
The vendor SH-2 library requires a microsecond time source for timestamping sensor events. The value does not need to represent wall-clock time – only monotonicity matters.
|
inlinenoexcept |
Set a control pin to the specified signal state.
The bus implementation is responsible for mapping ACTIVE/INACTIVE to the correct physical level based on the pin's active-level design.
| [in] | pin | Which control pin to drive. |
| [in] | signal | ACTIVE to assert the pin function, INACTIVE to deassert. |
|
inlinenoexcept |
Assert a control pin (set to ACTIVE).
Convenience wrapper for GpioSet(pin, GpioSignal::ACTIVE).
| [in] | pin | Which control pin to assert. |
|
inlinenoexcept |
Deassert a control pin (set to INACTIVE).
Convenience wrapper for GpioSet(pin, GpioSignal::INACTIVE).
| [in] | pin | Which control pin to deassert. |
|
inlinenoexcept |
Open and initialise the communication bus.
Called by BNO085::Begin() (SH-2 mode) or BNO085::BeginRvc() (RVC mode). Implementations should configure the peripheral, set up GPIO pins, and prepare for data transfer.
true on success, false on failure.
|
protecteddefaultnoexcept |
Movable.
|
protecteddelete |
Non-copyable.
|
inlinenoexcept |
Read raw bytes from the sensor.
For SH-2 mode, the vendor SHTP library calls this to receive packets. For RVC mode, the driver calls Read(&byte, 1) repeatedly to feed the internal 19-byte frame parser.
| [out] | data | Buffer to fill with received bytes. |
| [in] | length | Maximum number of bytes to read. |
|
inlinenoexcept |
Write raw bytes to the sensor.
For I2C/SPI this sends data on the bus. For UART-RVC this is typically unused (RVC mode is read-only).
| [in] | data | Pointer to the buffer to transmit. |
| [in] | length | Number of bytes to write. |