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
EncoderManager Class Reference

Singleton for managing multiple AS5047U encoder devices with indexed access. More...

#include <EncoderManager.h>

Collaboration diagram for EncoderManager:
[legend]

Public Member Functions

bool EnsureInitialized () noexcept
 Ensure the encoder manager system is initialized.
 
bool IsInitialized () const noexcept
 Check if the encoder manager is initialized.
 
EncoderError GetLastError () const noexcept
 Get the most recent error code.
 
EncoderError GetSystemDiagnostics (EncoderSystemDiagnostics &diagnostics) const noexcept
 Fill a diagnostics snapshot with current system state.
 
bool Deinitialize () noexcept
 Deinitialize all encoders and release resources.
 
As5047uHandler * GetAs5047uHandler (uint8_t deviceIndex=ENCODER_SLOT_0) noexcept
 Get access to AS5047U encoder handler by device index.
 
template<typename Fn >
bool VisitDriver (uint8_t deviceIndex, Fn &&fn) noexcept
 Run fn on the AS5047U driver of one initialised slot, under both locks.
 
bool CreateAs5047uDevice (uint8_t deviceIndex, SpiDeviceId spiDeviceId, const As5047uConfig &config=As5047uHandler::GetDefaultConfig()) noexcept
 Create an AS5047U encoder device on a given SPI device slot.
 
bool CreateAs5047uDevice (uint8_t deviceIndex, BaseSpi &spi_interface, const As5047uConfig &config=As5047uHandler::GetDefaultConfig()) noexcept
 Create an AS5047U encoder device using a direct BaseSpi interface.
 
bool CreateExternalAs5047uDevice (uint8_t deviceIndex, SpiDeviceId spiDeviceId, const As5047uConfig &config=As5047uHandler::GetDefaultConfig()) noexcept
 
bool CreateExternalAs5047uDevice (uint8_t deviceIndex, BaseSpi &spi_interface, const As5047uConfig &config=As5047uHandler::GetDefaultConfig()) noexcept
 
bool DeleteDevice (uint8_t deviceIndex) noexcept
 Delete an encoder device and free its slot.
 
bool DeleteExternalDevice (uint8_t deviceIndex) noexcept
 
uint8_t GetDeviceCount () const noexcept
 Get the number of active encoder 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_ENCODER_DEVICES > &out, size_t &count) const noexcept
 Get indices of all active encoder devices.
 
size_t InitializeAllDevices (std::array< bool, MAX_ENCODER_DEVICES > &results) noexcept
 Initialize all active encoder devices.
 
void GetInitializationStatus (std::array< bool, MAX_ENCODER_DEVICES > &status) const noexcept
 Get initialization status of all device slots.
 
void GetAvailableDevices (std::array< const char *, MAX_ENCODER_DEVICES > &out, size_t &count) const noexcept
 Get human-readable names of all available devices.
 
const char * GetDeviceType (uint8_t deviceIndex) const noexcept
 Get device type by index.
 
EncoderError ReadAngle (uint8_t deviceIndex, uint16_t &angle) noexcept
 Read angle from specific encoder device.
 
EncoderError ReadAngleDegrees (uint8_t deviceIndex, double &angle_degrees) noexcept
 Read angle in degrees from specific encoder device.
 
EncoderError ReadVelocityRPM (uint8_t deviceIndex, double &velocity_rpm) noexcept
 Read velocity from specific encoder device.
 
EncoderError ReadDiagnostics (uint8_t deviceIndex, As5047uDiagnostics &diagnostics) noexcept
 Read diagnostics from specific encoder device.
 
EncoderError ReadFieldStrength (uint8_t deviceIndex, EncoderFieldStrength &field) noexcept
 Read the AGC value and the CORDIC magnitude (magnet field strength) of one encoder.
 
EncoderError SetZeroPosition (uint8_t deviceIndex, uint16_t zero_position) noexcept
 Set zero position for specific encoder device.
 
