|
HF-Core Platform 0.1.0-dev
Hardware-Agnostic Handler Layer & RTOS Utilities for HardFOC
|
Unified handler for BNO08x IMU sensor family. More...
#include <Bno08xHandler.h>
Public Member Functions | |
| Bno08xHandler (BaseI2c &i2c_device, const Bno08xConfig &config=Bno08xConfig{}, BaseGpio *reset_gpio=nullptr, BaseGpio *int_gpio=nullptr) noexcept | |
| Construct BNO08x handler with I2C interface. | |
| Bno08xHandler (BaseSpi &spi_device, const Bno08xConfig &config=Bno08xConfig{}, BaseGpio *reset_gpio=nullptr, BaseGpio *int_gpio=nullptr, BaseGpio *wake_gpio=nullptr) noexcept | |
| Construct BNO08x handler with SPI interface. | |
| ~Bno08xHandler () noexcept=default | |
| Bno08xHandler (const Bno08xHandler &)=delete | |
| Bno08xHandler & | operator= (const Bno08xHandler &)=delete |
| Bno08xHandler (Bno08xHandler &&)=delete | |
| Bno08xHandler & | operator= (Bno08xHandler &&)=delete |
| Bno08xError | Initialize () noexcept |
| Initialize the BNO08x sensor. | |
| bool | EnsureInitialized () noexcept |
| Ensure the BNO08x is initialized (lazy init entrypoint). | |
| Bno08xError | Deinitialize () noexcept |
| Deinitialize the sensor. | |
| bool | IsInitialized () const noexcept |
| Check if sensor is initialized and ready. | |
| Bno08xError | Update () noexcept |
| Update sensor - must be called regularly to pump the SH-2 service loop. | |
| void | SetSensorCallback (SensorCallback callback) noexcept |
| Set callback for sensor events. | |
| void | ClearSensorCallback () noexcept |
| Clear sensor event callback. | |
| BNO085Interface | GetInterfaceType () const noexcept |
| Get the communication interface type. | |
| IBno08xDriverOps * | GetSensor () noexcept |
| Get direct access to the underlying sensor driver (type-erased). | |
| const IBno08xDriverOps * | GetSensor () const noexcept |
| Const overload of GetSensor(). | |
| IBno08xDriverOps * | GetDriver () noexcept |
| Naming-consistent alias of GetSensor(). | |
| const IBno08xDriverOps * | GetDriver () const noexcept |
| template<typename Fn > | |
| auto | visitDriver (Fn &&fn) noexcept -> decltype(fn(std::declval< IBno08xDriverOps & >())) |
| Visit the underlying IMU driver under handler mutex protection. | |
| Bno08xError | GetLastError () const noexcept |
| Get the last handler error code. | |
| int | GetLastDriverError () const noexcept |
| Get the last driver-level SH-2 error code. | |
| const char * | GetDescription () const noexcept |
| Get a human-readable description of the handler. | |
| void | DumpDiagnostics () const noexcept |
| Dump comprehensive diagnostics to the logger. | |
Static Public Member Functions | |
| static void | QuaternionToEuler (const Bno08xQuaternion &quaternion, Bno08xEulerAngles &euler_angles) noexcept |
| Convert quaternion to Euler angles (roll, pitch, yaw in radians). | |
| static Bno08xConfig | GetDefaultConfig () noexcept |
| Get default sensor configuration. | |
Private Member Functions | |
| bool | ensureInitializedLocked () noexcept |
| Internal: ensure initialized (assumes mutex is held). | |
| bool | applyConfigLocked () noexcept |
| Internal: apply configured sensor enables (assumes mutex is held). | |
Static Private Member Functions | |
| static Bno08xError | mapDriverError (int sh2_error) noexcept |
| Internal: map SH-2 error code to Bno08xError. | |
Private Attributes | |
| std::unique_ptr< IBno08xDriverOps > | driver_ops_ |
| Type-erased driver. | |
| Bno08xConfig | config_ |
| Current configuration. | |
| RtosMutex | handler_mutex_ |
| Thread safety mutex. | |
| bool | initialized_ {false} |
| Initialization state. | |
| Bno08xError | last_error_ {Bno08xError::SUCCESS} |
| Last error. | |
| BNO085Interface | interface_type_ |
| I2C or SPI. | |
| SensorCallback | user_callback_ |
| User's sensor callback. | |
| char | description_ [64] {} |
| Description string. | |
Unified handler for BNO08x IMU sensor family.
Provides a comprehensive, non-templated interface for BNO08x sensors with:
|
explicitnoexcept |
Construct BNO08x handler with I2C interface.
| i2c_device | Reference to BaseI2c implementation (address pre-configured) |
| config | Initial sensor configuration |
| reset_gpio | Optional GPIO for hardware reset |
| int_gpio | Optional GPIO for interrupt monitoring |
|
explicitnoexcept |
Construct BNO08x handler with SPI interface.
| spi_device | Reference to BaseSpi implementation |
| config | Initial sensor configuration |
| reset_gpio | Optional GPIO for hardware reset |
| int_gpio | Optional GPIO for interrupt monitoring |
| wake_gpio | Optional GPIO for wake control (SPI mode) |
|
defaultnoexcept |
|
delete |
|
delete |
|
privatenoexcept |
Internal: apply configured sensor enables (assumes mutex is held).
|
noexcept |
Clear sensor event callback.
|
noexcept |
Deinitialize the sensor.
|
noexcept |
Dump comprehensive diagnostics to the logger.
|
noexcept |
Ensure the BNO08x is initialized (lazy init entrypoint).
|
privatenoexcept |
Internal: ensure initialized (assumes mutex is held).
|
inlinestaticnoexcept |
Get default sensor configuration.
|
noexcept |
Get a human-readable description of the handler.
|
inlinenoexcept |
|
inlinenoexcept |
Naming-consistent alias of GetSensor().
|
noexcept |
Get the communication interface type.
|
noexcept |
Get the last driver-level SH-2 error code.
|
noexcept |
Get the last handler error code.
|
noexcept |
|
noexcept |
Get direct access to the underlying sensor driver (type-erased).
The returned pointer exposes the same SH-2 API as the concrete BNO085 driver: Update(), EnableSensor(), DisableSensor(), SetCallback(), HasNewData(), GetLatest(), GetLastError(), HardwareReset(), etc. Use it when you need to call driver methods directly (e.g. custom callbacks, low-level control). Valid for the lifetime of this handler.
|
noexcept |
Initialize the BNO08x sensor.
Performs hardware reset (if GPIO available), calls Begin() on the driver, and applies the initial sensor configuration.
|
noexcept |
Check if sensor is initialized and ready.
|
staticprivatenoexcept |
Internal: map SH-2 error code to Bno08xError.
|
delete |
|
delete |
|
staticnoexcept |
Convert quaternion to Euler angles (roll, pitch, yaw in radians).
| quaternion | Input quaternion (must have valid == true for output) |
| euler_angles | Output: roll, pitch, yaw, accuracy, timestamp, valid |
|
noexcept |
Set callback for sensor events.
The callback is invoked from within Update() whenever a sensor report arrives. Only one callback can be active at a time.
| callback | Callback function for sensor events |
|
noexcept |
Update sensor - must be called regularly to pump the SH-2 service loop.
Call this every 5-10 ms (or faster) for optimal data throughput. Sensor callbacks are dispatched from within this method.
|
inlinenoexcept |
Visit the underlying IMU driver under handler mutex protection.
|
private |
Current configuration.
|
private |
Description string.
|
private |
Type-erased driver.
|
mutableprivate |
Thread safety mutex.
|
private |
Initialization state.
|
private |
I2C or SPI.
|
mutableprivate |
Last error.
|
private |
User's sensor callback.