FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
analog::PowerVoltage< BANDGAP_ > Class Template Reference

API that uses bandgap feature to calculate current voltage fed to the MCU. More...

#include <fastarduino/analog_input.h>

Inheritance diagram for analog::PowerVoltage< BANDGAP_ >:
Collaboration diagram for analog::PowerVoltage< BANDGAP_ >:

Public Member Functions

 PowerVoltage (const PowerVoltage &)=delete
 
PowerVoltageoperator= (const PowerVoltage &)=delete
 
uint16_t voltage_mV ()
 Get the voltage, in mV, feeding the MCU. More...
 
- Public Member Functions inherited from analog::AnalogInput< APIN_, SAMPLE_TYPE_, AREF_, MAXFREQ_ >
 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 BANDGAP = BANDGAP_
 The bandgap analog pin of the MCU target, used for this PowerVoltage. More...
 
- Static Public Attributes inherited from analog::AnalogInput< APIN_, SAMPLE_TYPE_, AREF_, MAXFREQ_ >
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...
 

Additional Inherited Members

- Public Types inherited from analog::AnalogInput< APIN_, SAMPLE_TYPE_, AREF_, MAXFREQ_ >
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...
 

Detailed Description

template<board::AnalogPin BANDGAP_ = board::AnalogPin::BANDGAP>
class analog::PowerVoltage< BANDGAP_ >

API that uses bandgap feature to calculate current voltage fed to the MCU.

Template Parameters
BANDGAP_a unique bandgap analog pin for the MCU target; although the accepted type is board::AnalogPin enum, only bandgap inputs are allowed otherwise a compilation error will occur.
See also
board::AnalogPin

Definition at line 134 of file analog_input.h.

Member Function Documentation

◆ voltage_mV()

template<board::AnalogPin BANDGAP_ = board::AnalogPin::BANDGAP>
uint16_t analog::PowerVoltage< BANDGAP_ >::voltage_mV ( )
inline

Get the voltage, in mV, feeding the MCU.

Returns
the current voltage in mV

Definition at line 158 of file analog_input.h.

Member Data Documentation

◆ BANDGAP

template<board::AnalogPin BANDGAP_ = board::AnalogPin::BANDGAP>
constexpr const board::AnalogPin analog::PowerVoltage< BANDGAP_ >::BANDGAP = BANDGAP_
staticconstexpr

The bandgap analog pin of the MCU target, used for this PowerVoltage.

Definition at line 141 of file analog_input.h.


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