void ReadAllAngles (std::array< uint16_t, MAX_ENCODER_DEVICES > &angles, std::array< uint8_t, MAX_ENCODER_DEVICES > &device_indices, std::array< EncoderError, MAX_ENCODER_DEVICES > &errors, size_t &count) noexcept
 Read angles from all active encoder devices.
 
void ReadAllVelocities (std::array< double, MAX_ENCODER_DEVICES > &velocities_rpm, std::array< uint8_t, MAX_ENCODER_DEVICES > &device_indices, std::array< EncoderError, MAX_ENCODER_DEVICES > &errors, size_t &count) noexcept
 Read velocities from all active encoder devices.
 
bool CheckAllDevicesHealth () noexcept
 Check health status of all active encoder devices.
 
uint32_t GetMeasurementCount (uint8_t deviceIndex) const noexcept
 Get measurement statistics for monitoring specific device.
 
uint32_t GetCommunicationErrorCount (uint8_t deviceIndex) const noexcept
 Get communication error count 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.
 
 EncoderManager (const EncoderManager &)=delete
 
EncoderManager & operator= (const EncoderManager &)=delete
 
 EncoderManager (EncoderManager &&)=delete
 
EncoderManager & operator= (EncoderManager &&)=delete
 

Static Public Member Functions

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

Static Public Attributes

static constexpr uint8_t MAX_ENCODER_DEVICES = 4
 Maximum supported AS5047U devices.
 
static constexpr uint8_t ENCODER_SLOT_0 = 0
 
static constexpr uint8_t ENCODER_SLOT_1 = 1
 
static constexpr uint8_t ENCODER_SLOT_2 = 2
 
static constexpr uint8_t ENCODER_SLOT_3 = 3
 
static constexpr uint8_t ONBOARD_ENCODER_INDEX = ENCODER_SLOT_0
 

Private Member Functions

 EncoderManager () noexcept
 Private constructor for singleton pattern.
 
 ~EncoderManager () noexcept
 Private destructor.
 
bool Initialize () noexcept
 Initialize the encoder manager system (no devices auto-created).
 
As5047uHandler * ReadyHandlerLocked (uint8_t deviceIndex) noexcept
 Handler of an active, initialised slot, or nullptr. Caller holds manager_mutex_.
 
EncoderError FinishRead (uint8_t deviceIndex, AS5047U_Error sticky, bool count_measurement) noexcept
 Count a read and map its sticky flags to an error. Caller holds manager_mutex_.
 

Static Private Member Functions

static bool IsValidDeviceIndex (uint8_t deviceIndex) noexcept
 Validate that deviceIndex is within [0, MAX_ENCODER_DEVICES).
 
static EncoderError mapDriverError (AS5047U_Error sticky_flags) noexcept
 Map AS5047U driver sticky error flags to generic EncoderError.
 

Private Attributes

std::atomic< bool > initialized_ {false}
 System initialization state (atomic for thread safety).
 
std::atomic< EncoderError > last_error_ {EncoderError::SUCCESS}
 Most recent error code for system-level tracking.
 
RtosMutex manager_mutex_
 Main system mutex for thread-safe operations. Uses RtosMutex for embedded RTOS compatibility.
 
std::array< std::optional< As5047uHandler >, MAX_ENCODER_DEVICES > as5047u_handlers_
 AS5047U encoder handlers (one per device slot), in place (no heap): emplaced on create, reset on delete/deinit. Protected by manager_mutex_.
 
std::array< bool, MAX_ENCODER_DEVICES > device_initialized_
 Device initialization status tracking. Tracks which devices have been successfully initialized.
 
std::array< bool, MAX_ENCODER_DEVICES > device_active_
 Device active status tracking. Tracks which device slots have active devices.
 
CommChannelsManager * comm_manager_ = nullptr
 Reference to communication manager for SPI access. Used for creating encoder devices with proper transport interfaces.
 
GpioManager * gpio_manager_ = nullptr
 Reference to GPIO manager for interrupt pin access. Used for configuring interrupt pins for encoder devices.
 
std::array< std::atomic< uint32_t >, MAX_ENCODER_DEVICES > measurement_counts_ {0}
 Measurement and error tracking for all devices.
 
