HardFOC Vortex V1 HAL
Unified HAL API for the HardFOC Vortex motor-control platform (ESP32-C6, TMC9660)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ImuManager Class Reference

Singleton for managing multiple IMU devices with indexed access and flexible device management. More...

#include <ImuManager.h>

Collaboration diagram for ImuManager:
[legend]

Public Member Functions

bool EnsureInitialized () noexcept
 Ensure the IMU manager system is initialized.
 
bool IsInitialized () const noexcept
 Check if the IMU manager is initialized.
 
ImuError GetLastError () const noexcept
 Get the most recent error code.
 
ImuError GetSystemDiagnostics (ImuSystemDiagnostics &diagnostics) const noexcept
 Fill a diagnostics snapshot with current system state.
 
bool Deinitialize () noexcept
 Deinitialize all IMUs and release resources.
 
Bno08xHandler * GetBno08xHandler (uint8_t deviceIndex=ONBOARD_IMU_INDEX) noexcept
 Get access to BNO08x IMU handler by device index.
 
template<typename Fn >
bool VisitSensor (uint8_t deviceIndex, Fn &&fn) noexcept
 Run fn on the BNO08x driver of one initialised device, under both locks.
 
ImuError CreateExternalBno08xDevice (uint8_t deviceIndex, uint8_t i2c_address, uint32_t i2c_speed_hz=400000, const Bno08xConfig &config=Bno08xHandler::GetDefaultConfig()) noexcept
 Create an external BNO08x IMU device on I2C interface with specified address.
 
ImuError CreateExternalBno08xDevice (uint8_t deviceIndex, SpiDeviceId spiDeviceId, const Bno08xConfig &config=Bno08xHandler::GetDefaultConfig()) noexcept
 Create an external BNO08x IMU device on SPI interface.
 
ImuError CreateExternalBno08xDevice (uint8_t deviceIndex, BaseI2c &i2c_interface, const Bno08xConfig &config=Bno08xHandler::GetDefaultConfig()) noexcept
 Create an external BNO08x IMU device using direct BaseI2c interface.
 
ImuError CreateExternalBno08xDevice (uint8_t deviceIndex, BaseSpi &spi_interface, const Bno08xConfig &config=Bno08xHandler::GetDefaultConfig()) noexcept
 Create an external BNO08x IMU device using direct BaseSpi interface.
 
ImuError DeleteExternalDevice (uint8_t deviceIndex) noexcept
 Delete an external IMU device.
 
uint8_t GetDeviceCount () const noexcept
 Get the number of active IMU devices.
 
bool IsDeviceValid (uint8_t deviceIndex) const noexcept
 Check if a device index is valid and has an active device.
 
bool IsExternalSlotAvailable (uint8_t deviceIndex) const noexcept
 Check if an external device slot is available for creation.
 
void GetActiveDeviceIndices (std::array< uint8_t, MAX_IMU_DEVICES > &out, size_t &count) const noexcept
 Get indices of all active IMU devices.
 
size_t InitializeAllDevices (std::array< bool, MAX_IMU_DEVICES > &results) noexcept
 Initialize all active IMU devices.
 
void GetInitializationStatus (std::array< bool, MAX_IMU_DEVICES > &status) const noexcept
 Get initialization status of all device slots.
 
void GetAvailableDevices (std::array< const char *, MAX_IMU_DEVICES > &out, size_t &count) const noexcept
 Get human-readable names of all available IMU devices.
 
const char * GetDeviceType (uint8_t deviceIndex) const noexcept
 Get device type by index.
 
bool ConfigureInterrupt (uint8_t deviceIndex, ImuInterruptCallback callback=nullptr, void *user_data=nullptr) noexcept
 Configure GPIO interrupt for BNO08x INT pin on specific device.
 
bool EnableInterrupt (uint8_t deviceIndex) noexcept
 Enable BNO08x GPIO interrupt for specific device.
 
bool DisableInterrupt (uint8_t deviceIndex) noexcept
 Disable BNO08x GPIO interrupt for specific device.
 
