FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
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>

Inheritance diagram for analog::AnalogInput< APIN_, SAMPLE_TYPE_, AREF_, MAXFREQ_ >:

Public Types

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

Public Member Functions

 AnalogInput (const AnalogInput &)=delete
 
AnalogInputoperator= (const AnalogInput &)=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. More...
 
static constexpr const board::AnalogClock MAXFREQ = MAXFREQ_
 The maximum input clock frequency of the ADC circuit; higher frequencies imply lower precision of samples. More...
 
static constexpr const uint8_t PRESCALER = FREQ_TRAIT::PRESCALER
 The prescaler used by ADC circuitry, calculated from MAXFREQ template parameter. More...
 

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 Typedef Documentation

◆ SAMPLE_TYPE

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

The type of samples returned by sample().

Definition at line 66 of file analog_input.h.

◆ TYPE

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

The type of samples returned by sample().

Definition at line 90 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 104 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.

◆ AREF

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::AnalogReference analog::AnalogInput< APIN_, SAMPLE_TYPE_, AREF_, MAXFREQ_ >::AREF = AREF_
staticconstexpr

The analog reference to use for that analog input.

Definition at line 62 of file analog_input.h.

◆ MAXFREQ

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::AnalogClock analog::AnalogInput< APIN_, SAMPLE_TYPE_, AREF_, MAXFREQ_ >::MAXFREQ = MAXFREQ_
staticconstexpr

The maximum input clock frequency of the ADC circuit; higher frequencies imply lower precision of samples.

Definition at line 71 of file analog_input.h.

◆ PRESCALER

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 uint8_t analog::AnalogInput< APIN_, SAMPLE_TYPE_, AREF_, MAXFREQ_ >::PRESCALER = FREQ_TRAIT::PRESCALER
staticconstexpr

The prescaler used by ADC circuitry, calculated from MAXFREQ template parameter.

Definition at line 96 of file analog_input.h.


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