Skip to content

daisy::AdcChannelConfig

Module: LIBDAISY / PERIPHERAL / ANALOG

Configuration Structure for an ADC Channel. More...

#include <adc.h>

Public Types

Name
enum MuxPin
enum ConversionSpeed { SPEED_1CYCLES_5, SPEED_2CYCLES_5, SPEED_8CYCLES_5, SPEED_16CYCLES_5, SPEED_32CYCLES_5, SPEED_64CYCLES_5, SPEED_387CYCLES_5, SPEED_810CYCLES_5}
per channel conversion speed added to fixed time based on bitdepth, etc.

Public Functions

Name
void InitSingle(dsy_gpio_pin pin, ConversionSpeed speed =SPEED_8CYCLES_5)
void InitMux(dsy_gpio_pin adc_pin, size_t mux_channels, dsy_gpio_pin mux_0, dsy_gpio_pin mux_1 ={DSY_GPIOX, 0}, dsy_gpio_pin mux_2 ={DSY_GPIOX, 0}, ConversionSpeed speed =SPEED_8CYCLES_5)

Public Attributes

Name
dsy_gpio pin_
dsy_gpio[MUX_SEL_LAST] mux_pin_
uint8_t mux_channels_
ConversionSpeed speed_

Detailed Description

struct daisy::AdcChannelConfig;

Configuration Structure for an ADC Channel.

Note: Sharing data lines to multiple muxes is possible, but each channel sharing data lines must be set to the maximum number of channels, even if some multiplexers have fewer inputs connected.

This can be used to configure a a single input, or a multiplexed input, allowing up to 8 inputs on one channel.

Public Types Documentation

enum MuxPin

Enumerator Value Description
MUX_SEL_0 &
MUX_SEL_1 &
MUX_SEL_2 &
MUX_SEL_LAST &

Which pin to use for multiplexing

enum ConversionSpeed

Enumerator Value Description
SPEED_1CYCLES_5
SPEED_2CYCLES_5
SPEED_8CYCLES_5
SPEED_16CYCLES_5
SPEED_32CYCLES_5
SPEED_64CYCLES_5
SPEED_387CYCLES_5
SPEED_810CYCLES_5

per channel conversion speed added to fixed time based on bitdepth, etc.

Public Functions Documentation

function InitSingle

void InitSingle(
    dsy_gpio_pin pin,
    ConversionSpeed speed =SPEED_8CYCLES_5
)

Parameters:

  • pin Pin to init.
  • speed conversion speed for this pin defaults to 8.5 cycles

Initializes a single ADC pin as an ADC.


function InitMux

void InitMux(
    dsy_gpio_pin adc_pin,
    size_t mux_channels,
    dsy_gpio_pin mux_0,
    dsy_gpio_pin mux_1 ={DSY_GPIOX, 0},
    dsy_gpio_pin mux_2 ={DSY_GPIOX, 0},
    ConversionSpeed speed =SPEED_8CYCLES_5
)

Parameters:

  • adc_pin &
  • mux_channels must be 1-8
  • mux_0 First mux pin
  • mux_1 Second mux pin
  • mux_2 Third mux pin
  • speed conversion speed for this pin defaults to 8.5 cycles

Initializes a single ADC pin as a Multiplexed ADC. Requires a CD405X Multiplexer connected to the pin. You only need to supply the mux pins that are required, e.g. a 4052 mux would only require mux_0 and mux_1. Internal Callbacks handle the pin addressing.


Public Attributes Documentation

variable pin_

dsy_gpio pin_;

&

variable mux_pin_

dsy_gpio[MUX_SEL_LAST] mux_pin_;

&

variable mux_channels_

uint8_t mux_channels_;

&

variable speed_

ConversionSpeed speed_;

Updated on 2024-01-03 at 19:41:01 +0000