HardFOC Core
API reference
Loading...
Searching...
No Matches
Classes
Tmc9660AdcWrapper.h File Reference

Thin BaseAdc delegation wrapper when the host owns a unique_ptr. 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...
 

Detailed Description

Thin BaseAdc delegation wrapper when the host owns a unique_ptr.

Purpose

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().

A host that needs to own a std::unique_ptr<BaseAdc> cannot take ownership of the inner class. This wrapper bridges that gap:

┌──────────────┐ ┌─────────────────────┐ ┌───────────────────────┐
│ host owner │ owns │ Tmc9660AdcWrapper │ refs │ Tmc9660Handler::Adc │
│ │─────>│ (BaseAdc) │─────>│ (BaseAdc impl) │
│ unique_ptr │ │ delegates all calls│ │ reads TMC9660 driver │
└──────────────┘ └─────────────────────┘ └───────────────────────┘
Delegation wrapper that adapts Tmc9660Handler::Adc for external ownership.
Definition Tmc9660AdcWrapper.h:63
BaseAdc adapter for all TMC9660 ADC channels.
Definition Tmc9660Handler.h:778

Every BaseAdc virtual method in this class is a one-line delegation to the handler's Adc instance. No additional logic, buffering, or transformation is performed.

Lifetime Requirements

The Tmc9660Handler referenced by this wrapper must remain alive for the entire lifetime of the wrapper. The host that owns both objects is responsible for matching those lifetimes.

See also
Tmc9660Handler::Adc The actual ADC implementation this class delegates to.
Author
HardFOC Team
Date
2025