|
HF-Core Platform 0.1.0-dev
Hardware-Agnostic Handler Layer & RTOS Utilities for HardFOC
|
Thin BaseAdc delegation wrapper for manager-layer ownership of TMC9660 ADC. More...
#include "base/BaseAdc.h"Go to the source code of this file.
Classes | |
| class | Tmc9660AdcWrapper |
| Delegation wrapper that adapts Tmc9660Handler::Adc for external ownership. More... | |
Thin BaseAdc delegation wrapper for manager-layer ownership of TMC9660 ADC.
The TMC9660's ADC functionality is implemented by Tmc9660Handler::Adc (an inner class of Tmc9660Handler that inherits from BaseAdc). The handler owns this inner class instance and exposes it via Tmc9660Handler::adc().
However, the AdcManager needs to own a std::unique_ptr<BaseAdc> that it can register, manage, and destroy independently. Since Tmc9660Handler::Adc is owned by the handler (and cannot be transferred), this wrapper class exists to bridge the ownership gap:
Every BaseAdc virtual method in this class is a one-line delegation to handler_.adc().Method(). No additional logic, buffering, or transformation is performed.
The Tmc9660Handler referenced by this wrapper must remain alive for the entire lifetime of the wrapper. This is naturally satisfied when MotorController owns the handler and AdcManager creates the wrapper from that handler, since both managers are singletons with matched lifetimes.