bool IsInterruptEnabled (uint8_t deviceIndex) const noexcept
 Check if interrupt is configured and enabled for specific device.
 
bool WaitForInterrupt (uint8_t deviceIndex, uint32_t timeout_ms=0) noexcept
 Wait for interrupt signal with timeout for specific device.
 
uint32_t GetInterruptCount (uint8_t deviceIndex) const noexcept
 Get interrupt statistics for monitoring for specific device.
 
void DumpStatistics () const noexcept
 Dump comprehensive system statistics to log as INFO level. Logs all device statistics, interrupt counts, and system health information.
 
 ImuManager (const ImuManager &)=delete
 
ImuManager & operator= (const ImuManager &)=delete
 
 ImuManager (ImuManager &&)=delete
 
ImuManager & operator= (ImuManager &&)=delete
 

Static Public Member Functions

static ImuManager & GetInstance () noexcept
 Get the singleton instance of ImuManager.
 

Static Public Attributes

static constexpr uint8_t MAX_IMU_DEVICES = 4
 Maximum supported IMU devices.
 
static constexpr uint8_t ONBOARD_IMU_INDEX = 0
 Onboard IMU device index (BNO08x)
 
static constexpr uint8_t EXTERNAL_IMU_1_INDEX = 1
 External IMU device 1 index.
 
static constexpr uint8_t EXTERNAL_IMU_2_INDEX = 2
 External IMU device 2 index.
 
static constexpr uint8_t EXTERNAL_IMU_3_INDEX = 3
 External IMU device 3 index.
 

Private Member Functions

 ImuManager () noexcept
 Private constructor for singleton pattern.
 
 ~ImuManager () noexcept
 Private destructor.
 
bool Initialize () noexcept
 Initialize the IMU manager system.
 
bool InitializeOnboardBno08xDevice () noexcept
 Initialize the onboard BNO08x IMU device with I2C transport.
 
bool InitializeInterruptGpio () noexcept
 Initialize GPIO interrupt for BNO08x INT pin.
 
bool IsExternalDeviceIndex (uint8_t deviceIndex) const noexcept
 Validate if device index is for external device.
 
void UpdateLastError (ImuError error, int deviceIndex=-1) noexcept
 Store a new error code and update per-device counter.
 

Static Private Member Functions

static void GpioInterruptHandler (BaseGpio *gpio, hf_gpio_interrupt_trigger_t trigger, void *user_data) noexcept
 GPIO interrupt handler for BNO08x INT pin.
 

Private Attributes

std::atomic< bool > initialized_ {false}
 System initialization state (atomic for thread safety).
 
std::atomic< ImuError > last_error_ {ImuError::SUCCESS}
 Most recent error code for system-level tracking.
 
std::array< std::atomic< uint32_t >, MAX_IMU_DEVICES > device_error_counts_ {}
 Per-device cumulative error counters.
 
RtosMutex manager_mutex_
 Main system mutex for thread-safe operations. Uses RtosMutex for embedded RTOS compatibility.
 
std::array< std::optional< Bno08xHandler >, MAX_IMU_DEVICES > bno08x_handlers_
 Array of BNO08x IMU handlers (one per device slot). Uses unique_ptr for exclusive ownership of each handler. Protected by RtosMutex for thread-safe access.
 
std::array< bool, MAX_IMU_DEVICES > device_initialized_
 Device initialization status tracking. Tracks which devices have been successfully initialized.
 
std::array< bool, MAX_IMU_DEVICES > device_active_
 Device active status tracking. Tracks which device slots have active devices.
 
bool onboard_device_created_ = false
 Onboard device creation tracking. Tracks if onboard device has been created.
 
std::array< int, MAX_IMU_DEVICES > i2c_device_indices_
 Track I2C device indices created by ImuManager for proper cleanup. This is needed because external I2C devices are managed by ImuManager, but their actual I2C handles are managed by CommChannelsManager. We need to keep track of which external I2C devices were created by ImuManager to ensure they are deleted when the ImuManager is deinitialized.
 
CommChannelsManager * comm_manager_ = nullptr
 Reference to communication manager for I2C/SPI access. Used for creating IMU devices with proper transport interfaces.
 
