IADC - Incremental ADC

Description

Incremental Analog to Digital Converter (IADC) Peripheral API.

This module contains functions to control the IADC peripheral of Silicon Labs 32-bit MCUs and SoCs. The IADC is used to convert analog signals into a digital representation.

Data Structures

struct IADC_Init_t
IADC init structure, common for single conversion and scan sequence.
struct IADC_Config_t
IADC config structure.
struct IADC_AllConfigs_t
Structure for all IADC configs.
struct IADC_InitScan_t
IADC scan init structure.
struct IADC_InitSingle_t
IADC single init structure.
struct IADC_SingleInput_t
IADC single input selection structure.
struct IADC_ScanTableEntry_t
IADC scan table entry structure.
struct IADC_ScanTable_t
Structure for IADC scan table.
struct IADC_Result_t
Structure holding IADC result, including data and ID.

Functions

void IADC_init (IADC_TypeDef *iadc, const IADC_Init_t *init, const IADC_AllConfigs_t *allConfigs)
Initialize IADC.
void IADC_initScan (IADC_TypeDef *iadc, const IADC_InitScan_t *init, const IADC_ScanTable_t *scanTable)
Initialize IADC scan sequence.
void IADC_initSingle (IADC_TypeDef *iadc, const IADC_InitSingle_t *init, const IADC_SingleInput_t *input)
Initialize single IADC conversion.
void IADC_updateSingleInput (IADC_TypeDef *iadc, const IADC_SingleInput_t *input)
Update IADC single input selection.
void IADC_setScanMask (IADC_TypeDef *iadc, uint32_t mask)
Set mask of IADC scan table entries to include in scan.
void IADC_updateScanEntry (IADC_TypeDef *iadc, uint8_t id, IADC_ScanTableEntry_t *entry)
Add/update entry in scan table.
void IADC_reset (IADC_TypeDef *iadc)
Reset IADC to same state as after a HW reset.
uint8_t IADC_calcTimebase (IADC_TypeDef *iadc, uint32_t cmuClkFreq)
Calculate timebase value in order to get a timebase providing at least 1us.
uint8_t IADC_calcSrcClkPrescale (IADC_TypeDef *iadc, uint32_t srcClkFreq, uint32_t cmuClkFreq)
Calculate prescaler for CLK_SRC_ADC high speed clock.
uint32_t IADC_calcAdcClkPrescale (IADC_TypeDef *iadc, uint32_t adcClkFreq, uint32_t cmuClkFreq, IADC_CfgAdcMode_t adcMode, uint8_t srcClkPrescaler)
Calculate prescaler for ADC_CLK clock.
IADC_Result_t IADC_pullSingleFifoResult (IADC_TypeDef *iadc)
Pull result from single data FIFO.
IADC_Result_t IADC_readSingleResult (IADC_TypeDef *iadc)
Read most recent single conversion result.
IADC_Result_t IADC_pullScanFifoResult (IADC_TypeDef *iadc)
Pull result from scan data FIFO.
IADC_Result_t IADC_readScanResult (IADC_TypeDef *iadc)
Read most recent scan conversion result.
uint32_t IADC_pullSingleFifoData (IADC_TypeDef *iadc)
Pull data from single data FIFO.
uint32_t IADC_readSingleData (IADC_TypeDef *iadc)
Read most recent single conversion data.
uint32_t IADC_pullScanFifoData (IADC_TypeDef *iadc)
Pull data from scan data FIFO.
uint32_t IADC_readScanData (IADC_TypeDef *iadc)
Read most recent scan conversion data.
void IADC_clearInt (IADC_TypeDef *iadc, uint32_t flags)
Clear one or more pending IADC interrupts.
void IADC_disableInt (IADC_TypeDef *iadc, uint32_t flags)
Disable one or more IADC interrupts.
void IADC_enableInt (IADC_TypeDef *iadc, uint32_t flags)
Enable one or more IADC interrupts.
uint32_t IADC_getInt (IADC_TypeDef *iadc)
Get pending IADC interrupt flags.
uint32_t IADC_getEnabledInt (IADC_TypeDef *iadc)
Get enabled and pending IADC interrupt flags.
void IADC_setInt (IADC_TypeDef *iadc, uint32_t flags)
Set one or more pending IADC interrupts from SW.
void IADC_command (IADC_TypeDef *iadc, IADC_Cmd_t cmd)
Start/stop scan sequence, single conversion and/or timer.
uint32_t IADC_getScanMask (IADC_TypeDef *iadc)
Get the scan mask currently used in the IADC.
uint32_t IADC_getStatus (IADC_TypeDef *iadc)
Get status bits of IADC.
uint8_t IADC_getSingleFifoCnt (IADC_TypeDef *iadc)
Get number of elements in the IADC single FIFO.
uint8_t IADC_getScanFifoCnt (IADC_TypeDef *iadc)
Get number of elements in the IADC scan FIFO.
IADC_NegInput_t IADC_portPinToNegInput ( GPIO_Port_TypeDef port, uint8_t pin)
Convert GPIO port/pin to IADC negative input selection.
IADC_PosInput_t IADC_portPinToPosInput ( GPIO_Port_TypeDef port, uint8_t pin)
Convert GPIO port/pin to IADC positive input selection.

Macros

#define IADC_INIT_DEFAULT
Default config for IADC init structure.
#define IADC_CONFIG_DEFAULT
Default IADC config structure.
#define IADC_ALLCONFIGS_DEFAULT
Default IADC sructure for all configs.
#define IADC_INITSCAN_DEFAULT
Default c