Class hal::soft::adc_multiplexer
ClassList > hal > soft > adc_multiplexer
A driver for an ADC multiplexer that manages and reads ADC mux pins. This driver is intended to be used with multiplexers that use digital signals. An ADC multiplexer can be used to expand the number of input channels of an ADC.
#include <adc_mux.hpp>
Public Functions
Type | Name |
---|---|
int | get_max_channel () Gets the highest capacity channel held by the ADC mux object. This is calculated based off of how many source pins are available. |
hal::result< hal::adc::read_t > | read_channel (std::uint16_t p_mux_port) Reads a channel on the mux. |
Public Static Functions
Type | Name |
---|---|
adc_multiplexer | create (std::span< hal::output_pin * > p_signal_pins, hal::adc & p_source_pin, hal::steady_clock & p_clock) Constructs a new adc_multiplexer object. |
Public Functions Documentation
function get_max_channel
Gets the highest capacity channel held by the ADC mux object. This is calculated based off of how many source pins are available.
int hal::soft::adc_multiplexer::get_max_channel ()
Returns:
The maximum channel number for this mux (2^n states, where n is number of source pins).
function read_channel
Reads a channel on the mux.
hal::result< hal::adc::read_t > hal::soft::adc_multiplexer::read_channel (
std::uint16_t p_mux_port
)
Parameters:
p_mux_port
The port to be read. If an out of bounds port number is passed, an error-typed result is returned.
Returns:
The hal::adc::read_t struct of the read value or an error if an invalid port is given.
Public Static Functions Documentation
function create
Constructs a new adc_multiplexer object.
static adc_multiplexer hal::soft::adc_multiplexer::create (
std::span< hal::output_pin * > p_signal_pins,
hal::adc & p_source_pin,
hal::steady_clock & p_clock
)
Parameters:
p_signal_pins
A span of the output signal pins used to determine the channel on the mux.p_source_pin
The output adc pin of the multiplexer.p_clock
A steady clock used for delaying 500ns to give time to the mux to have an updated signal.
Returns:
The constructed adc_multiplexer.
The documentation for this class was generated from the following file libraries/include/libhal-soft/adc_mux.hpp