|
|
| BNO085Interface | GetInterfaceType () noexcept |
| | Report the transport type this implementation provides.
|
| |
|
| 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.
|
| |
|
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.
|
| bool | GpioSet (CtrlPin pin, GpioSignal signal) noexcept |
| | Set a control pin to the specified signal state.
|
| |
| bool | GpioSetActive (CtrlPin pin) noexcept |
| | Assert a control pin (set to ACTIVE).
|
| |
| bool | GpioSetInactive (CtrlPin pin) noexcept |
| | Deassert a control pin (set to INACTIVE).
|
| |
template<typename Derived>
class bno08x::CommInterface< Derived >
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.
- Template Parameters
-
| Derived | The concrete implementation class (CRTP pattern). |
- Note
- Implementations must provide all listed methods. The
GpioSet() method may be a no-op for pins that are not wired on the board.
Optional hooks, detected at compile time (the base class has no default for them, so a port without them keeps compiling):
uint8_t GetI2cAddress() and bool SetI2cAddress(uint8_t addr7): I2C ports should provide both. During a firmware update the driver switches the port to the bootloader address (0x28 with SA0 low, 0x29 with SA0 high; datasheet section 1.4) and restores the application address (0x4A / 0x4B, figure 1-12) afterwards. Without them the port itself must talk to the bootloader address during DFU.
template<typename Derived >
Close the communication bus and release resources.
Called during driver shutdown. Implementations should de-initialise the peripheral and release any allocated resources.
Returns void on purpose: the vendor sh2_Hal_t::close hook is void, and the driver has nothing to recover on teardown. Log failures in the port.
template<typename Derived >
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.
The port's GpioSet() returns bool: true when the pin was driven (or is not wired, so there is nothing to drive), false on a GPIO error. A port written for the earlier contract, with a void GpioSet(), still compiles and is treated as never failing (see detail::GpioSet()).
- Parameters
-
| [in] | pin | Which control pin to drive. |
| [in] | signal | ACTIVE to assert the pin function, INACTIVE to deassert. |
- Returns
true on success, false if the port reported a GPIO error.
template<typename Derived >
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.
- Parameters
-
| [out] | data | Buffer to fill with received bytes. |
| [in] | length | Maximum number of bytes to read. |
- Returns
- Number of bytes actually read, 0 if no data available, or negative on error.