std::array< std::atomic< uint32_t >, MAX_ENCODER_DEVICES > communication_error_counts_ {0}
 Communication error counts per device.
 

Detailed Description

Singleton for managing multiple AS5047U encoder devices with indexed access.

The Vortex V1 board has no onboard encoder. All AS5047U devices are user-provisioned at runtime via CreateAs5047uDevice(). The board exposes a dedicated SPI CS line for the encoder (SpiDeviceId::AS5047U_POSITION_ENCODER, GPIO 20) plus two external CS slots — any of them can host an AS5047U.

Key Features:

Usage Example:

enc.EnsureInitialized();
// Create an AS5047U on the dedicated CS pin (slot 0)
enc.CreateAs5047uDevice(0, SpiDeviceId::AS5047U_POSITION_ENCODER);
uint16_t angle;
if (enc.ReadAngle(0, angle) == EncoderError::SUCCESS) {
printf("Angle: %u LSB (%.2f deg)\n",
angle, static_cast<double>(angle) * (360.0 / 16384.0));
}
@ AS5047U_POSITION_ENCODER
AS5047U position encoder (SPI Mode 1)
@ SUCCESS
Operation completed successfully.
static EncoderManager & GetInstance() noexcept
Get the singleton instance of EncoderManager.
Definition EncoderManager.cpp:33

Constructor & Destructor Documentation

◆ EncoderManager() [1/3]

EncoderManager::EncoderManager ( const EncoderManager &  )
delete

◆ EncoderManager() [2/3]

EncoderManager::EncoderManager ( EncoderManager &&  )
delete

◆ EncoderManager() [3/3]

EncoderManager::EncoderManager ( )
privatenoexcept

Private constructor for singleton pattern.

◆ ~EncoderManager()

EncoderManager::~EncoderManager ( )
privatenoexcept

Private destructor.

Here is the call graph for this function:

Member Function Documentation

◆ CheckAllDevicesHealth()

bool EncoderManager::CheckAllDevicesHealth ( )
noexcept

Check health status of all active encoder devices.

Returns
true if all active devices are healthy, false if any have errors
Here is the call graph for this function:

◆ CreateAs5047uDevice() [1/2]

bool EncoderManager::CreateAs5047uDevice ( uint8_t  deviceIndex,
BaseSpi &  spi_interface,
const As5047uConfig &  config = As5047uHandler::GetDefaultConfig() 
)
noexcept

Create an AS5047U encoder device using a direct BaseSpi interface.

Parameters
deviceIndexDevice slot (0–3)
spi_interfaceDirect reference to BaseSpi interface
configOptional AS5047U configuration (defaults to default config)
Returns
true if device created successfully, false otherwise

◆ CreateAs5047uDevice() [2/2]

bool EncoderManager::CreateAs5047uDevice ( uint8_t  deviceIndex,
SpiDeviceId  spiDeviceId,
const As5047uConfig &  config = As5047uHandler::GetDefaultConfig() 
)
noexcept

Create an AS5047U encoder device on a given SPI device slot.

Parameters
deviceIndexDevice slot (0–3)
spiDeviceIdSPI device ID for communication (e.g. AS5047U_POSITION_ENCODER)
configOptional AS5047U configuration (defaults to default config)
Returns
true if device created successfully, false otherwise
Here is the caller graph for this function:

◆ CreateExternalAs5047uDevice() [1/2]

bool EncoderManager::CreateExternalAs5047uDevice ( uint8_t  deviceIndex,
BaseSpi &  spi_interface,
const As5047uConfig &  config = As5047uHandler::GetDefaultConfig() 
)
inlinenoexcept
Deprecated:
Use CreateAs5047uDevice(). Kept for backward compatibility.
Here is the call graph for this function:

◆ CreateExternalAs5047uDevice() [2/2]

bool EncoderManager::CreateExternalAs5047uDevice ( uint8_t  deviceIndex,
SpiDeviceId  spiDeviceId,
const As5047uConfig &  config = As5047uHandler::GetDefaultConfig() 
)
inlinenoexcept
Deprecated:
Use CreateAs5047uDevice(). Kept for backward compatibility.
Here is the call graph for this function:

