Handler for analog to digital conversion. More...
Handler for analog to digital conversion.
#include <adc.h>
Public Types | |
enum | OverSampling { OVS_NONE , OVS_4 , OVS_8 , OVS_16 , OVS_32 , OVS_64 , OVS_128 , OVS_256 , OVS_512 , OVS_1024 , OVS_LAST } |
Public Member Functions | |
AdcHandle () | |
~AdcHandle () | |
void | Init (AdcChannelConfig *cfg, size_t num_channels, OverSampling ovs=OVS_32) |
void | Start () |
void | Stop () |
uint16_t | Get (uint8_t chn) const |
uint16_t * | GetPtr (uint8_t chn) const |
float | GetFloat (uint8_t chn) const |
uint16_t | GetMux (uint8_t chn, uint8_t idx) const |
uint16_t * | GetMuxPtr (uint8_t chn, uint8_t idx) const |
float | GetMuxFloat (uint8_t chn, uint8_t idx) const |
|
inline |
|
inline |
Single channel getter
chn | channel to get |
Get floating point from single channel
chn | Channel to get from |
Getters for multiplexed inputs on a single channel (up to 8 per ADC input).
chn | Channel to get from |
idx | & |
Getters for multiplexed inputs on a single channel (up to 8 per ADC input).
chn | Channel to get from |
idx | & |
Getters for multiplexed inputs on a single channel. (Max 8 per chan)
chn | Channel to get from |
idx | & |
Get pointer to a value from a single channel
chn |
void daisy::AdcHandle::Init | ( | AdcChannelConfig * | cfg, |
size_t | num_channels, | ||
OverSampling | ovs = OVS_32 |
||
) |
Initializes the ADC with the pins passed in.
*cfg | an array of AdcChannelConfig of the desired channel |
num_channels | number of ADC channels to initialize |
ovs | Oversampling amount - Defaults to OVS_32 |
void daisy::AdcHandle::Start | ( | ) |
Starts reading from the ADC
void daisy::AdcHandle::Stop | ( | ) |
Stops reading from the ADC