Skip to content

Class daisy::AdcHandle

ClassList > daisy > AdcHandle

Handler for analog to digital conversion.

  • #include <adc.h>

Public Types

Type Name
enum OverSampling

Public Functions

Type Name
AdcHandle ()
uint16_t Get (uint8_t chn) const
float GetFloat (uint8_t chn) const
uint16_t GetMux (uint8_t chn, uint8_t idx) const
float GetMuxFloat (uint8_t chn, uint8_t idx) const
uint16_t * GetMuxPtr (uint8_t chn, uint8_t idx) const
uint16_t * GetPtr (uint8_t chn) const
void Init (AdcChannelConfig * cfg, size_t num_channels, OverSampling ovs=OVS_32)
void Start ()
void Stop ()
~AdcHandle ()

Public Types Documentation

enum OverSampling

enum daisy::AdcHandle::OverSampling {
    OVS_NONE,
    OVS_4,
    OVS_8,
    OVS_16,
    OVS_32,
    OVS_64,
    OVS_128,
    OVS_256,
    OVS_512,
    OVS_1024,
    OVS_LAST
};

Supported oversampling amounts


Public Functions Documentation

function AdcHandle

inline daisy::AdcHandle::AdcHandle () 

function Get

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

Single channel getter

Parameters:

  • chn channel to get

Returns:

Converted value


function GetFloat

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

Get floating point from single channel

Parameters:

  • chn Channel to get from

Returns:

Floating point converted value


function 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:

  • chn Channel to get from
  • idx &

Returns:

data


function 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:

  • chn Channel to get from
  • idx &

Returns:

Floating point data


function 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:

  • chn Channel to get from
  • idx &

Returns:

Pointer to data


function 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


function Init

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

Initializes the ADC with the pins passed in.

Parameters:

  • *cfg an array of AdcChannelConfig of the desired channel
  • num_channels number of ADC channels to initialize
  • ovs Oversampling amount - Defaults to OVS_32

function Start

void daisy::AdcHandle::Start () 

Starts reading from the ADC


function Stop

void daisy::AdcHandle::Stop () 

Stops reading from the ADC


function ~AdcHandle

inline daisy::AdcHandle::~AdcHandle () 


The documentation for this class was generated from the following file external-docs/libDaisy/src/per/adc.h