libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
daisy::AdcHandle Class Reference

Handler for analog to digital conversion. More...

Detailed Description

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_tGetPtr (uint8_t chn) const
 
float GetFloat (uint8_t chn) const
 
uint16_t GetMux (uint8_t chn, uint8_t idx) const
 
uint16_tGetMuxPtr (uint8_t chn, uint8_t idx) const
 
float GetMuxFloat (uint8_t chn, uint8_t idx) const
 

Member Enumeration Documentation

◆ OverSampling

Supported oversampling amounts

Enumerator
OVS_NONE 

&

OVS_4 

&

OVS_8 

&

OVS_16 

&

OVS_32 

&

OVS_64 

&

OVS_128 

&

OVS_256 

&

OVS_512 

&

OVS_1024 

&

OVS_LAST 

&

Constructor & Destructor Documentation

◆ AdcHandle()

daisy::AdcHandle::AdcHandle ( )
inline

◆ ~AdcHandle()

daisy::AdcHandle::~AdcHandle ( )
inline

Member Function Documentation

◆ Get()

uint16_t daisy::AdcHandle::Get ( uint8_t  chn) const

Single channel getter

Parameters
chnchannel to get
Returns
Converted value

◆ GetFloat()

float daisy::AdcHandle::GetFloat ( uint8_t  chn) const

Get floating point from single channel

Parameters
chnChannel to get from
Returns
Floating point converted value

◆ GetMux()

uint16_t daisy::AdcHandle::GetMux ( uint8_t  chn,
uint8_t  idx 
) const

Getters for multiplexed inputs on a single channel (up to 8 per ADC input).

Parameters
chnChannel to get from
idx&
Returns
data

◆ GetMuxFloat()

float daisy::AdcHandle::GetMuxFloat ( uint8_t  chn,
uint8_t  idx 
) const

Getters for multiplexed inputs on a single channel (up to 8 per ADC input).

Parameters
chnChannel to get from
idx&
Returns
Floating point data

◆ GetMuxPtr()

uint16_t * daisy::AdcHandle::GetMuxPtr ( uint8_t  chn,
uint8_t  idx 
) const

Getters for multiplexed inputs on a single channel. (Max 8 per chan)

Parameters
chnChannel to get from
idx&
Returns
Pointer to data

◆ GetPtr()

uint16_t * daisy::AdcHandle::GetPtr ( uint8_t  chn) const

Get pointer to a value from a single channel

Parameters
chn
Returns
Pointer to converted value

◆ Init()

void daisy::AdcHandle::Init ( AdcChannelConfig cfg,
size_t  num_channels,
OverSampling  ovs = OVS_32 
)

Initializes the ADC with the pins passed in.

Parameters
*cfgan array of AdcChannelConfig of the desired channel
num_channelsnumber of ADC channels to initialize
ovsOversampling amount - Defaults to OVS_32

◆ Start()

void daisy::AdcHandle::Start ( )

Starts reading from the ADC

◆ Stop()

void daisy::AdcHandle::Stop ( )

Stops reading from the ADC


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