HardFOC Core
API reference
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
NtcAdcAdapter Class Reference

Adapter that bridges BaseAdc to the ntc::AdcInterface CRTP interface required by the NtcThermistor template class. More...

#include <NtcTemperatureHandler.h>

Inheritance diagram for NtcAdcAdapter:

Public Member Functions

 NtcAdcAdapter (BaseAdc *adc, float ref_voltage=3.3f, uint8_t res_bits=12) noexcept
 Construct adapter wrapping a BaseAdc pointer.
 
bool IsInitialized () const
 
bool EnsureInitialized ()
 
bool IsChannelAvailable (uint8_t channel) const
 
ntc::AdcError ReadChannelCount (uint8_t channel, uint32_t *count)
 
ntc::AdcError ReadChannelV (uint8_t channel, float *voltage_v)
 
float GetReferenceVoltage () const
 
uint8_t GetResolutionBits () const
 
void DelayMs (uint32_t ms)
 

Private Attributes

BaseAdc * adc_
 
float reference_voltage_
 
uint8_t resolution_bits_
 

Detailed Description

Adapter that bridges BaseAdc to the ntc::AdcInterface CRTP interface required by the NtcThermistor template class.

NtcThermistor<AdcType> requires AdcType to inherit from ntc::AdcInterface<AdcType>. BaseAdc uses a separate virtual interface. This adapter translates between them.

Constructor & Destructor Documentation

◆ NtcAdcAdapter()

NtcAdcAdapter::NtcAdcAdapter ( BaseAdc *  adc,
float  ref_voltage = 3.3f,
uint8_t  res_bits = 12 
)
inlineexplicitnoexcept

Construct adapter wrapping a BaseAdc pointer.

Parameters
adcPointer to BaseAdc (must outlive this adapter).
ref_voltageADC reference voltage in volts.
res_bitsADC resolution in bits.

Member Function Documentation

◆ DelayMs()

void NtcAdcAdapter::DelayMs ( uint32_t  ms)
inline

Optional driver hook: the driver waits sample_delay_ms between averaged samples through it (it used a busy-wait the compiler could remove).

◆ EnsureInitialized()

bool NtcAdcAdapter::EnsureInitialized ( )
inline

◆ GetReferenceVoltage()

float NtcAdcAdapter::GetReferenceVoltage ( ) const
inline

◆ GetResolutionBits()

uint8_t NtcAdcAdapter::GetResolutionBits ( ) const
inline

◆ IsChannelAvailable()

bool NtcAdcAdapter::IsChannelAvailable ( uint8_t  channel) const
inline

◆ IsInitialized()

bool NtcAdcAdapter::IsInitialized ( ) const
inline

◆ ReadChannelCount()

ntc::AdcError NtcAdcAdapter::ReadChannelCount ( uint8_t  channel,
uint32_t *  count 
)
inline

◆ ReadChannelV()

ntc::AdcError NtcAdcAdapter::ReadChannelV ( uint8_t  channel,
float *  voltage_v 
)
inline

Member Data Documentation

◆ adc_

BaseAdc* NtcAdcAdapter::adc_
private

◆ reference_voltage_

float NtcAdcAdapter::reference_voltage_
private

◆ resolution_bits_

uint8_t NtcAdcAdapter::resolution_bits_
private

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