◆ Deinitialize()

bool EncoderManager::Deinitialize ( )
noexcept

Deinitialize all encoders and release resources.

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

◆ DeleteDevice()

bool EncoderManager::DeleteDevice ( uint8_t  deviceIndex)
noexcept

Delete an encoder device and free its slot.

Parameters
deviceIndexDevice slot (0–3)
Returns
true if device deleted successfully, false otherwise
Here is the caller graph for this function:

◆ DeleteExternalDevice()

bool EncoderManager::DeleteExternalDevice ( uint8_t  deviceIndex)
inlinenoexcept
Deprecated:
Use DeleteDevice(). Kept for backward compatibility.
Here is the call graph for this function:

◆ DumpStatistics()

void EncoderManager::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:

◆ EnsureInitialized()

bool EncoderManager::EnsureInitialized ( )
noexcept

Ensure the encoder manager system is initialized.

Note
No devices are created automatically — call CreateAs5047uDevice() after init.
Returns
true if initialization successful, false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FinishRead()

EncoderError EncoderManager::FinishRead ( uint8_t  deviceIndex,
AS5047U_Error  sticky,
bool  count_measurement 
)
privatenoexcept

Count a read and map its sticky flags to an error. Caller holds manager_mutex_.

◆ GetActiveDeviceIndices()

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

Get indices of all active encoder devices.

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

◆ GetAs5047uHandler()

As5047uHandler * EncoderManager::GetAs5047uHandler ( uint8_t  deviceIndex = ENCODER_SLOT_0)
noexcept

Get access to AS5047U encoder handler by device index.

Parameters
deviceIndexDevice slot (0–3)
Returns
Pointer to As5047uHandler if valid and active, nullptr otherwise

◆ GetAvailableDevices()

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

Get human-readable names of all available devices.

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

◆ GetCommunicationErrorCount()

uint32_t EncoderManager::GetCommunicationErrorCount ( uint8_t  deviceIndex) const
noexcept

Get communication error count for specific device.

Parameters
deviceIndexDevice slot (0–3)
Returns
Number of communication errors since initialization

◆ GetDeviceCount()

uint8_t EncoderManager::GetDeviceCount ( ) const
noexcept

Get the number of active encoder devices.

Returns
Number of active devices (0 to MAX_ENCODER_DEVICES)
Here is the caller graph for this function:

◆ GetDeviceType()

const char * EncoderManager::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 EncoderManager::GetInitializationStatus ( std::array< bool, MAX_ENCODER_DEVICES > &  status) const
noexcept

Get initialization status of all device slots.

Parameters
statusOutput: per-slot status

◆ GetInstance()

EncoderManager & EncoderManager::GetInstance ( )
staticnoexcept

Get the singleton instance of EncoderManager.

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

◆ GetLastError()

EncoderError EncoderManager::GetLastError ( ) const
inlinenoexcept

Get the most recent error code.

Returns
Last EncoderError set by any API call

◆ GetMeasurementCount()

uint32_t EncoderManager::GetMeasurementCount ( uint8_t  deviceIndex) const
noexcept

Get measurement statistics for monitoring specific device.

Parameters
deviceIndexDevice slot (0–3)
Returns
Number of measurements taken since initialization

◆ GetSystemDiagnostics()

EncoderError EncoderManager::GetSystemDiagnostics ( EncoderSystemDiagnostics &  diagnostics) const
noexcept

Fill a diagnostics snapshot with current system state.

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

◆ Initialize()

bool EncoderManager::Initialize ( )
privatenoexcept

Initialize the encoder manager system (no devices auto-created).

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 EncoderManager::InitializeAllDevices ( std::array< bool, MAX_ENCODER_DEVICES > &  results)
noexcept

Initialize all active encoder devices.

Parameters
resultsOutput: per-slot initialization result
Returns
Number of devices successfully initialized
Here is the caller graph for this function:

◆ IsDeviceValid()

bool EncoderManager::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

◆ IsExternalSlotAvailable()

bool EncoderManager::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 EncoderManager::IsInitialized ( ) const
noexcept

