|
HF-Core Platform 0.1.0-dev
Hardware-Agnostic Handler Layer & RTOS Utilities for HardFOC
|
Unified handler for AS5047U magnetic rotary position sensor. More...
#include <As5047uHandler.h>
Public Member Functions | |
| As5047uHandler (BaseSpi &spi_interface, const As5047uConfig &config=GetDefaultConfig()) noexcept | |
| Construct AS5047U handler with SPI interface. | |
| ~As5047uHandler () noexcept=default | |
| Destructor - automatically handles cleanup. | |
| As5047uHandler (const As5047uHandler &)=delete | |
| As5047uHandler & | operator= (const As5047uHandler &)=delete |
| As5047uHandler (As5047uHandler &&)=delete | |
| As5047uHandler & | operator= (As5047uHandler &&)=delete |
| bool | Initialize () noexcept |
| Initialize the AS5047U sensor (lazy initialization) | |
| bool | EnsureInitialized () noexcept |
| Ensure the handler is initialized (lazy init entrypoint). | |
| bool | Deinitialize () noexcept |
| Deinitialize the sensor and free resources. | |
| bool | IsInitialized () const noexcept |
| Check if sensor is initialized and ready. | |
| bool | IsSensorReady () const noexcept |
| Check if sensor driver is ready (lazy initialization helper) | |
| as5047u::AS5047U< As5047uSpiAdapter > * | GetSensor () noexcept |
| Get pointer to AS5047U driver for advanced operations. | |
| as5047u::AS5047U< As5047uSpiAdapter > * | GetDriver () noexcept |
| Naming-consistent alias of GetSensor(). | |
| const as5047u::AS5047U< As5047uSpiAdapter > * | GetDriver () const noexcept |
| template<typename Fn > | |
| auto | visitDriver (Fn &&fn) noexcept -> decltype(fn(std::declval< as5047u::AS5047U< As5047uSpiAdapter > & >())) |
| Visit the underlying AS5047U driver under handler mutex protection. | |
| const char * | GetDescription () const noexcept |
| Get sensor description string. | |
| AS5047U_Error | GetLastError () const noexcept |
| Get last error code. | |
| void | DumpDiagnostics () const noexcept |
| Dump comprehensive diagnostics and statistics to log as INFO level. Logs AS5047U sensor status, communication health, and measurement statistics. | |
Static Public Member Functions | |
| static As5047uConfig | GetDefaultConfig () noexcept |
| Get default sensor configuration. | |
Private Member Functions | |
| bool | ValidateSensor () noexcept |
| Validate sensor parameters. | |
| bool | EnsureInitializedLocked () noexcept |
| Ensure initialized while mutex is already held. | |
| void | HandleSensorErrors (uint16_t sensor_errors) noexcept |
| Handle sensor errors and update diagnostics. | |
| void | UpdateDiagnostics () noexcept |
| Update cached diagnostics. | |
| bool | ApplyConfiguration (const As5047uConfig &config) noexcept |
| Apply configuration to sensor. | |
Private Attributes | |
| BaseSpi & | spi_ref_ |
| Reference to SPI interface. | |
| std::unique_ptr< As5047uSpiAdapter > | spi_adapter_ |
| SPI CRTP adapter. | |
| std::unique_ptr< as5047u::AS5047U< As5047uSpiAdapter > > | as5047u_sensor_ |
| AS5047U driver instance. | |
| As5047uConfig | config_ |
| Sensor configuration. | |
| RtosMutex | handler_mutex_ |
| Thread safety mutex. | |
| bool | initialized_ |
| Initialization state. | |
| AS5047U_Error | last_error_ |
| Last driver-reported error flags. | |
| As5047uDiagnostics | diagnostics_ |
| Cached diagnostics. | |
| char | description_ [64] |
| Sensor description. | |
Unified handler for AS5047U magnetic rotary position sensor.
This class provides a comprehensive interface for the AS5047U sensor with:
Architecture follows the same excellence as TMC9660Handler and PCAL95555Handler.
|
explicitnoexcept |
Construct AS5047U handler with SPI interface.
| spi_interface | Reference to BaseSpi implementation |
| config | Initial sensor configuration |
Note: Lightweight constructor following lazy initialization pattern. Objects are created during Initialize() call.
|
defaultnoexcept |
Destructor - automatically handles cleanup.
|
delete |
|
delete |
|
privatenoexcept |
Apply configuration to sensor.
| config | Configuration to apply |
|
noexcept |
Deinitialize the sensor and free resources.
|
noexcept |
Dump comprehensive diagnostics and statistics to log as INFO level. Logs AS5047U sensor status, communication health, and measurement statistics.
|
noexcept |
Ensure the handler is initialized (lazy init entrypoint).
|
privatenoexcept |
Ensure initialized while mutex is already held.
|
staticnoexcept |
Get default sensor configuration.
|
noexcept |
Get sensor description string.
|
noexcept |
|
noexcept |
Naming-consistent alias of GetSensor().
|
noexcept |
Get last error code.
|
noexcept |
Get pointer to AS5047U driver for advanced operations.
Note: Caller must not delete the returned pointer; lifetime is owned by the handler.
|
privatenoexcept |
Handle sensor errors and update diagnostics.
| sensor_errors | Error flags from sensor |
|
noexcept |
Initialize the AS5047U sensor (lazy initialization)
Creates AS5047U driver instance and performs sensor initialization. Safe to call multiple times - subsequent calls return current status.
|
noexcept |
Check if sensor is initialized and ready.
|
noexcept |
Check if sensor driver is ready (lazy initialization helper)
|
delete |
|
delete |
|
privatenoexcept |
Update cached diagnostics.
|
privatenoexcept |
Validate sensor parameters.
|
inlinenoexcept |
Visit the underlying AS5047U driver under handler mutex protection.
|
private |
AS5047U driver instance.
|
private |
Sensor configuration.
|
private |
Sensor description.
|
mutableprivate |
Cached diagnostics.
|
mutableprivate |
Thread safety mutex.
|
private |
Initialization state.
|
mutableprivate |
Last driver-reported error flags.
|
private |
SPI CRTP adapter.
|
private |
Reference to SPI interface.