IADCEMLIB

Detailed 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_AllConfigs_t
 
struct  IADC_Config_t
 
struct  IADC_Init_t
 
struct  IADC_InitScan_t
 
struct  IADC_InitSingle_t
 
struct  IADC_Result_t
 
struct  IADC_ScanTable_t
 
struct  IADC_ScanTableEntry_t
 
struct  IADC_SingleInput_t
 

Macros

#define IADC_ALLCONFIGS_DEFAULT
 
#define IADC_CONFIG_DEFAULT
 
#define IADC_INIT_DEFAULT
 
#define IADC_INITSCAN_DEFAULT
 
#define IADC_INITSINGLE_DEFAULT
 
#define IADC_SCANTABLE_DEFAULT
 
#define IADC_SCANTABLEENTRY_DEFAULT
 
#define IADC_SINGLEINPUT_DEFAULT
 

Enumerations

enum  IADC_Alignment_t {
  iadcAlignRight12 = _IADC_SCANFIFOCFG_ALIGNMENT_RIGHT12,
  iadcAlignLeft12 = _IADC_SCANFIFOCFG_ALIGNMENT_LEFT12
}
 
enum  IADC_CfgAdcMode_t { iadcCfgModeNormal = _IADC_CFG_ADCMODE_NORMAL }
 
enum  IADC_CfgAnalogGain_t {
  iadcCfgAnalogGain0P5x = _IADC_CFG_ANALOGGAIN_ANAGAIN0P5,
  iadcCfgAnalogGain1x = _IADC_CFG_ANALOGGAIN_ANAGAIN1,
  iadcCfgAnalogGain2x = _IADC_CFG_ANALOGGAIN_ANAGAIN2,
  iadcCfgAnalogGain3x = _IADC_CFG_ANALOGGAIN_ANAGAIN3,
  iadcCfgAnalogGain4x = _IADC_CFG_ANALOGGAIN_ANAGAIN4
}
 
enum  IADC_CfgOsrHighSpeed_t {
  iadcCfgOsrHighSpeed2x = _IADC_CFG_OSRHS_HISPD2,
  iadcCfgOsrHighSpeed4x = _IADC_CFG_OSRHS_HISPD4,
  iadcCfgOsrHighSpeed8x = _IADC_CFG_OSRHS_HISPD8,
  iadcCfgOsrHighSpeed16x = _IADC_CFG_OSRHS_HISPD16,
  iadcCfgOsrHighSpeed32x = _IADC_CFG_OSRHS_HISPD32
}
 
enum  IADC_CfgReference_t {
  iadcCfgReferenceInt1V2 = _IADC_CFG_REFSEL_VBGR,
  iadcCfgReferenceExt1V25 = _IADC_CFG_REFSEL_VREF,
  iadcCfgReferenceVddx = _IADC_CFG_REFSEL_VDDX,
  iadcCfgReferenceVddX0P8Buf = _IADC_CFG_REFSEL_VDDX0P8BUF
}
 
enum  IADC_CfgTwosComp_t {
  iadcCfgTwosCompAuto = _IADC_CFG_TWOSCOMPL_AUTO,
  iadcCfgTwosCompUnipolar = _IADC_CFG_TWOSCOMPL_FORCEUNIPOLAR,
  iadcCfgTwosCompBipolar = _IADC_CFG_TWOSCOMPL_FORCEBIPOLAR
}
 
enum  IADC_Cmd_t {
  iadcCmdStartSingle = IADC_CMD_SINGLESTART,
  iadcCmdStopSingle = IADC_CMD_SINGLESTOP,
  iadcCmdStartScan = IADC_CMD_SCANSTART,
  iadcCmdStopScan = IADC_CMD_SCANSTOP,
  iadcCmdEnableTimer = IADC_CMD_TIMEREN,
  iadcCmdDisableTimer = IADC_CMD_TIMERDIS
}
 
enum  IADC_NegInput_t {
  iadcNegInputGnd = _IADC_SCAN_PORTNEG_GND << (_IADC_SCAN_PORTNEG_SHIFT - _IADC_SCAN_PINNEG_SHIFT),
  iadcNegInputNegRef = _IADC_SCAN_PORTNEG_PADREFNEG << (_IADC_SCAN_PORTNEG_SHIFT - _IADC_SCAN_PINNEG_SHIFT),
  iadcNegInputPortAPin0 = _IADC_SCAN_PORTNEG_PORTA << (_IADC_SCAN_PORTNEG_SHIFT - _IADC_SCAN_PINNEG_SHIFT),
  iadcNegInputPortAPin1,
  iadcNegInputPortAPin2,
  iadcNegInputPortAPin3,
  iadcNegInputPortAPin4,
  iadcNegInputPortAPin5,
  iadcNegInputPortAPin6,
  iadcNegInputPortAPin7,
  iadcNegInputPortAPin8,
  iadcNegInputPortAPin9,
  iadcNegInputPortAPin10,
  iadcNegInputPortAPin11,
  iadcNegInputPortAPin12,
  iadcNegInputPortAPin13,
  iadcNegInputPortAPin14,
  iadcNegInputPortAPin15,
  iadcNegInputPortBPin0,
  iadcNegInputPortBPin1,
  iadcNegInputPortBPin2,
  iadcNegInputPortBPin3,
  iadcNegInputPortBPin4,
  iadcNegInputPortBPin5,
  iadcNegInputPortBPin6,
  iadcNegInputPortBPin7,
  iadcNegInputPortBPin8,
  iadcNegInputPortBPin9,
  iadcNegInputPortBPin10,
  iadcNegInputPortBPin11,
  iadcNegInputPortBPin12,
  iadcNegInputPortBPin13,
  iadcNegInputPortBPin14,
  iadcNegInputPortBPin15,
  iadcNegInputPortCPin0,
  iadcNegInputPortCPin1,
  iadcNegInputPortCPin2,
  iadcNegInputPortCPin3,
  iadcNegInputPortCPin4,
  iadcNegInputPortCPin5,
  iadcNegInputPortCPin6,
  iadcNegInputPortCPin7,
  iadcNegInputPortCPin8,
  iadcNegInputPortCPin9,
  iadcNegInputPortCPin10,
  iadcNegInputPortCPin11,
  iadcNegInputPortCPin12,
  iadcNegInputPortCPin13,
  iadcNegInputPortCPin14,
  iadcNegInputPortCPin15,
  iadcNegInputPortDPin0,
  iadcNegInputPortDPin1,
  iadcNegInputPortDPin2,
  iadcNegInputPortDPin3,
  iadcNegInputPortDPin4,
  iadcNegInputPortDPin5,
  iadcNegInputPortDPin6,
  iadcNegInputPortDPin7,
  iadcNegInputPortDPin8,
  iadcNegInputPortDPin9,
  iadcNegInputPortDPin10,
  iadcNegInputPortDPin11,
  iadcNegInputPortDPin12,
  iadcNegInputPortDPin13,
  iadcNegInputPortDPin14,
  iadcNegInputPortDPin15
}
 