GpioManager * gpio_manager_ = nullptr
 Reference to GPIO manager for interrupt pin access. Used for configuring interrupt pins for IMU devices.
 
BaseGpio * onboard_bno_reset_gpio_ {nullptr}
 PCAL95555 nets for onboard BNO08x (Vortex): RSTN, BOOTN, INT — kept alive for handler lifetime.
 
BaseGpio * onboard_bno_boot_gpio_ {nullptr}
 
BaseGpio * onboard_bno_int_gpio_ {nullptr}
 
BaseGpio * interrupt_gpio_ = nullptr
 GPIO interrupt support for onboard device. External devices may have their own interrupt configurations.
 
ImuInterruptCallback interrupt_callback_ {nullptr}
 Plain function pointer (no heap)
 
void * interrupt_callback_user_ {nullptr}
 
bool interrupt_configured_ = false
 
bool interrupt_enabled_ = false
 
std::atomic< uint32_t > interrupt_count_ {0}
 
SignalSemaphore interrupt_semaphore_ {"VxImuInt"}
 Signalled per INT edge; WaitForInterrupt() takes it.
 
bool interrupt_semaphore_ready_ = false
 

Detailed Description

Singleton for managing multiple IMU devices with indexed access and flexible device management.

This manager provides a global singleton for managing IMU devices, following the same pattern as MotorController:

Key Features:

Device Indexing:

Usage Example:

auto& imu_mgr = ImuManager::GetInstance();
if (imu_mgr.EnsureInitialized()) {
// Configure the onboard BNO08x (index 0); the driver call runs under the
// manager and handler locks.
imu_mgr.VisitSensor(0, [](IBno08xDriverOps& sensor) {
sensor.EnableSensor(BNO085Sensor::RotationVector, 50, 0.0f);
});
// Create an external BNO08x (index 1) at 0x4B with runtime I2C device creation
if (imu_mgr.CreateExternalBno08xDevice(1, 0x4B, 400000) == ImuError::SUCCESS) {
imu_mgr.VisitSensor(1, [](IBno08xDriverOps& sensor) {
sensor.EnableSensor(BNO085Sensor::Accelerometer, 100, 0.0f);
});
}
}
@ SUCCESS
Operation completed successfully.
static ImuManager & GetInstance() noexcept
Get the singleton instance of ImuManager.
Definition ImuManager.cpp:33
Note
This manager follows the same architectural excellence as MotorController for consistent device management across the HardFOC system.

Constructor & Destructor Documentation

◆ ImuManager() [1/3]

ImuManager::ImuManager ( const ImuManager &  )
delete

◆ ImuManager() [2/3]

ImuManager::ImuManager ( ImuManager &&  )
delete

◆ ImuManager() [3/3]

ImuManager::ImuManager ( )
privatenoexcept

Private constructor for singleton pattern.

◆ ~ImuManager()

ImuManager::~ImuManager ( )
privatenoexcept

Private destructor.

Here is the call graph for this function:

Member Function Documentation

◆ ConfigureInterrupt()

bool ImuManager::ConfigureInterrupt ( uint8_t  deviceIndex,
ImuInterruptCallback  callback = nullptr,
void *  user_data = nullptr 
)
noexcept

Configure GPIO interrupt for BNO08x INT pin on specific device.

Parameters
deviceIndexDevice index (0=onboard, 1-3=external)
callbackOptional callback function executed in interrupt context (keep minimal)
Returns
true if interrupt configuration successful, false otherwise
Note
Uses PCAL_IMU_INT functional pin through GpioManager for onboard device
External devices may use different interrupt pins

◆ CreateExternalBno08xDevice() [1/4]

ImuError ImuManager::CreateExternalBno08xDevice ( uint8_t  deviceIndex,
BaseI2c &  i2c_interface,
const Bno08xConfig &  config = Bno08xHandler::GetDefaultConfig() 
)
noexcept

Create an external BNO08x IMU device using direct BaseI2c interface.

