modm API documentation
modm::AdcSampler< AdcInterrupt, Channels, Oversamples > Class Template Reference

#include <modm/driver/adc/adc_sampler.hpp>

Public Typedefs

typedef uint16_t DataType
 this type is chosen automatically, it may be uint8_t, uint16_t or uint32_t
 

Static Public Member Functions

static void initialize (const Channel *mapping, DataType *data)
 
static bool startReadout ()
 
static bool isReadoutFinished ()
 
static DataTypegetData ()
 

Detailed Description

template<class AdcInterrupt, uint8_t Channels, uint32_t Oversamples = 1>
class modm::AdcSampler< AdcInterrupt, Channels, Oversamples >

Template Parameters
AdcInterrupta class implementing the AdcInterrupt interface
Channelsnumber of ADC channels connected to sensor(s) >= 1
Oversamples# of samples to average for each channel
Author
Niklas Hauser

Member Function Documentation

template<class AdcInterrupt , uint8_t Channels, uint32_t Oversamples = 1>
static DataType* modm::AdcSampler< AdcInterrupt, Channels, Oversamples >::getData ( )
static
Returns
pointer to first element of 16bit result array
template<class AdcInterrupt , uint8_t Channels, uint32_t Oversamples = 1>
static void modm::AdcSampler< AdcInterrupt, Channels, Oversamples >::initialize ( const Channel *  mapping,
DataType data 
)
static
Parameters
mappingarray of length Channels containing the channel-to-data mapping
dataarray of length Channels containing the results
template<class AdcInterrupt , uint8_t Channels, uint32_t Oversamples = 1>
static bool modm::AdcSampler< AdcInterrupt, Channels, Oversamples >::isReadoutFinished ( )
static
Returns
true if sampling finshed, false if sampling is currently on-going
Warning
The class adds and divides the oversamples in-place, so the data is invalid while isReadoutFinished() returns false!
template<class AdcInterrupt , uint8_t Channels, uint32_t Oversamples = 1>
static bool modm::AdcSampler< AdcInterrupt, Channels, Oversamples >::startReadout ( )
static

Starts the ADC readout routine and buffers the results

Returns
false when a readout is in progress, true otherwise

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