enum  IADC_PosInput_t {
  iadcPosInputGnd = _IADC_SCAN_PORTPOS_GND << (_IADC_SCAN_PORTPOS_SHIFT - _IADC_SCAN_PINPOS_SHIFT),
  iadcPosInputAvdd,
  iadcPosInputVddio,
  iadcPosInputVss,
  iadcPosInputDvdd,
  iadcPosInputVddx,
  iadcPosInputVddlv,
  iadcPosInputPosRef = _IADC_SCAN_PORTPOS_PADREFPOS << (_IADC_SCAN_PORTPOS_SHIFT - _IADC_SCAN_PINPOS_SHIFT),
  iadcPosInputPortAPin0 = _IADC_SCAN_PORTPOS_PORTA << (_IADC_SCAN_PORTPOS_SHIFT - _IADC_SCAN_PINPOS_SHIFT),
  iadcPosInputPortAPin1,
  iadcPosInputPortAPin2,
  iadcPosInputPortAPin3,
  iadcPosInputPortAPin4,
  iadcPosInputPortAPin5,
  iadcPosInputPortAPin6,
  iadcPosInputPortAPin7,
  iadcPosInputPortAPin8,
  iadcPosInputPortAPin9,
  iadcPosInputPortAPin10,
  iadcPosInputPortAPin11,
  iadcPosInputPortAPin12,
  iadcPosInputPortAPin13,
  iadcPosInputPortAPin14,
  iadcPosInputPortAPin15,
  iadcPosInputPortBPin0,
  iadcPosInputPortBPin1,
  iadcPosInputPortBPin2,
  iadcPosInputPortBPin3,
  iadcPosInputPortBPin4,
  iadcPosInputPortBPin5,
  iadcPosInputPortBPin6,
  iadcPosInputPortBPin7,
  iadcPosInputPortBPin8,
  iadcPosInputPortBPin9,
  iadcPosInputPortBPin10,
  iadcPosInputPortBPin11,
  iadcPosInputPortBPin12,
  iadcPosInputPortBPin13,
  iadcPosInputPortBPin14,
  iadcPosInputPortBPin15,
  iadcPosInputPortCPin0,
  iadcPosInputPortCPin1,
  iadcPosInputPortCPin2,
  iadcPosInputPortCPin3,
  iadcPosInputPortCPin4,
  iadcPosInputPortCPin5,
  iadcPosInputPortCPin6,
  iadcPosInputPortCPin7,
  iadcPosInputPortCPin8,
  iadcPosInputPortCPin9,
  iadcPosInputPortCPin10,
  iadcPosInputPortCPin11,
  iadcPosInputPortCPin12,
  iadcPosInputPortCPin13,
  iadcPosInputPortCPin14,
  iadcPosInputPortCPin15,
  iadcPosInputPortDPin0,
  iadcPosInputPortDPin1,
  iadcPosInputPortDPin2,
  iadcPosInputPortDPin3,
  iadcPosInputPortDPin4,
  iadcPosInputPortDPin5,
  iadcPosInputPortDPin6,
  iadcPosInputPortDPin7,
  iadcPosInputPortDPin8,
  iadcPosInputPortDPin9,
  iadcPosInputPortDPin10,
  iadcPosInputPortDPin11,
  iadcPosInputPortDPin12,
  iadcPosInputPortDPin13,
  iadcPosInputPortDPin14,
  iadcPosInputPortDPin15
}
 
enum  IADC_TriggerAction_t {
  iadcTriggerActionOnce = _IADC_TRIGGER_SCANTRIGACTION_ONCE,
  iadcTriggerActionContinuous = _IADC_TRIGGER_SCANTRIGACTION_CONTINUOUS
}
 
enum  IADC_TriggerSel_t {
  iadcTriggerSelImmediate = _IADC_TRIGGER_SCANTRIGSEL_IMMEDIATE,
  iadcTriggerSelTimer = _IADC_TRIGGER_SCANTRIGSEL_TIMER,
  iadcTriggerSelPrs0SameClk = _IADC_TRIGGER_SCANTRIGSEL_PRSCLKGRP,
  iadcTriggerSelPrs0PosEdge = _IADC_TRIGGER_SCANTRIGSEL_PRSPOS,
  iadcTriggerSelPrs0NegEdge = _IADC_TRIGGER_SCANTRIGSEL_PRSNEG
}
 
enum  IADC_Warmup_t {
  iadcWarmupNormal = _IADC_CTRL_WARMUPMODE_NORMAL,
  iadcWarmupKeepInStandby = _IADC_CTRL_WARMUPMODE_KEEPINSTANDBY,
  iadcWarmupKeepWarm = _IADC_CTRL_WARMUPMODE_KEEPWARM
}
 

Functions

uint8_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.
 
uint8_t IADC_calcSrcClkPrescale (IADC_TypeDef *iadc, uint32_t srcClkFreq, uint32_t cmuClkFreq)
 Calculate prescaler for CLK_SRC_ADC high speed clock.
 
uint8_t IADC_calcTimebase (IADC_TypeDef *iadc, uint32_t cmuClkFreq)
 Calculate timebase value in order to get a timebase providing at least 1us.
 
__STATIC_INLINE void IADC_clearInt (IADC_TypeDef *iadc, uint32_t flags)
 Clear one or more pending IADC interrupts.
 
__STATIC_INLINE void IADC_command (IADC_TypeDef *iadc, IADC_Cmd_t cmd)
 Start/stop scan sequence, single conversion and/or timer.
 
__STATIC_INLINE void IADC_disableInt (IADC_TypeDef *iadc, uint32_t flags)
 Disable one or more IADC interrupts.
 
__STATIC_INLINE void IADC_enableInt (IADC_TypeDef *iadc, uint32_t flags)
 Enable one or more IADC interrupts.
 
__STATIC_INLINE uint32_t IADC_getEnabledInt (IADC_TypeDef *iadc)
 Get enabled and pending IADC interrupt flags. Useful for handling more interrupt sources in the same interrupt handler.
 
__STATIC_INLINE uint32_t IADC_getInt (IADC_TypeDef *iadc)
 Get pending IADC interrupt flags.
 
__STATIC_INLINE uint8_t IADC_getScanFifoCnt (IADC_TypeDef *iadc)
 Get number of elements in the IADC scan FIFO.
 
__STATIC_INLINE uint32_t IADC_getScanMask (IADC_TypeDef *iadc)
 Get the scan mask currently used in the IADC.
 
__STATIC_INLINE uint8_t IADC_getSingleFifoCnt (IADC_TypeDef *iadc)
 Get number of elements in the IADC single FIFO.
 
__STATIC_INLINE uint32_t IADC_getStatus (IADC_TypeDef *iadc)
 Get status bits of IADC.
 
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.
 
__STATIC_INLINE IADC_NegInput_t IADC_portPinToNegInput (GPIO_Port_TypeDef port, uint8_t pin)
 Convert GPIO port/pin to IADC negative input selection.
 
__STATIC_INLINE IADC_PosInput_t IADC_portPinToPosInput (GPIO_Port_TypeDef port, uint8_t pin)
 Convert GPIO port/pin to IADC positive input selection.
 
__STATIC_INLINE uint32_t IADC_pullScanFifoData (IADC_TypeDef *iadc)
 Pull data from scan data FIFO. If showId was set for the scan entry initialization, the data will contain the ID of the scan entry.
 
IADC_Result_t IADC_pullScanFifoResult (IADC_TypeDef *iadc)
 Pull result from scan data FIFO. The result struct includes both the data and the ID (0x20) if showId was set when initializing scan entry.
 
__STATIC_INLINE uint32_t IADC_pullSingleFifoData (IADC_TypeDef *iadc)
 Pull data from single data FIFO. If showId was set when initializing single mode, the results will contain the ID (0x20).
 
IADC_Result_t IADC_pullSingleFifoResult (IADC_TypeDef *iadc)
 Pull result from single data FIFO. The result struct includes both the data and the ID (0x20) if showId was set when initializing single mode.
 