Parameters
deviceIndexExternal device index (1, 2, or 3 only)
i2c_interfaceDirect reference to BaseI2c interface
configOptional BNO08x configuration (defaults to default config)
Returns
ImuError::SUCCESS if device created, typed error otherwise
Note
This is the most flexible method - allows any external I2C interface

◆ CreateExternalBno08xDevice() [2/4]

ImuError ImuManager::CreateExternalBno08xDevice ( uint8_t  deviceIndex,
BaseSpi &  spi_interface,
const Bno08xConfig &  config = Bno08xHandler::GetDefaultConfig() 
)
noexcept

Create an external BNO08x IMU device using direct BaseSpi interface.

Parameters
deviceIndexExternal device index (1, 2, or 3 only)
spi_interfaceDirect reference to BaseSpi interface
configOptional BNO08x configuration (defaults to default config)
Returns
ImuError::SUCCESS if device created, typed error otherwise
Note
This is the most flexible method - allows any external SPI interface

◆ CreateExternalBno08xDevice() [3/4]

ImuError ImuManager::CreateExternalBno08xDevice ( uint8_t  deviceIndex,
SpiDeviceId  spiDeviceId,
const Bno08xConfig &  config = Bno08xHandler::GetDefaultConfig() 
)
noexcept

Create an external BNO08x IMU device on SPI interface.

Parameters
deviceIndexExternal device index (1, 2, or 3 only)
spiDeviceIdSPI device ID for communication
configOptional BNO08x configuration (defaults to default config)
Returns
ImuError::SUCCESS if device created, typed error otherwise

◆ CreateExternalBno08xDevice() [4/4]

ImuError ImuManager::CreateExternalBno08xDevice ( uint8_t  deviceIndex,
uint8_t  i2c_address,
uint32_t  i2c_speed_hz = 400000,
const Bno08xConfig &  config = Bno08xHandler::GetDefaultConfig() 
)
noexcept

Create an external BNO08x IMU device on I2C interface with specified address.

Parameters
deviceIndexExternal device index (1, 2, or 3 only)
i2c_address7-bit I2C device address (0x08-0x77)
i2c_speed_hzI2C speed in Hz (default: 400000 for 400kHz)
configOptional BNO08x configuration (defaults to default config)
Returns
ImuError::SUCCESS if device created, typed error otherwise
Note
This method handles both I2C device creation and BNO08x handler creation internally

◆ Deinitialize()

bool ImuManager::Deinitialize ( )
noexcept

Deinitialize all IMUs and release resources.

Returns
true if deinitialized successfully, false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DeleteExternalDevice()

ImuError ImuManager::DeleteExternalDevice ( uint8_t  deviceIndex)
noexcept

Delete an external IMU device.

Parameters
deviceIndexExternal device index (1, 2, or 3 only)
Returns
ImuError::SUCCESS if device deleted, typed error otherwise
Note
Cannot delete onboard device (index 0). Only external devices can be deleted.

◆ DisableInterrupt()

bool ImuManager::DisableInterrupt ( uint8_t  deviceIndex)
noexcept

Disable BNO08x GPIO interrupt for specific device.

Parameters
deviceIndexDevice index (0=onboard, 1-3=external)
Returns
true if interrupt disabled successfully, false otherwise
Here is the caller graph for this function:

◆ DumpStatistics()

void ImuManager::DumpStatistics ( ) const
noexcept

Dump comprehensive system statistics to log as INFO level. Logs all device statistics, interrupt counts, and system health information.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnableInterrupt()

bool ImuManager::EnableInterrupt ( uint8_t  deviceIndex)
noexcept

Enable BNO08x GPIO interrupt for specific device.

Parameters
deviceIndexDevice index (0=onboard, 1-3=external)
Returns
true if interrupt enabled successfully, false otherwise
Note
Must call ConfigureInterrupt() first

◆ EnsureInitialized()

bool ImuManager::EnsureInitialized ( )
noexcept

Ensure the IMU manager system is initialized.

Note
This automatically creates the onboard BNO08x IMU device using CommChannelsManager
Returns
true if initialization successful, false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetActiveDeviceIndices()

