HardFOC Core
API reference
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
hf::host::MockAdc Class Reference

#include <MockAdc.h>

Inheritance diagram for hf::host::MockAdc:

Classes

struct  Channel
 

Public Member Functions

 MockAdc (hf_u8_t channel_count=16, float reference_voltage=3.3f, uint8_t resolution_bits=12) noexcept
 
 ~MockAdc () noexcept override=default
 
bool Initialize () noexcept override
 
bool Deinitialize () noexcept override
 
hf_u8_t GetMaxChannels () const noexcept override
 
bool IsChannelAvailable (hf_channel_id_t channel_id) const noexcept override
 
hf_adc_err_t ReadChannelV (hf_channel_id_t channel_id, float &channel_reading_v, hf_u8_t numOfSamplesToAvg=1, hf_time_t timeBetweenSamples=0) noexcept override
 
hf_adc_err_t ReadChannelCount (hf_channel_id_t channel_id, hf_u32_t &channel_reading_count, hf_u8_t numOfSamplesToAvg=1, hf_time_t timeBetweenSamples=0) noexcept override
 
hf_adc_err_t ReadChannel (hf_channel_id_t channel_id, hf_u32_t &channel_reading_count, float &channel_reading_v, hf_u8_t numOfSamplesToAvg=1, hf_time_t timeBetweenSamples=0) noexcept override
 
void SetInitializeResult (bool ok) noexcept
 
void SetVoltage (hf_channel_id_t channel, float volts) noexcept
 
void SetCount (hf_channel_id_t channel, hf_u32_t count) noexcept
 
void QueueVoltages (hf_channel_id_t channel, const std::vector< float > &volts)
 
void FailChannel (hf_channel_id_t channel, hf_adc_err_t error=hf_adc_err_t::ADC_ERR_CHANNEL_READ_ERR) noexcept
 
void ClearFailure (hf_channel_id_t channel) noexcept
 
uint32_t ReadCount (hf_channel_id_t channel) const noexcept
 
float ReferenceVoltage () const noexcept
 
hf_u32_t FullScaleCount () const noexcept
 

Static Public Attributes

static constexpr hf_u8_t kMaxChannels = 32
 

Private Member Functions

hf_adc_err_t Sample (hf_channel_id_t channel_id, float &volts, hf_u32_t &count) noexcept
 

Private Attributes

bool init_result_ {true}
 
hf_u8_t channel_count_
 
float reference_voltage_
 
hf_u32_t full_scale_
 
std::array< Channel, kMaxChannels > channels_ {}
 

Constructor & Destructor Documentation

◆ MockAdc()

hf::host::MockAdc::MockAdc ( hf_u8_t  channel_count = 16,
float  reference_voltage = 3.3f,
uint8_t  resolution_bits = 12 
)
explicitnoexcept

◆ ~MockAdc()

hf::host::MockAdc::~MockAdc ( )
overridedefaultnoexcept

Member Function Documentation

◆ ClearFailure()

void hf::host::MockAdc::ClearFailure ( hf_channel_id_t  channel)
noexcept

◆ Deinitialize()

bool hf::host::MockAdc::Deinitialize ( )
inlineoverridenoexcept

◆ FailChannel()

void hf::host::MockAdc::FailChannel ( hf_channel_id_t  channel,
hf_adc_err_t  error = hf_adc_err_t::ADC_ERR_CHANNEL_READ_ERR 
)
noexcept

◆ FullScaleCount()

hf_u32_t hf::host::MockAdc::FullScaleCount ( ) const
inlinenoexcept

◆ GetMaxChannels()

hf_u8_t hf::host::MockAdc::GetMaxChannels ( ) const
inlineoverridenoexcept

◆ Initialize()

bool hf::host::MockAdc::Initialize ( )
inlineoverridenoexcept

◆ IsChannelAvailable()

bool hf::host::MockAdc::IsChannelAvailable ( hf_channel_id_t  channel_id) const
inlineoverridenoexcept

◆ QueueVoltages()

void hf::host::MockAdc::QueueVoltages ( hf_channel_id_t  channel,
const std::vector< float > &  volts 
)

◆ ReadChannel()

hf_adc_err_t hf::host::MockAdc::ReadChannel ( hf_channel_id_t  channel_id,
hf_u32_t &  channel_reading_count,
float &  channel_reading_v,
hf_u8_t  numOfSamplesToAvg = 1,
hf_time_t  timeBetweenSamples = 0 
)
overridenoexcept

◆ ReadChannelCount()

hf_adc_err_t hf::host::MockAdc::ReadChannelCount ( hf_channel_id_t  channel_id,
hf_u32_t &  channel_reading_count,
hf_u8_t  numOfSamplesToAvg = 1,
hf_time_t  timeBetweenSamples = 0 
)
overridenoexcept

◆ ReadChannelV()

hf_adc_err_t hf::host::MockAdc::ReadChannelV ( hf_channel_id_t  channel_id,
float &  channel_reading_v,
hf_u8_t  numOfSamplesToAvg = 1,
hf_time_t  timeBetweenSamples = 0 
)
overridenoexcept

◆ ReadCount()

uint32_t hf::host::MockAdc::ReadCount ( hf_channel_id_t  channel) const
noexcept

◆ ReferenceVoltage()

float hf::host::MockAdc::ReferenceVoltage ( ) const
inlinenoexcept

◆ Sample()

hf_adc_err_t hf::host::MockAdc::Sample ( hf_channel_id_t  channel_id,
float &  volts,
hf_u32_t &  count 
)
privatenoexcept

◆ SetCount()

void hf::host::MockAdc::SetCount ( hf_channel_id_t  channel,
hf_u32_t  count 
)
noexcept

◆ SetInitializeResult()

void hf::host::MockAdc::SetInitializeResult ( bool  ok)
inlinenoexcept

◆ SetVoltage()

void hf::host::MockAdc::SetVoltage ( hf_channel_id_t  channel,
float  volts 
)
noexcept

Member Data Documentation

◆ channel_count_

hf_u8_t hf::host::MockAdc::channel_count_
private

◆ channels_

std::array<Channel, kMaxChannels> hf::host::MockAdc::channels_ {}
private

◆ full_scale_

hf_u32_t hf::host::MockAdc::full_scale_
private

◆ init_result_

bool hf::host::MockAdc::init_result_ {true}
private

◆ kMaxChannels

constexpr hf_u8_t hf::host::MockAdc::kMaxChannels = 32
staticconstexpr

◆ reference_voltage_

float hf::host::MockAdc::reference_voltage_
private

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