HardFOC Vortex V1 HAL
Unified HAL API for the HardFOC Vortex motor-control platform (ESP32-C6, TMC9660)
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
EncoderManager.h File Reference

Encoder device management for the HardFOC Vortex V1 platform. More...

#include <array>
#include <atomic>
#include <optional>
#include "RtosMutex.h"
#include "handlers/as5047u/As5047uHandler.h"
Include dependency graph for EncoderManager.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  EncoderFieldStrength
 Magnet field readings of one AS5047U (see EncoderManager::ReadFieldStrength()). More...
 
struct  EncoderSystemDiagnostics
 System-level diagnostics snapshot for encoder health monitoring. More...
 
struct  EncoderSystemDiagnostics::DeviceSnapshot
 Per-device health snapshot. More...
 
class  EncoderManager
 Singleton for managing multiple AS5047U encoder devices with indexed access. More...
 

Typedefs

using As5047uError = EncoderError
 Backward-compatible alias for EncoderError.
 

Enumerations

enum class  EncoderError : uint8_t {
  SUCCESS = 0 , NOT_INITIALIZED , INITIALIZATION_FAILED , INVALID_PARAMETER ,
  SPI_COMMUNICATION_FAILED , CRC_ERROR , FRAMING_ERROR , SENSOR_ERROR ,
  TIMEOUT , MUTEX_LOCK_FAILED
}
 Generic encoder manager error codes. More...
 

Functions

constexpr const char * EncoderErrorToString (EncoderError error) noexcept
 Convert EncoderError to a human-readable string.
 
constexpr const char * As5047uErrorToString (As5047uError error) noexcept
 Backward-compatible helper — calls EncoderErrorToString().
 
EncoderManager & GetEncoderManager () noexcept
 Convenience accessor — equivalent to EncoderManager::GetInstance().
 

Detailed Description

Encoder device management for the HardFOC Vortex V1 platform.

Manages up to four AS5047U position encoder devices. The Vortex V1 board has no onboard encoder — all devices are user-provisioned via CreateAs5047uDevice(). The board provides a dedicated SPI CS pin (SpiDeviceId::AS5047U_POSITION_ENCODER, GPIO 20) plus two external CS slots that can each host an AS5047U or other SPI sensor.

Version
2.1

Typedef Documentation

◆ As5047uError

Backward-compatible alias for EncoderError.

Enumeration Type Documentation

◆ EncoderError

enum class EncoderError : uint8_t
strong

Generic encoder manager error codes.

These are manager-layer errors and are intentionally encoder-family agnostic. Handler/driver internals keep native driver error flags and are translated into this common manager error domain.

Enumerator
SUCCESS 

Operation completed successfully.

NOT_INITIALIZED 

Manager not yet initialised.

INITIALIZATION_FAILED 

Device initialisation failed.

INVALID_PARAMETER 

Null pointer or out-of-range argument.

SPI_COMMUNICATION_FAILED 

SPI bus transfer failed.

CRC_ERROR 

CRC mismatch on SPI frame.

FRAMING_ERROR 

Malformed SPI frame received.

SENSOR_ERROR 

Encoder sensor self-test failure.

TIMEOUT 

Operation timed out.

MUTEX_LOCK_FAILED 

RTOS mutex acquire timed out.

Function Documentation

◆ As5047uErrorToString()

constexpr const char * As5047uErrorToString ( As5047uError  error)
constexprnoexcept

Backward-compatible helper — calls EncoderErrorToString().

Parameters
errorError code to convert.
Returns
Null-terminated string representation.
Here is the call graph for this function:

◆ EncoderErrorToString()

constexpr const char * EncoderErrorToString ( EncoderError  error)
constexprnoexcept

Convert EncoderError to a human-readable string.

Parameters
errorError code to convert.
Returns
Null-terminated string representation.
Here is the caller graph for this function:

◆ GetEncoderManager()

EncoderManager & GetEncoderManager ( )
inlinenoexcept

Convenience accessor — equivalent to EncoderManager::GetInstance().

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