void ImuManager::GetActiveDeviceIndices ( std::array< uint8_t, MAX_IMU_DEVICES > &  out,
size_t &  count 
) const
noexcept

Get indices of all active IMU devices.

Parameters
outFixed-size output array
countOutput: number of entries written

◆ GetAvailableDevices()

void ImuManager::GetAvailableDevices ( std::array< const char *, MAX_IMU_DEVICES > &  out,
size_t &  count 
) const
noexcept

Get human-readable names of all available IMU devices.

Parameters
outFixed-size output array of const char* string literals
countOutput: number of entries written

◆ GetBno08xHandler()

Bno08xHandler * ImuManager::GetBno08xHandler ( uint8_t  deviceIndex = ONBOARD_IMU_INDEX)
noexcept

Get access to BNO08x IMU handler by device index.

Parameters
deviceIndexDevice index (0=onboard, 1-3=external)
Returns
Pointer to Bno08xHandler if valid and active, nullptr otherwise
Note
Returns nullptr if deviceIndex is invalid, device not active, or not initialized

◆ GetDeviceCount()

uint8_t ImuManager::GetDeviceCount ( ) const
noexcept

Get the number of active IMU devices.

Returns
Number of active devices (1 to MAX_IMU_DEVICES)
Note
Always includes onboard device, plus any active external devices
Here is the caller graph for this function:

◆ GetDeviceType()

const char * ImuManager::GetDeviceType ( uint8_t  deviceIndex) const
noexcept

Get device type by index.

Parameters
deviceIndexDevice index
Returns
Device type string literal or nullptr if invalid

◆ GetInitializationStatus()

void ImuManager::GetInitializationStatus ( std::array< bool, MAX_IMU_DEVICES > &  status) const
noexcept

Get initialization status of all device slots.

Parameters
statusOutput: per-slot status

◆ GetInstance()

ImuManager & ImuManager::GetInstance ( )
staticnoexcept

Get the singleton instance of ImuManager.

Returns
Reference to the singleton ImuManager.
Here is the caller graph for this function:

◆ GetInterruptCount()

uint32_t ImuManager::GetInterruptCount ( uint8_t  deviceIndex) const
noexcept

Get interrupt statistics for monitoring for specific device.

Parameters
deviceIndexDevice index (0=onboard, 1-3=external)
Returns
Number of interrupts processed since initialization
Here is the caller graph for this function:

◆ GetLastError()

ImuError ImuManager::GetLastError ( ) const
inlinenoexcept

Get the most recent error code.

Returns
Last ImuError set by any API call

◆ GetSystemDiagnostics()

ImuError ImuManager::GetSystemDiagnostics ( ImuSystemDiagnostics &  diagnostics) const
noexcept

Fill a diagnostics snapshot with current system state.

Parameters
diagnosticsOutput structure to populate
Returns
ImuError::SUCCESS on success, ImuError::NOT_INITIALIZED if not init

◆ GpioInterruptHandler()

void ImuManager::GpioInterruptHandler ( BaseGpio *  gpio,
hf_gpio_interrupt_trigger_t  trigger,
void *  user_data 
)
staticprivatenoexcept

GPIO interrupt handler for BNO08x INT pin.

Parameters
gpioPointer to the GPIO that triggered interrupt
triggerInterrupt trigger type
user_dataPointer to user data (ImuManager instance)

◆ Initialize()

bool ImuManager::Initialize ( )
privatenoexcept

Initialize the IMU manager system.

Note
This automatically creates the onboard BNO08x IMU device using CommChannelsManager
Returns
true if initialization successful, false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitializeAllDevices()

size_t ImuManager::InitializeAllDevices ( std::array< bool, MAX_IMU_DEVICES > &  results)
noexcept

Initialize all active IMU devices.

Parameters
resultsOutput: per-slot initialization result
Returns
Number of devices successfully initialized

◆ InitializeInterruptGpio()

bool ImuManager::InitializeInterruptGpio ( )
privatenoexcept

Initialize GPIO interrupt for BNO08x INT pin.

Returns
true if GPIO setup successful, false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitializeOnboardBno08xDevice()

bool ImuManager::InitializeOnboardBno08xDevice ( )
privatenoexcept