Check if the encoder manager is initialized.

Returns
true if initialized, false otherwise

◆ IsValidDeviceIndex()

static bool EncoderManager::IsValidDeviceIndex ( uint8_t  deviceIndex)
inlinestaticprivatenoexcept

Validate that deviceIndex is within [0, MAX_ENCODER_DEVICES).

◆ mapDriverError()

EncoderError EncoderManager::mapDriverError ( AS5047U_Error  sticky_flags)
staticprivatenoexcept

Map AS5047U driver sticky error flags to generic EncoderError.

Parameters
sticky_flagsSticky error flags from AS5047U driver
Returns
Corresponding EncoderError code

◆ operator=() [1/2]

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

◆ operator=() [2/2]

EncoderManager & EncoderManager::operator= ( EncoderManager &&  )
delete

◆ ReadAllAngles()

void EncoderManager::ReadAllAngles ( std::array< uint16_t, MAX_ENCODER_DEVICES > &  angles,
std::array< uint8_t, MAX_ENCODER_DEVICES > &  device_indices,
std::array< EncoderError, MAX_ENCODER_DEVICES > &  errors,
size_t &  count 
)
noexcept

Read angles from all active encoder devices.

Parameters
anglesOutput: per-slot angle readings (only valid where errors[i] == SUCCESS)
device_indicesOutput: indices of active devices
errorsOutput: per-slot error codes
countOutput: number of entries written

◆ ReadAllVelocities()

void EncoderManager::ReadAllVelocities ( std::array< double, MAX_ENCODER_DEVICES > &  velocities_rpm,
std::array< uint8_t, MAX_ENCODER_DEVICES > &  device_indices,
std::array< EncoderError, MAX_ENCODER_DEVICES > &  errors,
size_t &  count 
)
noexcept

Read velocities from all active encoder devices.

Parameters
velocities_rpmOutput: per-slot velocity readings
device_indicesOutput: indices of active devices
errorsOutput: per-slot error codes
countOutput: number of entries written

◆ ReadAngle()

EncoderError EncoderManager::ReadAngle ( uint8_t  deviceIndex,
uint16_t &  angle 
)
noexcept

Read angle from specific encoder device.

Parameters
deviceIndexDevice slot (0–3)
angleOutput angle value (0-16383 LSB, 14-bit)
Returns
EncoderError::SUCCESS if successful

◆ ReadAngleDegrees()

EncoderError EncoderManager::ReadAngleDegrees ( uint8_t  deviceIndex,
double &  angle_degrees 
)
noexcept

Read angle in degrees from specific encoder device.

Parameters
deviceIndexDevice slot (0–3)
angle_degreesOutput angle in degrees (0.0-359.978°)
Returns
EncoderError::SUCCESS if successful

◆ ReadDiagnostics()

EncoderError EncoderManager::ReadDiagnostics ( uint8_t  deviceIndex,
As5047uDiagnostics &  diagnostics 
)
noexcept

Read diagnostics from specific encoder device.

One SPI read of ERRFL (clear-on-read). The counters come from this manager. AGC and magnitude are not part of As5047uDiagnostics; use ReadFieldStrength().

Parameters
deviceIndexDevice slot (0–3)
diagnosticsOutput diagnostic information
Returns
EncoderError::SUCCESS if successful
Here is the caller graph for this function:

◆ ReadFieldStrength()

EncoderError EncoderManager::ReadFieldStrength ( uint8_t  deviceIndex,
EncoderFieldStrength &  field 
)
noexcept

Read the AGC value and the CORDIC magnitude (magnet field strength) of one encoder.

Parameters
deviceIndexDevice slot (0–3)
fieldOutput AGC (0–255) and magnitude (0–16383) readings
Returns
EncoderError::SUCCESS if successful

◆ ReadVelocityRPM()

EncoderError EncoderManager::ReadVelocityRPM ( uint8_t  deviceIndex,
double &  velocity_rpm 
)
noexcept

Read velocity from specific encoder device.

Parameters
deviceIndexDevice slot (0–3)
velocity_rpmOutput velocity in RPM
Returns
EncoderError::SUCCESS if successful

