|
| | Esp32Bno08xI2cBus () |
| | Constructor with default configuration.
|
| |
| | Esp32Bno08xI2cBus (const I2CConfig &config) |
| | Constructor with custom I2C configuration.
|
| |
| | ~Esp32Bno08xI2cBus () |
| | Destructor - cleans up I2C resources.
|
| |
| BNO085Interface | GetInterfaceType () noexcept |
| | Identify this transport as I2C (required by CommInterface).
|
| |
| bool | Open () noexcept |
| | Open the I2C bus and initialize communication (required by CommInterface)
|
| |
| void | Close () noexcept |
| | Close the I2C bus and release resources (required by CommInterface)
|
| |
| int | Write (const uint8_t *data, uint32_t length) noexcept |
| | Write raw data to the BNO08x sensor (required by CommInterface)
|
| |
| int | Read (uint8_t *data, uint32_t length) noexcept |
| | Read raw data from the BNO08x sensor (required by CommInterface)
|
| |
| bool | Probe () noexcept |
| | Probe the I2C device to verify it's responding.
|
| |
| bool | DataAvailable () noexcept |
| | Check if new data is available (required by CommInterface)
|
| |
| void | Delay (uint32_t ms) noexcept |
| | Delay execution for specified time (required by CommInterface)
|
| |
| uint32_t | GetTimeUs () noexcept |
| | Get current time in microseconds (required by CommInterface)
|
| |
| void | GpioSet (bno08x::CtrlPin pin, bno08x::GpioSignal signal) noexcept |
| | Set a control pin to the specified signal state (required by CommInterface)
|
| |
| bool | Init () noexcept |
| | Initialize the I2C bus, GPIO, and device handle.
|
| |
| void | Deinit () noexcept |
| | Deinitialize the I2C bus and release all resources.
|
| |
| const I2CConfig & | getConfig () const noexcept |
| | Get the I2C configuration.
|
| |
| bool | isInitialized () const noexcept |
| | Check if the bus is initialized.
|
| |
| void | HardwareReset (uint32_t lowMs=2, uint32_t bootDelayMs=200) noexcept |
| | Perform hardware reset pulse on the BNO08x.
|
| |
| 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.
|
| |
| 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).
|
| |
ESP32 implementation of bno08x::CommInterface using ESP-IDF I2C master driver.
This class mirrors the proven Esp32Pca9685Bus / Esp32Pcal9555Bus implementations for consistent I2C communication behavior across HardFOC drivers. The BNO08x uses the SH-2 packet protocol over I2C (raw byte transfers, no register addressing), so the interface methods differ from the register-addressed I2cInterface, but the underlying bus management is identical.
Key improvements over the previous implementation:
- Device handle caching: avoids add_device/rm_device per transaction
- Header-only: consistent with other HardFOC ESP32 bus implementations
- Proper resource cleanup via Init()/Deinit() pattern
- Factory function for convenient instantiation
| int Esp32Bno08xI2cBus::Read |
( |
uint8_t * | data, |
|
|
uint32_t | length ) |
|
inlinenoexcept |
Read raw data from the BNO08x sensor (required by CommInterface)
Receives raw bytes over I2C. The BNO08x SH-2 protocol does not use register addressing — all data is received as raw byte streams.
When an interrupt pin is configured, this function checks it first to avoid unnecessary I2C transactions. If the interrupt pin indicates no data is available (pin is high), it returns 0 immediately.
Note: ESP-IDF's i2c_master_receive() automatically handles clock stretching, which is required by the BNO08x datasheet (the sensor can hold SCL low when it needs more time to prepare data).
- Parameters
-
| data | Pointer to receive buffer |
| length | Number of bytes to read |
- Returns
- Number of bytes read, 0 if no data, or negative on error