Boboter
Loading...
Searching...
No Matches
HAL::ADC::Controller Class Reference

The ADC hardware abstraction layer's control class. More...

#include <adc.h>

Public Member Functions

 Controller (const Controller &)=delete
Controller & operator= (const Controller &)=delete
void configure (const controller_config_t &config)
 Configures the ADC Controller.
void shutdown ()
 Safely shuts down the controller and hardware.
void add (adc_channel_t adc_channel)
 Adds an ADC input to the controller.
uint16_t read_raw (adc_channel_t adc_channel, uint16_t samples=1) const
 Reads the current raw ADC reading.
uint16_t read_millivolts (adc_channel_t adc_channel, uint16_t samples=1) const
 Reads the current voltage in millivolts.

Static Public Member Functions

static Controller & get_instance ()
 Returns a reference to the static controller instance.

Detailed Description

The ADC hardware abstraction layer's control class.

Constructor & Destructor Documentation

◆ Controller()

HAL::ADC::Controller::Controller ( const Controller & )
delete

Member Function Documentation

◆ add()

void HAL::ADC::Controller::add ( adc_channel_t adc_channel)

Adds an ADC input to the controller.

Parameters
adc_channelThe ADC channel to add

◆ configure()

void HAL::ADC::Controller::configure ( const controller_config_t & config)

Configures the ADC Controller.

Parameters
configThe config struct to use

◆ get_instance()

Controller & HAL::ADC::Controller::get_instance ( )
inlinestatic

Returns a reference to the static controller instance.

Note
The instance will be created on the first call of this function
Returns
Reference to the controller object

◆ operator=()

Controller & HAL::ADC::Controller::operator= ( const Controller & )
delete

◆ read_millivolts()

uint16_t HAL::ADC::Controller::read_millivolts ( adc_channel_t adc_channel,
uint16_t samples = 1 ) const
nodiscard

Reads the current voltage in millivolts.

Returns
The voltage in millivolts
Parameters
adc_channelThe ADC channel to read from
samplesThe amount of samples to take when reading (default: 1)

◆ read_raw()

uint16_t HAL::ADC::Controller::read_raw ( adc_channel_t adc_channel,
uint16_t samples = 1 ) const
nodiscard

Reads the current raw ADC reading.

Returns
The raw ADC reading
Parameters
adc_channelThe ADC channel to read from
samplesThe amount of samples to take when reading (default: 1)

◆ shutdown()

void HAL::ADC::Controller::shutdown ( )

Safely shuts down the controller and hardware.


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