◆ ReadyHandlerLocked()

As5047uHandler * EncoderManager::ReadyHandlerLocked ( uint8_t  deviceIndex)
privatenoexcept

Handler of an active, initialised slot, or nullptr. Caller holds manager_mutex_.

Here is the caller graph for this function:

◆ SetZeroPosition()

EncoderError EncoderManager::SetZeroPosition ( uint8_t  deviceIndex,
uint16_t  zero_position 
)
noexcept

Set zero position for specific encoder device.

Parameters
deviceIndexDevice slot (0–3)
zero_positionZero position in LSB (0-16383)
Returns
EncoderError::SUCCESS if successful

◆ VisitDriver()

template<typename Fn >
bool EncoderManager::VisitDriver ( uint8_t  deviceIndex,
Fn &&  fn 
)
inlinenoexcept

Run fn on the AS5047U driver of one initialised slot, under both locks.

Holds the manager lock (the slot cannot be deleted) and the handler lock (no other task talks to this AS5047U) for the whole call. This replaces the raw driver pointer the manager used to hand out. Keep fn short: it blocks every other encoder call.

Parameters
deviceIndexDevice slot (0–3)
fnCallable taking as5047u::AS5047U<As5047uSpiAdapter>&.
Returns
true if fn ran; false if the slot is empty or not initialised.
Here is the call graph for this function:

Member Data Documentation

◆ as5047u_handlers_

std::array<std::optional<As5047uHandler>, MAX_ENCODER_DEVICES> EncoderManager::as5047u_handlers_
private

AS5047U encoder handlers (one per device slot), in place (no heap): emplaced on create, reset on delete/deinit. Protected by manager_mutex_.

◆ comm_manager_

CommChannelsManager* EncoderManager::comm_manager_ = nullptr
private

Reference to communication manager for SPI access. Used for creating encoder devices with proper transport interfaces.

◆ communication_error_counts_

std::array<std::atomic<uint32_t>, MAX_ENCODER_DEVICES> EncoderManager::communication_error_counts_ {0}
private

Communication error counts per device.

◆ device_active_

std::array<bool, MAX_ENCODER_DEVICES> EncoderManager::device_active_
private

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

◆ device_initialized_

std::array<bool, MAX_ENCODER_DEVICES> EncoderManager::device_initialized_
private

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

◆ ENCODER_SLOT_0

constexpr uint8_t EncoderManager::ENCODER_SLOT_0 = 0
staticconstexpr

◆ ENCODER_SLOT_1

constexpr uint8_t EncoderManager::ENCODER_SLOT_1 = 1
staticconstexpr

◆ ENCODER_SLOT_2

constexpr uint8_t EncoderManager::ENCODER_SLOT_2 = 2
staticconstexpr

◆ ENCODER_SLOT_3

constexpr uint8_t EncoderManager::ENCODER_SLOT_3 = 3
staticconstexpr

◆ gpio_manager_

GpioManager* EncoderManager::gpio_manager_ = nullptr
private

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

◆ initialized_

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

System initialization state (atomic for thread safety).

◆ last_error_

std::atomic<EncoderError> EncoderManager::last_error_ {EncoderError::SUCCESS}
private

Most recent error code for system-level tracking.

◆ manager_mutex_

RtosMutex EncoderManager::manager_mutex_
mutableprivate

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

◆ MAX_ENCODER_DEVICES

constexpr uint8_t EncoderManager::MAX_ENCODER_DEVICES = 4
staticconstexpr

Maximum supported AS5047U devices.

◆ measurement_counts_

std::array<std::atomic<uint32_t>, MAX_ENCODER_DEVICES> EncoderManager::measurement_counts_ {0}
private

Measurement and error tracking for all devices.

Measurement counts per device

◆ ONBOARD_ENCODER_INDEX

constexpr uint8_t EncoderManager::ONBOARD_ENCODER_INDEX = ENCODER_SLOT_0
staticconstexpr
Deprecated:
Use ENCODER_SLOT_0. Kept for backward compatibility.

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