__STATIC_INLINE uint32_t IADC_readScanData (IADC_TypeDef *iadc)
 Read most recent scan conversion data. If showId was set for the scan entry initialization, the data will contain the ID of the scan entry. Calling this function will not affect the state of the scan data FIFO.
 
IADC_Result_t IADC_readScanResult (IADC_TypeDef *iadc)
 Read most recent scan conversion result. The result struct includes both the data and the ID (0x20) if showId was set when initializing scan entry. Calling this function will not affect the state of the scan data FIFO.
 
__STATIC_INLINE uint32_t IADC_readSingleData (IADC_TypeDef *iadc)
 Read most recent single conversion data. If showId was set when initializing single mode, the data will contain the ID (0x20). Calling this function will not affect the state of the single data FIFO.
 
IADC_Result_t IADC_readSingleResult (IADC_TypeDef *iadc)
 Read most recent single conversion result. The result struct includes both the data and the ID (0x20) if showId was set when initializing single mode. Calling this function will not affect the state of the single data FIFO.
 
void IADC_reset (IADC_TypeDef *iadc)
 Reset IADC to same state as after a HW reset.
 
__STATIC_INLINE void IADC_setInt (IADC_TypeDef *iadc, uint32_t flags)
 Set one or more pending IADC interrupts from SW.
 
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_updateSingleInput (IADC_TypeDef *iadc, const IADC_SingleInput_t *input)
 Update IADC single input selection.
 

Macro Definition Documentation

#define IADC_ALLCONFIGS_DEFAULT
Value:
{ \
{ \
IADC_CONFIG_DEFAULT, \
IADC_CONFIG_DEFAULT \
} \
}

Default IADC sructure for all configs.

Definition at line 690 of file em_iadc.h.

#define IADC_CONFIG_DEFAULT
Value:
{ \
iadcCfgModeNormal, /* Normal mode for IADC. */ \
iadcCfgOsrHighSpeed2x, /* 2x high speed over sampling. */ \
iadcCfgAnalogGain1x, /* 1x analog gain. */ \
iadcCfgReferenceInt1V2, /* Internal 1.2V band gap reference. */ \
iadcCfgTwosCompAuto, /* Automatic Two's Complement. */ \
0, /* Max IADC analog clock rate. */ \
1210 /* Vref expressed in millivolts. */ \
}

Default IADC config structure.

Definition at line 672 of file em_iadc.h.

#define IADC_INIT_DEFAULT
Value:
{ \
false, /* IADC clock not disabled on PRS0*/ \
false, /* IADC clock not disabld on PRS1 */ \
false, /* Do not halt during debug */ \
iadcWarmupNormal, /* IADC shutdown after each conversion. */ \
0, /* Calculate timebase. */ \
0, /* Max IADC clock rate. */ \
_IADC_TIMER_TIMER_DEFAULT, /* Use HW default value. */ \
_IADC_CMPTHR_ADGT_DEFAULT, /* Use HW default value. */ \
_IADC_CMPTHR_ADLT_DEFAULT, /* Use HW default value. */ \
}

Default config for IADC init structure.

Definition at line 647 of file em_iadc.h.

#define IADC_INITSCAN_DEFAULT
Value:
{ \
iadcAlignRight12, /* Results 12-bit right aligned */ \
false, /* Do not show ID in result */ \
_IADC_SCANFIFOCFG_DVL_DEFAULT, /* Use HW default value. */ \
false, /* Do not wake up DMA on scan FIFO DVL */ \
iadcTriggerSelImmediate, /* Start scan immediately on trigger */ \
iadcTriggerActionOnce, /* Convert once on scan trigger */ \
false /* Do not start scan queue */ \
}

Default config for IADC scan init structure.

Definition at line 710 of file em_iadc.h.

#define IADC_INITSINGLE_DEFAULT
Value:
{ \
iadcAlignRight12, /* Results 12-bit right aligned */ \
false, /* Do not show ID in result */ \
_IADC_SINGLEFIFOCFG_DVL_DEFAULT, /* Use HW default value. */ \
false, /* Do not wake up DMA on single FIFO DVL */ \
iadcTriggerSelImmediate, /* Start single immediately on trigger */ \
iadcTriggerActionOnce, /* Convert once on single trigger */ \
false, /* No tailgating */ \
false /* Do not start single queue */ \
}

Default config for IADC single init structure.

Definition at line 735 of file em_iadc.h.

#define IADC_SCANTABLE_DEFAULT
Value:
{ \
{ \
IADC_SCANTABLEENTRY_DEFAULT, \
IADC_SCANTABLEENTRY_DEFAULT, \
IADC_SCANTABLEENTRY_DEFAULT, \
IADC_SCANTABLEENTRY_DEFAULT, \
IADC_SCANTABLEENTRY_DEFAULT, \
IADC_SCANTABLEENTRY_DEFAULT, \
IADC_SCANTABLEENTRY_DEFAULT, \
IADC_SCANTABLEENTRY_DEFAULT, \
IADC_SCANTABLEENTRY_DEFAULT, \
IADC_SCANTABLEENTRY_DEFAULT, \
IADC_SCANTABLEENTRY_DEFAULT, \
IADC_SCANTABLEENTRY_DEFAULT, \
IADC_SCANTABLEENTRY_DEFAULT, \
IADC_SCANTABLEENTRY_DEFAULT, \
IADC_SCANTABLEENTRY_DEFAULT, \
IADC_SCANTABLEENTRY_DEFAULT \
} \
}

Default IADC sructure for scan table

Definition at line 790 of file em_iadc.h.

#define IADC_SCANTABLEENTRY_DEFAULT
Value:
{ \
iadcNegInputGnd,/* Negative input GND */ \
iadcPosInputGnd,/* Positive input GND */ \
0, /* Config 0 */ \
false, /* Do not compare results */ \
false /* Do not include in scan */ \
}

Default config for IADC scan table entry structure.

Definition at line 774 of file em_iadc.h.

#define IADC_SINGLEINPUT_DEFAULT
Value:
{ \
iadcNegInputGnd, /* Negative input GND */ \
iadcPosInputGnd, /* Positive input GND */ \
0, /* Config 0 */ \
false /* Do not compare results */ \
}

Default config for IADC single input structure.

Definition at line 756 of file em_iadc.h.

Enumeration Type Documentation

IADC result alignment.

Enumerator
iadcAlignRight12 

IADC results 12-bit right aligned

iadcAlignLeft12 

IADC results 12-bit left aligned

Definition at line 73 of file em_iadc.h.

IADC Configuration.

Enumerator
iadcCfgModeNormal 

Normal mode

Definition at line 529 of file em_iadc.h.

IADC Analog Gain.

Enumerator
iadcCfgAnalogGain0P5x 

Analog gain of 0.5x

iadcCfgAnalogGain1x 

Analog gain of 1x

iadcCfgAnalogGain2x 

Analog gain of 2x

iadcCfgAnalogGain3x 

Analog gain of 3x

iadcCfgAnalogGain4x 

Analog gain of 4x

Definition at line 553 of file em_iadc.h.

IADC Over sampling rate for high speed.

Enumerator
iadcCfgOsrHighSpeed2x 

High speed oversampling of 2x

iadcCfgOsrHighSpeed4x 

High speed oversampling of 4x

iadcCfgOsrHighSpeed8x 

High speed oversampling of 8x

iadcCfgOsrHighSpeed16x 

High speed oversampling of 16x

iadcCfgOsrHighSpeed32x 

High speed oversampling of 32x

