FastArduino  v1.7
C++ library to build fast but small Arduino/AVR projects
analog::AnalogInput< APIN_, SAMPLE_TYPE_, AREF_, MAXFREQ_ > Class Template Reference

API that handles a given analog input pin of the target MCU. More...

#include <fastarduino/analog_input.h>

Public Types

using SAMPLE_TYPE = SAMPLE_TYPE_
 The type of samples returned by sample().
 
using TYPE = SAMPLE_TYPE
 The type of samples returned by sample().
 

Public Member Functions

 AnalogInput (const THIS &)=delete
 
THISoperator= (const THIS &)=delete
 
SAMPLE_TYPE sample ()
 Start an analog-digital conversion for this analog input pin and return sample value. More...
 

Static Public Attributes

static constexpr const board::AnalogPin APIN = APIN_
 The analog pin for this AnalogInput; this may also not be a real pin but an internal sensor (e.g. More...
 
static constexpr const board::AnalogReference AREF = AREF_
 The analog reference to use for that analog input.
 
static constexpr const board::AnalogClock MAXFREQ = MAXFREQ_
 The maximum input clock frequency of the ADC circuit; higher frequencies imply lower precision of samples.
 
static constexpr const uint8_t PRESCALER = FREQ_TRAIT::PRESCALER
 The prescaler used by ADC circuitry, calculated from MAXFREQ template parameter.
 

Detailed Description

template<board::AnalogPin APIN_, typename SAMPLE_TYPE_ = uint16_t, board::AnalogReference AREF_ = board::AnalogReference::AVCC, board::AnalogClock MAXFREQ_ = board::AnalogClock::MAX_FREQ_200KHz>
class analog::AnalogInput< APIN_, SAMPLE_TYPE_, AREF_, MAXFREQ_ >

API that handles a given analog input pin of the target MCU.

Template Parameters
APIN_a unique analog pin for the MCU target; this may also not be a real pin but an internal sensor (e.g. temperature or bandgap).
AREF_the analog reference to use for that input
SAMPLE_TYPE_the type of samples, either uint8_t (8 bits) or uint16_t (10 bits)
MAXFREQ_the maximum input clock frequency of the ADC circuit; higher frequencies imply lower precision of samples.
See also
board::AnalogPin
board::AnalogReference
board::AnalogClock

Definition at line 51 of file analog_input.h.

Member Function Documentation

◆ sample()

template<board::AnalogPin APIN_, typename SAMPLE_TYPE_ = uint16_t, board::AnalogReference AREF_ = board::AnalogReference::AVCC, board::AnalogClock MAXFREQ_ = board::AnalogClock::MAX_FREQ_200KHz>
SAMPLE_TYPE analog::AnalogInput< APIN_, SAMPLE_TYPE_, AREF_, MAXFREQ_ >::sample ( )
inline

Start an analog-digital conversion for this analog input pin and return sample value.

Returns
the sample value converted from this analog input pin

Definition at line 105 of file analog_input.h.

Member Data Documentation

◆ APIN

template<board::AnalogPin APIN_, typename SAMPLE_TYPE_ = uint16_t, board::AnalogReference AREF_ = board::AnalogReference::AVCC, board::AnalogClock MAXFREQ_ = board::AnalogClock::MAX_FREQ_200KHz>
constexpr const board::AnalogPin analog::AnalogInput< APIN_, SAMPLE_TYPE_, AREF_, MAXFREQ_ >::APIN = APIN_
staticconstexpr

The analog pin for this AnalogInput; this may also not be a real pin but an internal sensor (e.g.

temperature or bandgap).

Definition at line 58 of file analog_input.h.


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