Initialize the onboard BNO08x IMU device with I2C transport.

Returns
true if initialization successful, false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsDeviceValid()

bool ImuManager::IsDeviceValid ( uint8_t  deviceIndex) const
noexcept

Check if a device index is valid and has an active device.

Parameters
deviceIndexDevice index to check
Returns
true if device exists and is active, false otherwise

◆ IsExternalDeviceIndex()

bool ImuManager::IsExternalDeviceIndex ( uint8_t  deviceIndex) const
privatenoexcept

Validate if device index is for external device.

Parameters
deviceIndexDevice index to validate
Returns
true if index is for external device (1, 2, or 3), false otherwise

◆ IsExternalSlotAvailable()

bool ImuManager::IsExternalSlotAvailable ( uint8_t  deviceIndex) const
noexcept

Check if an external device slot is available for creation.

Parameters
deviceIndexExternal device index (1, 2, or 3 only)
Returns
true if slot is available, false if occupied or invalid index

◆ IsInitialized()

bool ImuManager::IsInitialized ( ) const
noexcept

Check if the IMU manager is initialized.

Returns
true if initialized, false otherwise

◆ IsInterruptEnabled()

bool ImuManager::IsInterruptEnabled ( uint8_t  deviceIndex) const
noexcept

Check if interrupt is configured and enabled for specific device.

Parameters
deviceIndexDevice index (0=onboard, 1-3=external)
Returns
true if interrupt is active, false otherwise

◆ operator=() [1/2]

ImuManager & ImuManager::operator= ( const ImuManager &  )
delete

◆ operator=() [2/2]

ImuManager & ImuManager::operator= ( ImuManager &&  )
delete

◆ UpdateLastError()

void ImuManager::UpdateLastError ( ImuError  error,
int  deviceIndex = -1 
)
privatenoexcept

Store a new error code and update per-device counter.

Parameters
errorThe error to record
deviceIndexOptional device index to bump its error counter
Here is the caller graph for this function:

◆ VisitSensor()

template<typename Fn >
bool ImuManager::VisitSensor ( uint8_t  deviceIndex,
Fn &&  fn 
)
inlinenoexcept

Run fn on the BNO08x driver of one initialised device, under both locks.

Holds the manager lock (the device cannot be deleted) and the handler lock (no other task talks to this BNO08x) for the whole call. Use it for driver calls the manager does not wrap: Update(), EnableSensor(), HasNewData(), GetLatest(), ... This replaces the raw GetSensor() pointer, which bypassed the handler mutex.

Parameters
deviceIndexDevice index (0=onboard, 1-3=external)
fnCallable taking IBno08xDriverOps&.
Returns
true if fn ran; false if the device is absent or not initialised.

◆ WaitForInterrupt()

bool ImuManager::WaitForInterrupt ( uint8_t  deviceIndex,
uint32_t  timeout_ms = 0 
)
noexcept

Wait for interrupt signal with timeout for specific device.

Parameters
deviceIndexDevice index (0=onboard, 1-3=external)
timeout_msTimeout in milliseconds (0 = wait indefinitely)
Returns
true if interrupt occurred, false on timeout
Note
Useful for interrupt-driven processing in tasks

Member Data Documentation

◆ bno08x_handlers_

std::array<std::optional<Bno08xHandler>, MAX_IMU_DEVICES> ImuManager::bno08x_handlers_
private

Array of BNO08x IMU handlers (one per device slot). Uses unique_ptr for exclusive ownership of each handler. Protected by RtosMutex for thread-safe access.

Handlers in place (no heap): emplaced on create, reset on delete/deinit.

◆ comm_manager_

CommChannelsManager* ImuManager::comm_manager_ = nullptr
private

Reference to communication manager for I2C/SPI access. Used for creating IMU devices with proper transport interfaces.

◆ device_active_

std::array<bool, MAX_IMU_DEVICES> ImuManager::device_active_
private

Device active status tracking. Tracks which device slots have active devices.

◆ device_error_counts_

std::array<std::atomic<uint32_t>, MAX_IMU_DEVICES> ImuManager::device_error_counts_ {}
private