Definition at line 535 of file em_iadc.h.

IADC Reference

Enumerator
iadcCfgReferenceInt1V2 

Internal 1.2V Band Gap Reference (buffered) to ground

iadcCfgReferenceExt1V25 

External reference (unbuffered) VREFP to VREFN. Up to 1.25V.

iadcCfgReferenceVddx 

VDDX (unbuffered) to ground.

iadcCfgReferenceVddX0P8Buf 

0.8 * VDDX (buffered) to ground.

Definition at line 571 of file em_iadc.h.

IADC Two's complement results

Enumerator
iadcCfgTwosCompAuto 

Automatic. Single ended => Unipolar, Differential => Bipolar

iadcCfgTwosCompUnipolar 

All results in unipolar format. Negative diff input gives 0 as result.

iadcCfgTwosCompBipolar 

All results in bipolar (2's complement) format. Half range for SE.

Definition at line 586 of file em_iadc.h.

enum IADC_Cmd_t

IADC Commands.

Enumerator
iadcCmdStartSingle 

Start single queue

iadcCmdStopSingle 

Stop single queue

iadcCmdStartScan 

Start scan queue

iadcCmdStopScan 

Stop scan queue

iadcCmdEnableTimer 

Enable Timer

iadcCmdDisableTimer 

Disable Timer

Definition at line 508 of file em_iadc.h.

IADC negative input selection.

Enumerator
iadcNegInputGnd 

Ground

iadcNegInputNegRef 

Negative reference pin 0

iadcNegInputPortAPin0 

GPIO port A pin 0

iadcNegInputPortAPin1 

GPIO port A pin 1

iadcNegInputPortAPin2 

GPIO port A pin 2

iadcNegInputPortAPin3 

GPIO port A pin 3

iadcNegInputPortAPin4 

GPIO port A pin 4

iadcNegInputPortAPin5 

GPIO port A pin 5

iadcNegInputPortAPin6 

GPIO port A pin 6

iadcNegInputPortAPin7 

GPIO port A pin 7

iadcNegInputPortAPin8 

GPIO port A pin 8

iadcNegInputPortAPin9 

GPIO port A pin 9

iadcNegInputPortAPin10 

GPIO port A pin 10

iadcNegInputPortAPin11 

GPIO port A pin 11

iadcNegInputPortAPin12 

GPIO port A pin 12

iadcNegInputPortAPin13 

GPIO port A pin 13

iadcNegInputPortAPin14 

GPIO port A pin 14

iadcNegInputPortAPin15 

GPIO port A pin 15

iadcNegInputPortBPin0 

GPIO port B pin 0

iadcNegInputPortBPin1 

GPIO port B pin 1

iadcNegInputPortBPin2 

GPIO port B pin 2

iadcNegInputPortBPin3 

GPIO port B pin 3

iadcNegInputPortBPin4 

GPIO port B pin 4

iadcNegInputPortBPin5 

GPIO port B pin 5

iadcNegInputPortBPin6 

GPIO port B pin 6

iadcNegInputPortBPin7 

GPIO port B pin 7

iadcNegInputPortBPin8 

GPIO port B pin 8

iadcNegInputPortBPin9 

GPIO port B pin 9

iadcNegInputPortBPin10 

GPIO port B pin 10

iadcNegInputPortBPin11 

GPIO port B pin 11

iadcNegInputPortBPin12 

GPIO port B pin 12

iadcNegInputPortBPin13 

GPIO port B pin 13

iadcNegInputPortBPin14 

GPIO port B pin 14

iadcNegInputPortBPin15 

GPIO port B pin 15

iadcNegInputPortCPin0 

GPIO port C pin 0

iadcNegInputPortCPin1 

GPIO port C pin 1

iadcNegInputPortCPin2 

GPIO port C pin 2

iadcNegInputPortCPin3 

GPIO port C pin 3

iadcNegInputPortCPin4 

GPIO port C pin 4

iadcNegInputPortCPin5 

GPIO port C pin 5

iadcNegInputPortCPin6 

GPIO port C pin 6

iadcNegInputPortCPin7 

GPIO port C pin 7

iadcNegInputPortCPin8 

GPIO port C pin 8

iadcNegInputPortCPin9 

GPIO port C pin 9

iadcNegInputPortCPin10 

GPIO port C pin 10

iadcNegInputPortCPin11 

GPIO port C pin 11

iadcNegInputPortCPin12 

GPIO port C pin 12

iadcNegInputPortCPin13 

GPIO port C pin 13

iadcNegInputPortCPin14 

GPIO port C pin 14

iadcNegInputPortCPin15 

GPIO port C pin 15

iadcNegInputPortDPin0 

GPIO port D pin 0

iadcNegInputPortDPin1 

GPIO port D pin 1

iadcNegInputPortDPin2 

GPIO port D pin 2

iadcNegInputPortDPin3 

GPIO port D pin 3

iadcNegInputPortDPin4 

GPIO port D pin 4

iadcNegInputPortDPin5 

GPIO port D pin 5

iadcNegInputPortDPin6 

GPIO port D pin 6

iadcNegInputPortDPin7 

GPIO port D pin 7

iadcNegInputPortDPin8 

GPIO port D pin 8

iadcNegInputPortDPin9 

GPIO port D pin 9

iadcNegInputPortDPin10 

GPIO port D pin 10

iadcNegInputPortDPin11 

GPIO port D pin 11

iadcNegInputPortDPin12 

GPIO port D pin 12

iadcNegInputPortDPin13 

GPIO port D pin 13

iadcNegInputPortDPin14 

GPIO port D pin 14

iadcNegInputPortDPin15 

GPIO port D pin 15

Definition at line 82 of file em_iadc.h.

IADC positive port selection.

Enumerator
iadcPosInputGnd 

Ground

iadcPosInputAvdd 

Avdd

iadcPosInputVddio 

Vddio

iadcPosInputVss 

Vss

iadcPosInputDvdd 

Dvdd

iadcPosInputVddx 

Vddx

iadcPosInputVddlv 

Vddlv

iadcPosInputPosRef 

Positive reference pin 0

iadcPosInputPortAPin0 

GPIO port A pin 0

iadcPosInputPortAPin1 

GPIO port A pin 1

iadcPosInputPortAPin2 

GPIO port A pin 2

iadcPosInputPortAPin3 

GPIO port A pin 3

iadcPosInputPortAPin4 

GPIO port A pin 4

iadcPosInputPortAPin5 

GPIO port A pin 5

iadcPosInputPortAPin6 

GPIO port A pin 6

iadcPosInputPortAPin7 

GPIO port A pin 7

iadcPosInputPortAPin8 

GPIO port A pin 8

iadcPosInputPortAPin9 

GPIO port A pin 9

iadcPosInputPortAPin10 

GPIO port A pin 10

iadcPosInputPortAPin11 

GPIO port A pin 11

iadcPosInputPortAPin12 

GPIO port A pin 12

iadcPosInputPortAPin13 

GPIO port A pin 13

iadcPosInputPortAPin14 

GPIO port A pin 14

iadcPosInputPortAPin15 

GPIO port A pin 15

iadcPosInputPortBPin0 

GPIO port B pin 0

iadcPosInputPortBPin1 

GPIO port B pin 1

iadcPosInputPortBPin2 

GPIO port B pin 2

iadcPosInputPortBPin3 

GPIO port B pin 3

iadcPosInputPortBPin4 

GPIO port B pin 4

iadcPosInputPortBPin5 

GPIO port B pin 5

iadcPosInputPortBPin6 

GPIO port B pin 6

iadcPosInputPortBPin7 

GPIO port B pin 7

iadcPosInputPortBPin8 

GPIO port B pin 8

iadcPosInputPortBPin9 

GPIO port B pin 9

iadcPosInputPortBPin10 

GPIO port B pin 10

iadcPosInputPortBPin11 

GPIO port B pin 11

iadcPosInputPortBPin12 

GPIO port B pin 12

iadcPosInputPortBPin13 

GPIO port B pin 13

iadcPosInputPortBPin14 

GPIO port B pin 14

iadcPosInputPortBPin15 

GPIO port B pin 15

iadcPosInputPortCPin0 

GPIO port C pin 0

iadcPosInputPortCPin1 

GPIO port C pin 1

iadcPosInputPortCPin2 

GPIO port C pin 2

iadcPosInputPortCPin3 

GPIO port C pin 3

iadcPosInputPortCPin4 

GPIO port C pin 4

iadcPosInputPortCPin5 

GPIO port C pin 5

iadcPosInputPortCPin6 

GPIO port C pin 6

iadcPosInputPortCPin7 

GPIO port C pin 7

iadcPosInputPortCPin8 

GPIO port C pin 8

iadcPosInputPortCPin9 

GPIO port C pin 9

iadcPosInputPortCPin10 

GPIO port C pin 10

iadcPosInputPortCPin11 

GPIO port C pin 11

iadcPosInputPortCPin12 

GPIO port C pin 12

iadcPosInputPortCPin13 

GPIO port C pin 13

iadcPosInputPortCPin14 

GPIO port C pin 14

iadcPosInputPortCPin15 

GPIO port C pin 15

iadcPosInputPortDPin0 

GPIO port D pin 0

iadcPosInputPortDPin1 

GPIO port D pin 1

iadcPosInputPortDPin2 

GPIO port D pin 2

iadcPosInputPortDPin3 

GPIO port D pin 3

iadcPosInputPortDPin4 

GPIO port D pin 4

iadcPosInputPortDPin5 

GPIO port D pin 5

iadcPosInputPortDPin6 

GPIO port D pin 6

iadcPosInputPortDPin7 

GPIO port D pin 7

iadcPosInputPortDPin8 

GPIO port D pin 8

iadcPosInputPortDPin9 

GPIO port D pin 9

iadcPosInputPortDPin10 

GPIO port D pin 10

iadcPosInputPortDPin11 

GPIO port D pin 11

iadcPosInputPortDPin12 

GPIO port D pin 12

iadcPosInputPortDPin13 

GPIO port D pin 13

iadcPosInputPortDPin14 

GPIO port D pin 14

iadcPosInputPortDPin15 

GPIO port D pin 15

Definition at line 283 of file em_iadc.h.

IADC trigger action

Enumerator
iadcTriggerActionOnce 

Convert single/scan queue once per trigger

iadcTriggerActionContinuous 

Convert single/scan queue continuously

Definition at line 616 of file em_iadc.h.

IADC trigger action

Enumerator
iadcTriggerSelImmediate 

Start single/scan queue immediately

iadcTriggerSelTimer 

Timer starts single/scan queue

iadcTriggerSelPrs0SameClk 

PRS0 from timer in same clock group starts single/scan queue

iadcTriggerSelPrs0PosEdge 

PRS0 positive edge starts single/scan queue

iadcTriggerSelPrs0NegEdge 

PRS0 negative edge starts single/scan queue

Definition at line 598 of file em_iadc.h.

Warm-up mode.

Enumerator
iadcWarmupNormal 

IADC shutdown after each conversion.

iadcWarmupKeepInStandby 

ADC is kept in standby mode between conversion.

iadcWarmupKeepWarm 

ADC and reference selected for scan mode kept warmup, allowing continuous conversion.

Definition at line 60 of file em_iadc.h.

Function Documentation

uint8_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.

The ADC_CLK is given by: CLK_SRC_ADC / (adcClkprescale + 1).

Parameters
[in]iadcPointer to IADC peripheral register block.
[in]adcClkFreqADC_CLK frequency wanted. The frequency will automatically be adjusted to be within valid range according to reference manual.
[in]CmuClkFreqFrequency in Hz of CLK_CMU_ADC Set to 0 to use currently defined IADC clock setting (in CMU).
[in]adcModeMode for IADC config.
[in]srcClkPrescalerPrecaler setting for ADC_CLK
Returns
Divider value to use for IADC in order to achieve a ADC_CLK frequency <= adcClkFreq.

Definition at line 812 of file em_iadc.c.

References _IADC_SCHED_PRESCALE_MASK, _IADC_SCHED_PRESCALE_SHIFT, CMU_ClockFreqGet(), and SL_MIN.

Referenced by IADC_init().

uint8_t IADC_calcSrcClkPrescale ( IADC_TypeDef iadc,
uint32_t  srcClkFreq,
uint32_t  cmuClkFreq 
)

Calculate prescaler for CLK_SRC_ADC high speed clock.

The IADC high speed clock is given by: CLK_SRC_ADC / (srcClkPrescaler + 1).

Parameters
[in]iadcPointer to IADC peripheral register block.
[in]srcClkFreqCLK_SRC_ADC frequency wanted. The frequency will automatically be adjusted to be within valid range according to reference manual.
[in]cmuClkFreqFrequency in Hz of reference CLK_CMU_ADC. Set to 0 to use currently defined CMU clock setting for the IADC.
Returns
Divider value to use for IADC in order to achieve a high speed clock value <= srcClkFreq.

Definition at line 758 of file em_iadc.c.

References _IADC_CTRL_HSCLKRATE_DIV4, CMU_ClockFreqGet(), and SL_MIN.

Referenced by IADC_init().

uint8_t IADC_calcTimebase ( IADC_TypeDef iadc,
uint32_t  cmuClkFreq 
)

Calculate timebase value in order to get a timebase providing at least 1us.

Parameters
[in]iadcPointer to IADC peripheral register block.
[in]cmuClkFreqFrequency in Hz of reference CLK_CMU_ADC clock. Set to 0 to use currently defined CMU clock setting for the IADC.
Returns
Timebase value to use for IADC in order to achieve at least 1 us.

Definition at line 711 of file em_iadc.c.

References _IADC_CTRL_TIMEBASE_MASK, _IADC_CTRL_TIMEBASE_SHIFT, CMU_ClockFreqGet(), and SL_MIN.

Referenced by IADC_init().

__STATIC_INLINE void IADC_clearInt ( IADC_TypeDef iadc,
uint32_t  flags 
)

Clear one or more pending IADC interrupts.

Parameters
[in]iadcPointer to IADC peripheral register block.
[in]flagsPending IADC interrupt source to clear. Use a bitwise logic OR combination of valid interrupt flags for the IADC module (IADC_IF_nnn).

Definition at line 940 of file em_iadc.h.

References IADC_TypeDef::IF_CLR.

Referenced by IADC_reset().

__STATIC_INLINE void IADC_command ( IADC_TypeDef iadc,
IADC_Cmd_t  cmd 
)

Start/stop scan sequence, single conversion and/or timer.

Parameters
[in]iadcPointer to IADC peripheral register block.
[in]cmdCommand to be performed.

Definition at line 1062 of file em_iadc.h.

References IADC_TypeDef::CMD.

Referenced by IADC_initScan(), and IADC_initSingle().

__STATIC_INLINE void IADC_disableInt ( IADC_TypeDef iadc,
uint32_t  flags 
)

Disable one or more IADC interrupts.

Parameters
[in]iadcPointer to IADC peripheral register block.
[in]flagsIADC interrupt sources to disable. Use a bitwise logic OR combination of valid interrupt flags for the IADC module (IADC_IF_nnn).

Definition at line 956 of file em_iadc.h.

References IADC_TypeDef::IEN, and IADC_TypeDef::IEN_CLR.

Referenced by IADC_reset().

__STATIC_INLINE void IADC_enableInt ( IADC_TypeDef iadc,
uint32_t  flags 
)

Enable one or more IADC interrupts.

Note
Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. Consider using IADC_intClear() prior to enabling if such a pending interrupt should be ignored.
Parameters
[in]iadcPointer to IADC peripheral register block.
[in]flagsIADC interrupt sources to enable. Use a bitwise logic OR combination of valid interrupt flags for the IADC module (IADC_IF_nnn).

Definition at line 981 of file em_iadc.h.

References IADC_TypeDef::IEN.

__STATIC_INLINE uint32_t IADC_getEnabledInt ( IADC_TypeDef iadc)

Get enabled and pending IADC interrupt flags. Useful for handling more interrupt sources in the same interrupt handler.

Note
Interrupt flags are not cleared by the use of this function.
Parameters
[in]iadcPointer to IADC peripheral register block.
Returns
Pending and enabled IADC interrupt sources. The return value is the bitwise AND combination of
  • the OR combination of enabled interrupt sources in IADCx_IEN_nnn register (IADCx_IEN_nnn) and
  • the OR combination of valid interrupt flags of the IADC module (IADCx_IF_nnn).

Definition at line 1024 of file em_iadc.h.

References IADC_TypeDef::IEN, and IADC_TypeDef::IF.

__STATIC_INLINE uint32_t IADC_getInt ( IADC_TypeDef iadc)

Get pending IADC interrupt flags.

Note
The event bits are not cleared by the use of this function.
Parameters
[in]iadcPointer to IADC peripheral register block.
Returns
IADC interrupt sources pending. A bitwise logic OR combination of valid interrupt flags for the IADC module (IADC_IF_nnn).

Definition at line 1000 of file em_iadc.h.

References IADC_TypeDef::IF.

__STATIC_INLINE uint8_t IADC_getScanFifoCnt ( IADC_TypeDef iadc)

Get number of elements in the IADC scan FIFO.

Parameters
[in]iadcPointer to IADC peripheral register block.
Returns
Number of elements in scan FIFO

Definition at line 1123 of file em_iadc.h.

References _IADC_SCANFIFOSTAT_FIFOREADCNT_MASK, _IADC_SCANFIFOSTAT_FIFOREADCNT_SHIFT, and IADC_TypeDef::SCANFIFOSTAT.

__STATIC_INLINE uint32_t IADC_getScanMask ( IADC_TypeDef iadc)

Get the scan mask currently used in the IADC.

Parameters
[in]iadcPointer to IADC peripheral register block.
Returns
Mask of scan table entries currently included in scan.

Definition at line 1077 of file em_iadc.h.

References _IADC_STMASK_STMASK_SHIFT, and IADC_TypeDef::STMASK.

__STATIC_INLINE uint8_t IADC_getSingleFifoCnt ( IADC_TypeDef iadc)

Get number of elements in the IADC single FIFO.

Parameters
[in]iadcPointer to IADC peripheral register block.
Returns
Number of elements in single FIFO

Definition at line 1107 of file em_iadc.h.

References _IADC_SINGLEFIFOSTAT_FIFOREADCNT_MASK, _IADC_SINGLEFIFOSTAT_FIFOREADCNT_SHIFT, and IADC_TypeDef::SINGLEFIFOSTAT.

__STATIC_INLINE uint32_t IADC_getStatus ( IADC_TypeDef iadc)

Get status bits of IADC.

Parameters
[in]iadcPointer to IADC peripheral register block.
Returns
IADC status bits

Definition at line 1092 of file em_iadc.h.

References IADC_TypeDef::STATUS.

void IADC_init ( IADC_TypeDef iadc,
const IADC_Init_t init,
const IADC_AllConfigs_t allConfigs 
)

Initialize IADC.

Initializes common parts for both single conversion and scan sequence. In addition, single and/or scan control configuration must be done, please refer to IADC_initSingle() and IADC_initScan() respectively.

Note
This function will stop any ongoing conversions.
Parameters
[in]iadcPointer to IADC peripheral register block.
[in]initPointer to IADC initialization structure.
[in]allConfigsPointer to structure holding all configs.

Definition at line 171 of file em_iadc.c.

References _DEVINFO_IADC0GAIN0_GAINCANA1_MASK, _DEVINFO_IADC0GAIN0_GAINCANA2_SHIFT, _DEVINFO_IADC0GAIN1_GAINCANA3_MASK, _DEVINFO_IADC0GAIN1_GAINCANA4_SHIFT, _DEVINFO_IADC0NORMALOFFSETCAL0_OFFSETANA1NORM_MASK, _DEVINFO_IADC0NORMALOFFSETCAL0_OFFSETANA2NORM_SHIFT, _DEVINFO_IADC0NORMALOFFSETCAL1_OFFSETANA3NORM_MASK, _DEVINFO_IADC0OFFSETCAL0_OFFSETANABASE_MASK, _IADC_CFG_ADCMODE_MASK, _IADC_CFG_ADCMODE_SHIFT, _IADC_CFG_ANALOGGAIN_ANAGAIN0P5, _IADC_CFG_ANALOGGAIN_ANAGAIN1, _IADC_CFG_ANALOGGAIN_ANAGAIN2, _IADC_CFG_ANALOGGAIN_ANAGAIN3, _IADC_CFG_ANALOGGAIN_MASK, _IADC_CFG_ANALOGGAIN_SHIFT, _IADC_CFG_OSRHS_MASK, _IADC_CFG_OSRHS_SHIFT, _IADC_CFG_REFSEL_MASK, _IADC_CFG_REFSEL_SHIFT, _IADC_CFG_TWOSCOMPL_MASK, _IADC_CFG_TWOSCOMPL_SHIFT, _IADC_CMPTHR_ADGT_MASK, _IADC_CMPTHR_ADGT_SHIFT, _IADC_CMPTHR_ADLT_MASK, _IADC_CMPTHR_ADLT_SHIFT, _IADC_CTRL_HSCLKRATE_MASK, _IADC_CTRL_HSCLKRATE_SHIFT, _IADC_CTRL_TIMEBASE_MASK, _IADC_CTRL_TIMEBASE_SHIFT, _IADC_CTRL_WARMUPMODE_MASK, _IADC_CTRL_WARMUPMODE_SHIFT, _IADC_SCALE_GAIN13LSB_SHIFT, _IADC_SCHED_PRESCALE_MASK, _IADC_SCHED_PRESCALE_SHIFT, _IADC_TIMER_TIMER_MASK, _IADC_TIMER_TIMER_SHIFT, IADC_Config_t::adcClkPrescale, IADC_Config_t::adcMode, IADC_Config_t::analogGain, IADC_CFG_TypeDef::CFG, IADC_TypeDef::CFG, IADC_TypeDef::CMPTHR, IADC_AllConfigs_t::configs, IADC_TypeDef::CTRL, IADC_Init_t::debugHalt, DEVINFO, IADC_Init_t::greaterThanEqualThres, IADC_calcAdcClkPrescale(), IADC_calcSrcClkPrescale(), IADC_calcTimebase(), IADC_CTRL_ADCCLKSUSPEND0, IADC_CTRL_ADCCLKSUSPEND1, IADC_CTRL_DBGHALT, IADC_SCALE_GAIN3MSB, iadcCfgModeNormal, IADC_Init_t::iadcClkSuspend0, IADC_Init_t::iadcClkSuspend1, IADC_Init_t::lessThanEqualThres, IADC_Config_t::osrHighSpeed, IADC_Config_t::reference, IADC_CFG_TypeDef::SCALE, IADC_CFG_TypeDef::SCHED, SL_MAX, IADC_Init_t::srcClkPrescale, IADC_Init_t::timebase, IADC_TypeDef::TIMER, IADC_Init_t::timerCycles, IADC_Config_t::twosComplement, IADC_Config_t::vRef, and IADC_Init_t::warmup.

void IADC_initScan ( IADC_TypeDef iadc,
const IADC_InitScan_t init,
const IADC_ScanTable_t scanTable 
)

Initialize IADC scan sequence.

This function will configure scan mode and set up entries in the scan table. The scan table mask can be updated by calling IADC_updateScanMask.

Note
This function will stop any ongoing conversions.
If an even numbered pin is selected for the positive input, the negative input must use an odd numbered pin and vice versa.
Parameters
[in]iadcPointer to IADC peripheral register block.
[in]initPointer to IADC initialization structure.
[in]scanTablePointer to IADC scan table structure.

Definition at line 375 of file em_iadc.c.

References _IADC_MASKREQ_MASKREQ_SHIFT, _IADC_SCAN_CFG_MASK, _IADC_SCAN_CFG_SHIFT, _IADC_SCAN_PINNEG_MASK, _IADC_SCAN_PINNEG_SHIFT, _IADC_SCAN_PINPOS_MASK, _IADC_SCAN_PINPOS_SHIFT, _IADC_SCAN_PORTNEG_MASK, _IADC_SCAN_PORTPOS_MASK, _IADC_SCANFIFOCFG_ALIGNMENT_MASK, _IADC_SCANFIFOCFG_ALIGNMENT_SHIFT, _IADC_SCANFIFOCFG_DVL_MASK, _IADC_SCANFIFOCFG_DVL_SHIFT, _IADC_TRIGGER_SCANTRIGACTION_MASK, _IADC_TRIGGER_SCANTRIGACTION_SHIFT, _IADC_TRIGGER_SCANTRIGSEL_MASK, _IADC_TRIGGER_SCANTRIGSEL_SHIFT, IADC_InitScan_t::alignment, IADC_ScanTableEntry_t::compare, IADC_ScanTableEntry_t::configId, IADC_InitScan_t::dataValidLevel, IADC_ScanTable_t::entries, IADC_InitScan_t::fifoDmaWakeup, IADC_command(), IADC_SCAN_CMP, IADC_SCANFIFOCFG_DMAWUFIFOSCAN, IADC_SCANFIFOCFG_SHOWID, iadcCmdStartScan, IADC_ScanTableEntry_t::includeInScan, IADC_TypeDef::MASKREQ, IADC_ScanTableEntry_t::negInput, IADC_ScanTableEntry_t::posInput, IADC_SCANTABLE_TypeDef::SCAN, IADC_TypeDef::SCANFIFOCFG, IADC_TypeDef::SCANTABLE, IADC_InitScan_t::showId, IADC_InitScan_t::start, IADC_TypeDef::TRIGGER, IADC_InitScan_t::triggerAction, and IADC_InitScan_t::triggerSelect.

void IADC_initSingle ( IADC_TypeDef iadc,
const IADC_InitSingle_t init,
const IADC_SingleInput_t input 
)

Initialize single IADC conversion.

This function will initialize the single conversion and configure the single input selection.

Note
This function will stop any ongoing conversions.
If an even numbered pin is selected for the positive input, the negative input must use an odd numbered pin and vice versa.
Parameters
[in]iadcPointer to IADC peripheral register block.
[in]initPointer to IADC single initialization structure.
[in]singleInputPointer to IADC single input selection initialization structure.

Definition at line 450 of file em_iadc.c.

References _IADC_SINGLEFIFOCFG_ALIGNMENT_MASK, _IADC_SINGLEFIFOCFG_ALIGNMENT_SHIFT, _IADC_SINGLEFIFOCFG_DVL_MASK, _IADC_SINGLEFIFOCFG_DVL_SHIFT, _IADC_TRIGGER_SINGLETAILGATE_MASK, _IADC_TRIGGER_SINGLETRIGACTION_MASK, _IADC_TRIGGER_SINGLETRIGACTION_SHIFT, _IADC_TRIGGER_SINGLETRIGSEL_MASK, _IADC_TRIGGER_SINGLETRIGSEL_SHIFT, IADC_InitSingle_t::alignment, IADC_InitSingle_t::dataValidLevel, IADC_InitSingle_t::fifoDmaWakeup, IADC_command(), IADC_SINGLEFIFOCFG_DMAWUFIFOSINGLE, IADC_SINGLEFIFOCFG_SHOWID, IADC_TRIGGER_SINGLETAILGATE, IADC_updateSingleInput(), iadcCmdStartSingle, IADC_InitSingle_t::showId, IADC_TypeDef::SINGLEFIFOCFG, IADC_InitSingle_t::singleTailgate, IADC_InitSingle_t::start, IADC_TypeDef::TRIGGER, IADC_InitSingle_t::triggerAction, and IADC_InitSingle_t::triggerSelect.

__STATIC_INLINE IADC_NegInput_t IADC_portPinToNegInput ( GPIO_Port_TypeDef  port,
uint8_t  pin 
)

Convert GPIO port/pin to IADC negative input selection.

Parameters
[in]portGPIO port
[in]pinGPIO in
Returns
IADC negative input selection

Definition at line 1142 of file em_iadc.h.

References _IADC_SCAN_PORTNEG_PORTA.

__STATIC_INLINE IADC_PosInput_t IADC_portPinToPosInput ( GPIO_Port_TypeDef  port,
uint8_t  pin 
)

Convert GPIO port/pin to IADC positive input selection.

Parameters
[in]portGPIO port
[in]pinGPIO in
Returns
IADC positive input selection

Definition at line 1163 of file em_iadc.h.

References _IADC_SCAN_PORTPOS_PORTA.

__STATIC_INLINE uint32_t IADC_pullScanFifoData ( IADC_TypeDef iadc)

Pull data from scan data FIFO. If showId was set for the scan entry initialization, the data will contain the ID of the scan entry.

Note
Check data valid flag before calling this function.
Parameters
[in]iadcPointer to IADC peripheral register block.
Returns
Scan conversion data.

Definition at line 904 of file em_iadc.h.

References IADC_TypeDef::SCANFIFODATA.

Referenced by IADC_reset().

IADC_Result_t IADC_pullScanFifoResult ( IADC_TypeDef iadc)

Pull result from scan data FIFO. The result struct includes both the data and the ID (0x20) if showId was set when initializing scan entry.

Note
Check data valid flag before calling this function.
Parameters
[in]iadcPointer to IADC peripheral register block.
Returns
Scan conversion result struct holding data and id.

Definition at line 909 of file em_iadc.c.

References _IADC_SCANFIFOCFG_ALIGNMENT_MASK, _IADC_SCANFIFOCFG_ALIGNMENT_SHIFT, IADC_TypeDef::SCANFIFOCFG, and IADC_TypeDef::SCANFIFODATA.

__STATIC_INLINE uint32_t IADC_pullSingleFifoData ( IADC_TypeDef iadc)

Pull data from single data FIFO. If showId was set when initializing single mode, the results will contain the ID (0x20).

Note
Check data valid flag before calling this function.
Parameters
[in]iadcPointer to IADC peripheral register block.
Returns
Single conversion data.

Definition at line 865 of file em_iadc.h.

References IADC_TypeDef::SINGLEFIFODATA.

Referenced by IADC_reset().

IADC_Result_t IADC_pullSingleFifoResult ( IADC_TypeDef iadc)

Pull result from single data FIFO. The result struct includes both the data and the ID (0x20) if showId was set when initializing single mode.

Note
Check data valid flag before calling this function.
Parameters
[in]iadcPointer to IADC peripheral register block.
Returns
Single conversion result struct holding data and id.

Definition at line 864 of file em_iadc.c.

References _IADC_SINGLEFIFOCFG_ALIGNMENT_MASK, _IADC_SINGLEFIFOCFG_ALIGNMENT_SHIFT, IADC_TypeDef::SINGLEFIFOCFG, and IADC_TypeDef::SINGLEFIFODATA.

__STATIC_INLINE uint32_t IADC_readScanData ( IADC_TypeDef iadc)

Read most recent scan conversion data. If showId was set for the scan entry initialization, the data will contain the ID of the scan entry. Calling this function will not affect the state of the scan data FIFO.

Note
Check data valid flag before calling this function.
Parameters
[in]iadcPointer to IADC peripheral register block.
Returns
Scan conversion data.

Definition at line 924 of file em_iadc.h.

References IADC_TypeDef::SCANDATA.

Referenced by IADC_reset().

IADC_Result_t IADC_readScanResult ( IADC_TypeDef iadc)

Read most recent scan conversion result. The result struct includes both the data and the ID (0x20) if showId was set when initializing scan entry. Calling this function will not affect the state of the scan data FIFO.

Note
Check data valid flag before calling this function.
Parameters
[in]iadcPointer to IADC peripheral register block.
Returns
Scan conversion result struct holding data and id.

Definition at line 932 of file em_iadc.c.

References _IADC_SCANFIFOCFG_ALIGNMENT_MASK, _IADC_SCANFIFOCFG_ALIGNMENT_SHIFT, IADC_TypeDef::SCANDATA, and IADC_TypeDef::SCANFIFOCFG.

__STATIC_INLINE uint32_t IADC_readSingleData ( IADC_TypeDef iadc)

Read most recent single conversion data. If showId was set when initializing single mode, the data will contain the ID (0x20). Calling this function will not affect the state of the single data FIFO.

Note
Check data valid flag before calling this function.
Parameters
[in]iadcPointer to IADC peripheral register block.
Returns
Single conversion data.

Definition at line 885 of file em_iadc.h.

References IADC_TypeDef::SINGLEDATA.

Referenced by IADC_reset().

IADC_Result_t IADC_readSingleResult ( IADC_TypeDef iadc)

Read most recent single conversion result. The result struct includes both the data and the ID (0x20) if showId was set when initializing single mode. Calling this function will not affect the state of the single data FIFO.

Note
Check data valid flag before calling this function.
Parameters
[in]iadcPointer to IADC peripheral register block.
Returns
Single conversion result struct holding data and id.

Definition at line 887 of file em_iadc.c.

References _IADC_SINGLEFIFOCFG_ALIGNMENT_MASK, _IADC_SINGLEFIFOCFG_ALIGNMENT_SHIFT, IADC_TypeDef::SINGLEDATA, and IADC_TypeDef::SINGLEFIFOCFG.

__STATIC_INLINE void IADC_setInt ( IADC_TypeDef iadc,
uint32_t  flags 
)

Set one or more pending IADC interrupts from SW.

Parameters
[in]iadcPointer to IADC peripheral register block.
[in]flagsIADC interrupt sources to set to pending. Use a bitwise logic OR combination of valid interrupt flags for the IADC module (IADC_IF_nnn).

Definition at line 1047 of file em_iadc.h.

References IADC_TypeDef::IF_SET.

void IADC_setScanMask ( IADC_TypeDef iadc,
uint32_t  mask 
)

Set mask of IADC scan table entries to include in scan.

Set mask of scan table entries to include in next scan. This function can be called while scan conversions are ongoing, but the new scan mask will take effect once the ongoing scan is completed.

Parameters
[in]iadcPointer to IADC peripheral register block.
[in]maskMask of scan table entries to include in scan.

Definition at line 543 of file em_iadc.c.

References _IADC_MASKREQ_MASKREQ_MASK, _IADC_MASKREQ_MASKREQ_SHIFT, IADC_TypeDef::EN, IADC_EN_EN, and IADC_TypeDef::MASKREQ.

void IADC_updateScanEntry ( IADC_TypeDef iadc,
uint8_t  id,
IADC_ScanTableEntry_t entry 
)

Add/update entry in scan table.

This function will update or add an entry in the scan table with a specific ID.

Note
This function will stop any ongoing conversions.
Parameters
[in]iadcPointer to IADC peripheral register block.
[in]idId of scan table entry to add.
[in]entryPointer to scan table entry structure.

Definition at line 585 of file em_iadc.c.

References _IADC_MASKREQ_MASKREQ_SHIFT, _IADC_SCAN_CFG_MASK, _IADC_SCAN_CFG_SHIFT, _IADC_SCAN_PINNEG_MASK, _IADC_SCAN_PINNEG_SHIFT, _IADC_SCAN_PINPOS_MASK, _IADC_SCAN_PINPOS_SHIFT, _IADC_SCAN_PORTNEG_MASK, _IADC_SCAN_PORTPOS_MASK, IADC_ScanTableEntry_t::compare, IADC_ScanTableEntry_t::configId, IADC_TypeDef::EN, IADC_EN_EN, IADC_SCAN_CMP, IADC_ScanTableEntry_t::includeInScan, IADC_TypeDef::MASKREQ_CLR, IADC_TypeDef::MASKREQ_SET, IADC_ScanTableEntry_t::negInput, IADC_ScanTableEntry_t::posInput, IADC_SCANTABLE_TypeDef::SCAN, and IADC_TypeDef::SCANTABLE.

void IADC_updateSingleInput ( IADC_TypeDef iadc,
const IADC_SingleInput_t input 
)

Update IADC single input selection.

This function updates the single input selection. The function can be called while single and/or scan conversions are ongoing and the new input configuration will take place on the next single conversion.

Note
If an even numbered pin is selected for the positive input, the negative input must use an odd numbered pin and vice versa.
Parameters
[in]iadcPointer to IADC peripheral register block.
[in]inputPointer to single input selection structure.

Definition at line 502 of file em_iadc.c.

References _IADC_SINGLE_CFG_MASK, _IADC_SINGLE_CFG_SHIFT, _IADC_SINGLE_PINNEG_MASK, _IADC_SINGLE_PINNEG_SHIFT, _IADC_SINGLE_PINPOS_MASK, _IADC_SINGLE_PINPOS_SHIFT, _IADC_SINGLE_PORTNEG_MASK, _IADC_SINGLE_PORTPOS_MASK, IADC_SingleInput_t::compare, IADC_SingleInput_t::configId, IADC_TypeDef::EN, IADC_EN_EN, IADC_SINGLE_CMP, IADC_SingleInput_t::negInput, IADC_SingleInput_t::posInput, and IADC_TypeDef::SINGLE.

Referenced by IADC_initSingle().