SAM ADC functionality.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include <system_interrupt.h>
Data Structures | |
struct | adc_config |
ADC configuration structure. More... | |
struct | adc_correction_config |
Gain and offset correction configuration structure. More... | |
struct | adc_events |
ADC event enable/disable structure. More... | |
struct | adc_module |
ADC software device instance structure. More... | |
struct | adc_pin_scan_config |
Pin scan configuration structure. More... | |
struct | adc_window_config |
Window monitor configuration structure. More... | |
Typedefs | |
typedef void(* | adc_callback_t )(struct adc_module *const module) |
Type of the callback functions. More... | |
Enumerations | |
enum | adc_accumulate_samples { ADC_ACCUMULATE_DISABLE = ADC_AVGCTRL_SAMPLENUM_1, ADC_ACCUMULATE_SAMPLES_2 = ADC_AVGCTRL_SAMPLENUM_2, ADC_ACCUMULATE_SAMPLES_4 = ADC_AVGCTRL_SAMPLENUM_4, ADC_ACCUMULATE_SAMPLES_8 = ADC_AVGCTRL_SAMPLENUM_8, ADC_ACCUMULATE_SAMPLES_16 = ADC_AVGCTRL_SAMPLENUM_16, ADC_ACCUMULATE_SAMPLES_32 = ADC_AVGCTRL_SAMPLENUM_32, ADC_ACCUMULATE_SAMPLES_64 = ADC_AVGCTRL_SAMPLENUM_64, ADC_ACCUMULATE_SAMPLES_128 = ADC_AVGCTRL_SAMPLENUM_128, ADC_ACCUMULATE_SAMPLES_256 = ADC_AVGCTRL_SAMPLENUM_256, ADC_ACCUMULATE_SAMPLES_512 = ADC_AVGCTRL_SAMPLENUM_512, ADC_ACCUMULATE_SAMPLES_1024 = ADC_AVGCTRL_SAMPLENUM_1024 } |
ADC number of accumulated samples enum. More... | |
enum | adc_callback { ADC_CALLBACK_READ_BUFFER, ADC_CALLBACK_WINDOW, ADC_CALLBACK_ERROR } |
ADC Callback enum. More... | |
enum | adc_clock_prescaler { ADC_CLOCK_PRESCALER_DIV4 = ADC_CTRLB_PRESCALER_DIV4, ADC_CLOCK_PRESCALER_DIV8 = ADC_CTRLB_PRESCALER_DIV8, ADC_CLOCK_PRESCALER_DIV16 = ADC_CTRLB_PRESCALER_DIV16, ADC_CLOCK_PRESCALER_DIV32 = ADC_CTRLB_PRESCALER_DIV32, ADC_CLOCK_PRESCALER_DIV64 = ADC_CTRLB_PRESCALER_DIV64, ADC_CLOCK_PRESCALER_DIV128 = ADC_CTRLB_PRESCALER_DIV128, ADC_CLOCK_PRESCALER_DIV256 = ADC_CTRLB_PRESCALER_DIV256, ADC_CLOCK_PRESCALER_DIV512 = ADC_CTRLB_PRESCALER_DIV512 } |
ADC clock prescaler enum. More... | |
enum | adc_divide_result { ADC_DIVIDE_RESULT_DISABLE = 0, ADC_DIVIDE_RESULT_2 = 1, ADC_DIVIDE_RESULT_4 = 2, ADC_DIVIDE_RESULT_8 = 3, ADC_DIVIDE_RESULT_16 = 4, ADC_DIVIDE_RESULT_32 = 5, ADC_DIVIDE_RESULT_64 = 6, ADC_DIVIDE_RESULT_128 = 7 } |
ADC possible dividers for the result register. More... | |
enum | adc_event_action { ADC_EVENT_ACTION_DISABLED = 0, ADC_EVENT_ACTION_FLUSH_START_CONV = ADC_EVCTRL_SYNCEI, ADC_EVENT_ACTION_START_CONV = ADC_EVCTRL_STARTEI } |
ADC event action enum. More... | |
enum | adc_gain_factor { ADC_GAIN_FACTOR_1X = ADC_INPUTCTRL_GAIN_1X, ADC_GAIN_FACTOR_2X = ADC_INPUTCTRL_GAIN_2X, ADC_GAIN_FACTOR_4X = ADC_INPUTCTRL_GAIN_4X, ADC_GAIN_FACTOR_8X = ADC_INPUTCTRL_GAIN_8X, ADC_GAIN_FACTOR_16X = ADC_INPUTCTRL_GAIN_16X, ADC_GAIN_FACTOR_DIV2 = ADC_INPUTCTRL_GAIN_DIV2 } |
ADC gain factor selection enum. More... | |
enum | adc_interrupt_flag { ADC_INTERRUPT_RESULT_READY = ADC_INTFLAG_RESRDY, ADC_INTERRUPT_WINDOW = ADC_INTFLAG_WINMON, ADC_INTERRUPT_OVERRUN = ADC_INTFLAG_OVERRUN } |
Enum for the possible ADC interrupt flags. More... | |
enum | adc_negative_input { ADC_NEGATIVE_INPUT_PIN0 = ADC_INPUTCTRL_MUXNEG_PIN0, ADC_NEGATIVE_INPUT_PIN1 = ADC_INPUTCTRL_MUXNEG_PIN1, ADC_NEGATIVE_INPUT_PIN2 = ADC_INPUTCTRL_MUXNEG_PIN2, ADC_NEGATIVE_INPUT_PIN3 = ADC_INPUTCTRL_MUXNEG_PIN3, ADC_NEGATIVE_INPUT_PIN4 = ADC_INPUTCTRL_MUXNEG_PIN4, ADC_NEGATIVE_INPUT_PIN5 = ADC_INPUTCTRL_MUXNEG_PIN5, ADC_NEGATIVE_INPUT_PIN6 = ADC_INPUTCTRL_MUXNEG_PIN6, ADC_NEGATIVE_INPUT_PIN7 = ADC_INPUTCTRL_MUXNEG_PIN7, ADC_NEGATIVE_INPUT_GND = ADC_INPUTCTRL_MUXNEG_GND, ADC_NEGATIVE_INPUT_IOGND = ADC_INPUTCTRL_MUXNEG_IOGND } |
ADC negative Multiplexer(MUX) input selection enum. More... | |
enum | adc_oversampling_and_decimation { ADC_OVERSAMPLING_AND_DECIMATION_DISABLE = 0, ADC_OVERSAMPLING_AND_DECIMATION_1BIT, ADC_OVERSAMPLING_AND_DECIMATION_2BIT, ADC_OVERSAMPLING_AND_DECIMATION_3BIT, ADC_OVERSAMPLING_AND_DECIMATION_4BIT } |
ADC oversampling and decimation enum. More... | |
enum | adc_positive_input { ADC_POSITIVE_INPUT_PIN0 = ADC_INPUTCTRL_MUXPOS_PIN0, ADC_POSITIVE_INPUT_PIN1 = ADC_INPUTCTRL_MUXPOS_PIN1, ADC_POSITIVE_INPUT_PIN2 = ADC_INPUTCTRL_MUXPOS_PIN2, ADC_POSITIVE_INPUT_PIN3 = ADC_INPUTCTRL_MUXPOS_PIN3, ADC_POSITIVE_INPUT_PIN4 = ADC_INPUTCTRL_MUXPOS_PIN4, ADC_POSITIVE_INPUT_PIN5 = ADC_INPUTCTRL_MUXPOS_PIN5, ADC_POSITIVE_INPUT_PIN6 = ADC_INPUTCTRL_MUXPOS_PIN6, ADC_POSITIVE_INPUT_PIN7 = ADC_INPUTCTRL_MUXPOS_PIN7, ADC_POSITIVE_INPUT_PIN8 = ADC_INPUTCTRL_MUXPOS_PIN8, ADC_POSITIVE_INPUT_PIN9 = ADC_INPUTCTRL_MUXPOS_PIN9, ADC_POSITIVE_INPUT_PIN10 = ADC_INPUTCTRL_MUXPOS_PIN10, ADC_POSITIVE_INPUT_PIN11 = ADC_INPUTCTRL_MUXPOS_PIN11, ADC_POSITIVE_INPUT_PIN12 = ADC_INPUTCTRL_MUXPOS_PIN12, ADC_POSITIVE_INPUT_PIN13 = ADC_INPUTCTRL_MUXPOS_PIN13, ADC_POSITIVE_INPUT_PIN14 = ADC_INPUTCTRL_MUXPOS_PIN14, ADC_POSITIVE_INPUT_PIN15 = ADC_INPUTCTRL_MUXPOS_PIN15, ADC_POSITIVE_INPUT_PIN16 = ADC_INPUTCTRL_MUXPOS_PIN16, ADC_POSITIVE_INPUT_PIN17 = ADC_INPUTCTRL_MUXPOS_PIN17, ADC_POSITIVE_INPUT_PIN18 = ADC_INPUTCTRL_MUXPOS_PIN18, ADC_POSITIVE_INPUT_PIN19 = ADC_INPUTCTRL_MUXPOS_PIN19, ADC_POSITIVE_INPUT_TEMP = ADC_INPUTCTRL_MUXPOS_TEMP, ADC_POSITIVE_INPUT_BANDGAP = ADC_INPUTCTRL_MUXPOS_BANDGAP, ADC_POSITIVE_INPUT_SCALEDCOREVCC = ADC_INPUTCTRL_MUXPOS_SCALEDCOREVCC, ADC_POSITIVE_INPUT_SCALEDIOVCC = ADC_INPUTCTRL_MUXPOS_SCALEDIOVCC, ADC_POSITIVE_INPUT_DAC = ADC_INPUTCTRL_MUXPOS_DAC } |
ADC positive MUX input selection enum. More... | |
enum | adc_reference { ADC_REFERENCE_INT1V = ADC_REFCTRL_REFSEL_INT1V, ADC_REFERENCE_INTVCC0 = ADC_REFCTRL_REFSEL_INTVCC0, ADC_REFERENCE_INTVCC1 = ADC_REFCTRL_REFSEL_INTVCC1, ADC_REFERENCE_AREFA = ADC_REFCTRL_REFSEL_AREFA, ADC_REFERENCE_AREFB = ADC_REFCTRL_REFSEL_AREFB } |
ADC reference voltage enum. More... | |
enum | adc_resolution { ADC_RESOLUTION_12BIT = ADC_CTRLB_RESSEL_12BIT, ADC_RESOLUTION_16BIT = ADC_CTRLB_RESSEL_16BIT, ADC_RESOLUTION_10BIT = ADC_CTRLB_RESSEL_10BIT, ADC_RESOLUTION_8BIT = ADC_CTRLB_RESSEL_8BIT, ADC_RESOLUTION_13BIT, ADC_RESOLUTION_14BIT, ADC_RESOLUTION_15BIT, ADC_RESOLUTION_CUSTOM } |
ADC resolution enum. More... | |
enum | adc_window_mode { ADC_WINDOW_MODE_DISABLE = ADC_WINCTRL_WINMODE_DISABLE, ADC_WINDOW_MODE_ABOVE_LOWER = ADC_WINCTRL_WINMODE_MODE1, ADC_WINDOW_MODE_BELOW_UPPER = ADC_WINCTRL_WINMODE_MODE2, ADC_WINDOW_MODE_BETWEEN = ADC_WINCTRL_WINMODE_MODE3, ADC_WINDOW_MODE_BETWEEN_INVERTED = ADC_WINCTRL_WINMODE_MODE4 } |
ADC window monitor mode enum. More... | |
Functions | |
ADC Gain and Pin Scan Mode | |
static void | adc_set_gain (struct adc_module *const module_inst, const enum adc_gain_factor gain_factor) |
Sets ADC gain factor. More... | |
static enum status_code | adc_set_pin_scan_mode (struct adc_module *const module_inst, uint8_t inputs_to_scan, const uint8_t start_offset) |
Sets the ADC pin scan mode. More... | |
static void | adc_disable_pin_scan_mode (struct adc_module *const module_inst) |
Disables pin scan mode. More... | |