Per-device cumulative error counters.

◆ device_initialized_

std::array<bool, MAX_IMU_DEVICES> ImuManager::device_initialized_
private

Device initialization status tracking. Tracks which devices have been successfully initialized.

◆ EXTERNAL_IMU_1_INDEX

constexpr uint8_t ImuManager::EXTERNAL_IMU_1_INDEX = 1
staticconstexpr

External IMU device 1 index.

◆ EXTERNAL_IMU_2_INDEX

constexpr uint8_t ImuManager::EXTERNAL_IMU_2_INDEX = 2
staticconstexpr

External IMU device 2 index.

◆ EXTERNAL_IMU_3_INDEX

constexpr uint8_t ImuManager::EXTERNAL_IMU_3_INDEX = 3
staticconstexpr

External IMU device 3 index.

◆ gpio_manager_

GpioManager* ImuManager::gpio_manager_ = nullptr
private

Reference to GPIO manager for interrupt pin access. Used for configuring interrupt pins for IMU devices.

◆ i2c_device_indices_

std::array<int, MAX_IMU_DEVICES> ImuManager::i2c_device_indices_
private

Track I2C device indices created by ImuManager for proper cleanup. This is needed because external I2C devices are managed by ImuManager, but their actual I2C handles are managed by CommChannelsManager. We need to keep track of which external I2C devices were created by ImuManager to ensure they are deleted when the ImuManager is deinitialized.

◆ initialized_

std::atomic<bool> ImuManager::initialized_ {false}
private

System initialization state (atomic for thread safety).

◆ interrupt_callback_

ImuInterruptCallback ImuManager::interrupt_callback_ {nullptr}
private

Plain function pointer (no heap)

◆ interrupt_callback_user_

void* ImuManager::interrupt_callback_user_ {nullptr}
private

◆ interrupt_configured_

bool ImuManager::interrupt_configured_ = false
private

◆ interrupt_count_

std::atomic<uint32_t> ImuManager::interrupt_count_ {0}
private

◆ interrupt_enabled_

bool ImuManager::interrupt_enabled_ = false
private

◆ interrupt_gpio_

BaseGpio* ImuManager::interrupt_gpio_ = nullptr
private

GPIO interrupt support for onboard device. External devices may have their own interrupt configurations.

Raw pointer for compatibility

◆ interrupt_semaphore_

SignalSemaphore ImuManager::interrupt_semaphore_ {"VxImuInt"}
private

Signalled per INT edge; WaitForInterrupt() takes it.

◆ interrupt_semaphore_ready_

bool ImuManager::interrupt_semaphore_ready_ = false
private

◆ last_error_

std::atomic<ImuError> ImuManager::last_error_ {ImuError::SUCCESS}
private

Most recent error code for system-level tracking.

◆ manager_mutex_

RtosMutex ImuManager::manager_mutex_
mutableprivate

Main system mutex for thread-safe operations. Uses RtosMutex for embedded RTOS compatibility.

◆ MAX_IMU_DEVICES

constexpr uint8_t ImuManager::MAX_IMU_DEVICES = 4
staticconstexpr

Maximum supported IMU devices.

◆ onboard_bno_boot_gpio_

BaseGpio* ImuManager::onboard_bno_boot_gpio_ {nullptr}
private

◆ onboard_bno_int_gpio_

BaseGpio* ImuManager::onboard_bno_int_gpio_ {nullptr}
private

◆ onboard_bno_reset_gpio_

BaseGpio* ImuManager::onboard_bno_reset_gpio_ {nullptr}
private

PCAL95555 nets for onboard BNO08x (Vortex): RSTN, BOOTN, INT — kept alive for handler lifetime.

◆ onboard_device_created_

bool ImuManager::onboard_device_created_ = false
private

Onboard device creation tracking. Tracks if onboard device has been created.

◆ ONBOARD_IMU_INDEX

constexpr uint8_t ImuManager::ONBOARD_IMU_INDEX = 0
staticconstexpr

Onboard IMU device index (BNO08x)


The documentation for this class was generated from the following files: