Microchip® Advanced Software Framework

adc.c File Reference

AVR XMEGA Analog to Digital Converter driver.

Copyright (c) 2010-2018 Microchip Technology Inc. and its subsidiaries.

#include <compiler.h>
#include <adc.h>

Functions

ADC interrupt callback function
void adc_set_callback (ADC_t *adc, adc_callback_t callback)
 Set ADC interrupt callback function. More...
 
Internal functions for driver
void adc_enable_clock (ADC_t *adc)
 Enable peripheral clock for ADC. More...
 
void adc_disable_clock (ADC_t *adc)
 Disable peripheral clock for ADC. More...
 
ADC module management
void adc_enable (ADC_t *adc)
 Enable ADC. More...
 
void adc_disable (ADC_t *adc)
 Disable ADC. More...
 
bool adc_is_enabled (ADC_t *adc)
 Check if the ADC is enabled. More...
 

void adc_disable_clock ( ADC_t *  adc)

Disable peripheral clock for ADC.

Decrements the enable count for the ADC, then disables its peripheral clock if the count hit zero. If the count did not hit zero, it indicates the ADC is enabled.

Parameters
adcPointer to ADC module

References Assert, SYSCLK_ADC, sysclk_disable_module(), SYSCLK_PORT_A, and SYSCLK_PORT_B.

Referenced by adc_disable(), adc_read_configuration(), adc_write_configuration(), adcch_read_configuration(), and adcch_write_configuration().

void adc_enable_clock ( ADC_t *  adc)

Enable peripheral clock for ADC.

Checks if the enable count for the ADC is zero, then increments it. If the count was zero, the peripheral clock is enabled. Otherwise, it is already enabled.

Parameters
adcPointer to ADC module.

References Assert, SYSCLK_ADC, sysclk_enable_module(), SYSCLK_PORT_A, and SYSCLK_PORT_B.

Referenced by adc_enable(), adc_read_configuration(), adc_write_configuration(), adcch_read_configuration(), and adcch_write_configuration().