Skip to content

Struct daisy::AdcChannelConfig

ClassList > daisy > AdcChannelConfig

Configuration Structure for an ADC Channel. More...

  • #include <adc.h>

Public Types

Type Name
enum ConversionSpeed
per channel conversion speed added to fixed time based on bitdepth, etc.
enum MuxPin

Public Attributes

Type Name
uint8_t mux_channels_
GPIO mux_pin_
GPIO pin_
ConversionSpeed speed_

Public Functions

Type Name
void InitMux (Pin adc_pin, size_t mux_channels, Pin mux_0, Pin mux_1=Pin(PORTX, 0), Pin mux_2=Pin(PORTX, 0), ConversionSpeed speed=SPEED_8CYCLES_5)
void InitSingle (Pin pin, ConversionSpeed speed=SPEED_8CYCLES_5)

Detailed Description

This can be used to configure a a single input, or a multiplexed input, allowing up to 8 inputs on one 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.

Public Types Documentation

enum ConversionSpeed

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

enum daisy::AdcChannelConfig::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
};


enum MuxPin

enum daisy::AdcChannelConfig::MuxPin {
    MUX_SEL_0,
    MUX_SEL_1,
    MUX_SEL_2,
    MUX_SEL_LAST
};

Which pin to use for multiplexing


Public Attributes Documentation

variable mux_channels_

uint8_t daisy::AdcChannelConfig::mux_channels_;

&


variable mux_pin_

GPIO daisy::AdcChannelConfig::mux_pin_[MUX_SEL_LAST];

&


variable pin_

GPIO daisy::AdcChannelConfig::pin_;

&


variable speed_

ConversionSpeed daisy::AdcChannelConfig::speed_;

Public Functions Documentation

function InitMux

void daisy::AdcChannelConfig::InitMux (
    Pin adc_pin,
    size_t mux_channels,
    Pin mux_0,
    Pin mux_1=Pin ( PORTX , 0),
    Pin mux_2=Pin ( PORTX , 0),
    ConversionSpeed speed=SPEED_8CYCLES_5
) 

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.

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

function InitSingle

void daisy::AdcChannelConfig::InitSingle (
    Pin pin,
    ConversionSpeed speed=SPEED_8CYCLES_5
) 

Initializes a single ADC pin as an ADC.

Parameters:

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


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