Class hal::lpc40::adc
Analog to digital converter.
#include <adc.hpp>
Inherits the following classes: hal::adc
Classes
Type | Name |
---|---|
struct | channel Channel specific information. |
Public Functions
Type | Name |
---|---|
virtual | ~adc () = default |
Public Functions inherited from hal::adc
See hal::adc
Type | Name |
---|---|
result< read_t > | read () Sample the analog to digital converter and return the result. |
virtual | ~adc () = default |
Public Static Functions
Type | Name |
---|---|
result< adc > | construct_custom_channel (const channel & p_channel) Construct a custom adc object based on the passed in channel information. |
result< adc > | get (size_t p_channel) Get a predefined adc channel. |
Public Functions Documentation
function ~adc
virtual hal::lpc40::adc::~adc () = default
Implements hal::adc::~adc
Public Static Functions Documentation
function construct_custom_channel
Construct a custom adc object based on the passed in channel information.
static result< adc > hal::lpc40::adc::construct_custom_channel (
const channel & p_channel
)
Care should be taken to ensure that the adc's operating frequency does not go above 1MHz and that the the channel index is within the bounds of 0 to 7. Exceeding these bounds will result in a call to std::abort.
Care should also be taken to ensure that two adc's constructed via this method do not overlap in index.
The operating frequency is shared across all adc channels, which means that the last adc to be constructed will set sampling frequency for all channels.
Parameters:
p_channel
- Which adc channel to return
Returns:
result<adc> - adc driver object
function get
Get a predefined adc channel.
static result< adc > hal::lpc40::adc::get (
size_t p_channel
)
- ADC channel 0 is pin(0, 23)
- ADC channel 1 is pin(0, 24)
- ADC channel 2 is pin(0, 25)
- ADC channel 3 is pin(0, 26)
- ADC channel 4 is pin(1, 30)
- ADC channel 5 is pin(1, 31)
- ADC channel 6 is pin(0, 12)
- ADC channel 7 is pin(0, 13)
Parameters:
p_channel
- Which adc channel to return
Returns:
result<adc> - adc driver object
The documentation for this class was generated from the following file libraries/include/libhal-lpc40/adc.hpp