IADC - Incremental ADC#

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.

Introduction#

The IADC provides high-accuracy analog-to-digital conversion with incremental/sigma-delta operation for improved resolution. It's designed for precision measurements and offers various operating modes.


Example#

IADC Basic example:

{
  // Initialize IADC
  sl_hal_iadc_init_t init = {
    .iadc_clk_suspend0 = false,
    .iadc_clk_suspend1 = false,
    .debug_halt = false,
    .warmup = SL_HAL_IADC_WARMUP_NORMAL,
    .timebase = 0,              // Will be calculated automatically
    .src_clk_prescale = 0,
    .timer_cycles = 1000        // Timer period in ADC_CLK cycles
  };

  // IADC scan configuration
  sl_hal_iadc_init_scan_t scan_init = {
    .alignment = SL_HAL_IADC_ALIGNMENT_RIGHT_12,
    .show_id = true,
    .data_valid_level = SL_HAL_IADC_DATA_VALID_1,
    .fifo_dma_wakeup = false,
    .trigger_select = SL_HAL_IADC_TRIGGER_IMMEDIATE,
    .trigger_action = SL_HAL_IADC_TRIGGER_ACTION_ONCE
  };

  // IADC default configuration
  sl_hal_iadc_config_t iadc_config = {
    .adc_mode = SL_HAL_IADC_CFG_ADC_MODE_NORMAL,
    .osr_high_speed = SL_HAL_IADC_OSR_HIGH_SPEED_16X,
    .analog_gain = SL_HAL_IADC_ANALOG_GAIN_1,
    .reference = SL_HAL_IADC_REFERENCE_VREFINT_1V2,
    .twos_complement = SL_HAL_IADC_TWOS_COMP_AUTO,
    .adc_clk_prescale = 0,
    .vref = SL_HAL_IADC_DEFAULT_VREF
  };

  // Assign config to the init structure
  init.configs[0] = iadc_config;

  // Configure scan table entry
  sl_hal_iadc_scan_table_entry_t entry = {
    .negative_port = SL_HAL_IADC_NEG_PORT_INPUT_GND,
    .negative_pin = 0,
    .positive_port = SL_HAL_IADC_POS_PORT_INPUT_PORT_A,
    .positive_pin = 0,
    .config_id = 0,
    .compare = false,
    .include_in_scan = true
  };

  // Set the scan table entry
  sl_hal_iadc_scan_table_t scan_table = SL_HAL_IADC_SCANTABLE_DEFAULT;
  scan_table.entries[0] = entry;

  // Initialize hardware
  sl_hal_iadc_init(IADC0, &init);
  sl_hal_iadc_init_scan(IADC0, &scan_init);
  sl_hal_iadc_set_scan_table(IADC0, &scan_table);

  // Enable IADC
  sl_hal_iadc_enable(IADC0);

  // Start conversion
  sl_hal_iadc_cmd(IADC0, SL_HAL_IADC_CMD_START_SCAN);

  // Wait for conversion to complete
  while ((IADC0->STATUS & IADC_STATUS_SCANFIFODV) == 0) {
    // Wait for data valid flag
  }

  // Read result
  sl_hal_iadc_result_t result = sl_hal_iadc_scan_read_fifo(IADC0);

  // Use result.data and result.id here
}

Modules#

sl_hal_iadc_scan_table_entry_t

sl_hal_iadc_config_t

sl_hal_iadc_scan_table_t

sl_hal_iadc_init_t

sl_hal_iadc_init_scan_t

sl_hal_iadc_init_single_t

sl_hal_iadc_single_input_t

sl_hal_iadc_result_t

Enumerations#

enum
SL_HAL_IADC_WARMUP_NORMAL = _IADC_CTRL_WARMUPMODE_NORMAL
SL_HAL_IADC_WARMUP_KEEP_IN_STANDBY = _IADC_CTRL_WARMUPMODE_KEEPINSTANDBY
SL_HAL_IADC_WARMUP_KEEP_WARM = _IADC_CTRL_WARMUPMODE_KEEPWARM
}

Warm-up mode.

enum
SL_HAL_IADC_ALIGNMENT_RIGHT_12 = _IADC_SCANFIFOCFG_ALIGNMENT_RIGHT12
SL_HAL_IADC_ALIGNMENT_LEFT_12 = _IADC_SCANFIFOCFG_ALIGNMENT_LEFT12
SL_HAL_IADC_ALIGNMENT_RIGHT_16 = _IADC_SCANFIFOCFG_ALIGNMENT_RIGHT16
SL_HAL_IADC_ALIGNMENT_LEFT_16 = _IADC_SCANFIFOCFG_ALIGNMENT_LEFT16
SL_HAL_IADC_ALIGNMENT_RIGHT_20 = _IADC_SCANFIFOCFG_ALIGNMENT_RIGHT20
SL_HAL_IADC_ALIGNMENT_LEFT_20 = _IADC_SCANFIFOCFG_ALIGNMENT_LEFT20
}

IADC result alignment.

enum
SL_HAL_IADC_REFERENCE_VREFINT_1V2 = _IADC_CFG_REFSEL_VBGR
SL_HAL_IADC_VREF_EXT_1V25 = _IADC_CFG_REFSEL_VREF
SL_HAL_IADC_VREF_EXT_2V5 = _IADC_CFG_REFSEL_VREF2P5
SL_HAL_IADC_VREF_VDDX = _IADC_CFG_REFSEL_VDDX
SL_HAL_IADC_VREF_VDDX0P8BUF = _IADC_CFG_REFSEL_VDDX0P8BUF
}

IADC Reference.

enum
SL_HAL_IADC_NEG_PIN_INPUT_GND_AUX = 0
SL_HAL_IADC_NEG_PIN_INPUT_GND = 1
}

IADC negative input ground pin selection.

enum
SL_HAL_IADC_POS_PIN_INPUT_AVDD = 0
SL_HAL_IADC_POS_PIN_INPUT_IOVDD = 1
SL_HAL_IADC_POS_PIN_INPUT_VSS = 2
SL_HAL_IADC_POS_PIN_INPUT_VSS_AUX = 3
SL_HAL_IADC_POS_PIN_INPUT_DVDD = 4
SL_HAL_IADC_POS_PIN_INPUT_DECOUPLE = 7
}

IADC positive input supply pin selection.

enum
SL_HAL_IADC_NEG_PORT_INPUT_GND = _IADC_SCAN_PORTNEG_GND
SL_HAL_IADC_NEG_PORT_INPUT_DAC_1 = _IADC_SCAN_PORTNEG_DAC1
SL_HAL_IADC_NEG_PORT_INPUT_PAD_ANA_1 = _IADC_SCAN_PORTNEG_PADANA1
SL_HAL_IADC_NEG_PORT_INPUT_PAD_ANA_3 = _IADC_SCAN_PORTNEG_PADANA3
SL_HAL_IADC_NEG_PORT_INPUT_PORT_A = _IADC_SCAN_PORTNEG_PORTA
SL_HAL_IADC_NEG_PORT_INPUT_PORT_B = _IADC_SCAN_PORTNEG_PORTB
SL_HAL_IADC_NEG_PORT_INPUT_PORT_C = _IADC_SCAN_PORTNEG_PORTC
SL_HAL_IADC_NEG_PORT_INPUT_PORT_D = _IADC_SCAN_PORTNEG_PORTD
}

IADC negative input port selection.

enum
SL_HAL_IADC_POS_PORT_INPUT_GND = _IADC_SCAN_PORTPOS_GND
SL_HAL_IADC_POS_PORT_INPUT_SUPPLY = _IADC_SCAN_PORTPOS_SUPPLY
SL_HAL_IADC_POS_PORT_INPUT_DAC_0 = _IADC_SCAN_PORTPOS_DAC0
SL_HAL_IADC_POS_PORT_INPUT_PAD_ANA_0 = _IADC_SCAN_PORTPOS_PADANA0
SL_HAL_IADC_POS_PORT_INPUT_PAD_ANA_2 = _IADC_SCAN_PORTPOS_PADANA2
SL_HAL_IADC_POS_PORT_INPUT_PORT_A = _IADC_SCAN_PORTPOS_PORTA
SL_HAL_IADC_POS_PORT_INPUT_PORT_B = _IADC_SCAN_PORTPOS_PORTB
SL_HAL_IADC_POS_PORT_INPUT_PORT_C = _IADC_SCAN_PORTPOS_PORTC
SL_HAL_IADC_POS_PORT_INPUT_PORT_D = _IADC_SCAN_PORTPOS_PORTD
}

IADC positive input port selection.

enum
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_0 = 0
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_1 = 1
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_2 = 2
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_3 = 3
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_4 = 4
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_5 = 5
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_6 = 6
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_7 = 7
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_8 = 8
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_9 = 9
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_10 = 10
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_11 = 11
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_12 = 12
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_13 = 13
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_14 = 14
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_15 = 15
}

IADC pin input for GPIO port.

enum
SL_HAL_IADC_CHANNEL_ID_0 = 0
SL_HAL_IADC_CHANNEL_ID_1 = 1
SL_HAL_IADC_CHANNEL_ID_2 = 2
SL_HAL_IADC_CHANNEL_ID_3 = 3
SL_HAL_IADC_CHANNEL_ID_4 = 4
SL_HAL_IADC_CHANNEL_ID_5 = 5
SL_HAL_IADC_CHANNEL_ID_6 = 6
SL_HAL_IADC_CHANNEL_ID_7 = 7
SL_HAL_IADC_CHANNEL_ID_8 = 8
SL_HAL_IADC_CHANNEL_ID_9 = 9
SL_HAL_IADC_CHANNEL_ID_10 = 10
SL_HAL_IADC_CHANNEL_ID_11 = 11
SL_HAL_IADC_CHANNEL_ID_12 = 12
SL_HAL_IADC_CHANNEL_ID_13 = 13
SL_HAL_IADC_CHANNEL_ID_14 = 14
SL_HAL_IADC_CHANNEL_ID_15 = 15
SL_HAL_IADC_CHANNEL_ID_MAX = 16
}

Channel identifier.

enum
SL_HAL_IADC_CMD_START_SINGLE = IADC_CMD_SINGLESTART
SL_HAL_IADC_CMD_STOP_SINGLE = IADC_CMD_SINGLESTOP
SL_HAL_IADC_CMD_START_SCAN = IADC_CMD_SCANSTART
SL_HAL_IADC_CMD_STOP_SCAN = IADC_CMD_SCANSTOP
SL_HAL_IADC_CMD_ENABLE_TIMER = IADC_CMD_TIMEREN
SL_HAL_IADC_CMD_DISABLE_TIMER = IADC_CMD_TIMERDIS
}

IADC Commands.

enum
SL_HAL_IADC_CFG_ADC_MODE_NORMAL = _IADC_CFG_ADCMODE_NORMAL
SL_HAL_IADC_CFG_ADC_MODE_HIGH_SPEED = _IADC_CFG_ADCMODE_HIGHSPEED
SL_HAL_IADC_CFG_ADC_MODE_HIGH_ACCURACY = _IADC_CFG_ADCMODE_HIGHACCURACY
}

IADC Configuration.

enum
SL_HAL_IADC_OSR_HIGH_SPEED_2X = _IADC_CFG_OSRHS_HISPD2
SL_HAL_IADC_OSR_HIGH_SPEED_4X = _IADC_CFG_OSRHS_HISPD4
SL_HAL_IADC_OSR_HIGH_SPEED_8X = _IADC_CFG_OSRHS_HISPD8
SL_HAL_IADC_OSR_HIGH_SPEED_16X = _IADC_CFG_OSRHS_HISPD16
SL_HAL_IADC_OSR_HIGH_SPEED_32X = _IADC_CFG_OSRHS_HISPD32
SL_HAL_IADC_OSR_HIGH_SPEED_64X = _IADC_CFG_OSRHS_HISPD64
}

IADC Over sampling rate for high speed.

enum
SL_HAL_IADC_OSR_HIGH_ACCURACY_16X = _IADC_CFG_OSRHA_HIACC16
SL_HAL_IADC_OSR_HIGH_ACCURACY_32X = _IADC_CFG_OSRHA_HIACC32
SL_HAL_IADC_OSR_HIGH_ACCURACY_64X = _IADC_CFG_OSRHA_HIACC64
SL_HAL_IADC_OSR_HIGH_ACCURACY_92X = _IADC_CFG_OSRHA_HIACC92
SL_HAL_IADC_OSR_HIGH_ACCURACY_128X = _IADC_CFG_OSRHA_HIACC128
SL_HAL_IADC_OSR_HIGH_ACCURACY_256X = _IADC_CFG_OSRHA_HIACC256
}

IADC Over sampling rate for high accuracy.

enum
SL_HAL_IADC_ANALOG_GAIN_0P5 = _IADC_CFG_ANALOGGAIN_ANAGAIN0P5
SL_HAL_IADC_ANALOG_GAIN_1 = _IADC_CFG_ANALOGGAIN_ANAGAIN1
SL_HAL_IADC_ANALOG_GAIN_2 = _IADC_CFG_ANALOGGAIN_ANAGAIN2
SL_HAL_IADC_ANALOG_GAIN_3 = _IADC_CFG_ANALOGGAIN_ANAGAIN3
SL_HAL_IADC_ANALOG_GAIN_4 = _IADC_CFG_ANALOGGAIN_ANAGAIN4
}

IADC Analog Gain.

enum
SL_HAL_IADC_TWOS_COMP_AUTO = _IADC_CFG_TWOSCOMPL_AUTO
SL_HAL_IADC_TWOS_COMP_UNIPOLAR = _IADC_CFG_TWOSCOMPL_FORCEUNIPOLAR
SL_HAL_IADC_TWOS_COMP_BIPOLAR = _IADC_CFG_TWOSCOMPL_FORCEBIPOLAR
}

IADC Two's complement results.

enum
SL_HAL_IADC_TRIGGER_IMMEDIATE = _IADC_TRIGGER_SCANTRIGSEL_IMMEDIATE
SL_HAL_IADC_TRIGGER_TIMER = _IADC_TRIGGER_SCANTRIGSEL_TIMER
SL_HAL_IADC_TRIGGER_PRSCLKGRP = _IADC_TRIGGER_SCANTRIGSEL_PRSCLKGRP
SL_HAL_IADC_TRIGGER_PRSPOS = _IADC_TRIGGER_SCANTRIGSEL_PRSPOS
SL_HAL_IADC_TRIGGER_PRSNEG = _IADC_TRIGGER_SCANTRIGSEL_PRSNEG
}

IADC trigger.

enum
SL_HAL_IADC_TRIGGER_ACTION_ONCE = _IADC_TRIGGER_SCANTRIGACTION_ONCE
SL_HAL_IADC_TRIGGER_ACTION_CONTINUOUS = _IADC_TRIGGER_SCANTRIGACTION_CONTINUOUS
}

IADC trigger action.

enum
SL_HAL_IADC_DATA_VALID_1 = _IADC_SCANFIFOCFG_DVL_VALID1
SL_HAL_IADC_DATA_VALID_2 = _IADC_SCANFIFOCFG_DVL_VALID2
SL_HAL_IADC_DATA_VALID_3 = _IADC_SCANFIFOCFG_DVL_VALID3
SL_HAL_IADC_DATA_VALID_4 = _IADC_SCANFIFOCFG_DVL_VALID4
SL_HAL_IADC_DATA_VALID_5 = _IADC_SCANFIFOCFG_DVL_VALID5
SL_HAL_IADC_DATA_VALID_6 = _IADC_SCANFIFOCFG_DVL_VALID6
SL_HAL_IADC_DATA_VALID_7 = _IADC_SCANFIFOCFG_DVL_VALID7
SL_HAL_IADC_DATA_VALID_8 = _IADC_SCANFIFOCFG_DVL_VALID8
}

IADC data valid level before requesting DMA transfer.

enum
SL_HAL_IADC_AVERAGE_1 = _IADC_CFG_DIGAVG_AVG1
SL_HAL_IADC_AVERAGE_2 = _IADC_CFG_DIGAVG_AVG2
SL_HAL_IADC_AVERAGE_4 = _IADC_CFG_DIGAVG_AVG4
SL_HAL_IADC_AVERAGE_8 = _IADC_CFG_DIGAVG_AVG8
SL_HAL_IADC_AVERAGE_16 = _IADC_CFG_DIGAVG_AVG16
}

IADC digital averaging function.

Functions#

void
sl_hal_iadc_init(IADC_TypeDef *iadc, const sl_hal_iadc_init_t *init, uint32_t src_clk_freq)

Initialize IADC.

void
sl_hal_iadc_calculate_gain_offset(IADC_TypeDef *iadc, const sl_hal_iadc_init_t *init, sl_hal_iadc_config_adc_mode_t adc_mode, uint8_t config, uint32_t adc_clk_prescale)

Calculate gain and offset.

void
sl_hal_iadc_reset(IADC_TypeDef *iadc)

Reset IADC to same state as after a HW reset.

void
sl_hal_iadc_init_scan(IADC_TypeDef *iadc, const sl_hal_iadc_init_scan_t *init, const sl_hal_iadc_scan_table_t *scan_table)

Initialize IADC scan sequence.

void
sl_hal_iadc_update_scan_entry(IADC_TypeDef *iadc, uint8_t id, sl_hal_iadc_scan_table_entry_t *entry)

Add/update entry in scan table.

void
sl_hal_iadc_set_scan_mask(IADC_TypeDef *iadc, uint32_t mask)

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

void
sl_hal_iadc_set_scan_mask_multiple_entries(IADC_TypeDef *iadc, const sl_hal_iadc_scan_table_t *scan_table)

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

void
sl_hal_iadc_init_single(IADC_TypeDef *iadc, const sl_hal_iadc_init_single_t *init, const sl_hal_iadc_single_input_t *input)

Initialize single IADC conversion.

void
sl_hal_iadc_update_single_input(IADC_TypeDef *iadc, const sl_hal_iadc_single_input_t *input)

Update IADC single input selection.

uint8_t
sl_hal_iadc_calculate_src_clk_prescale(IADC_TypeDef *iadc, uint32_t src_clk_freq, uint32_t cmu_clk_freq)

Calculate prescaler for CLK_SRC_ADC high speed clock.

uint32_t
sl_hal_iadc_calculate_adc_clk_prescale(IADC_TypeDef *iadc, uint32_t adc_clk_freq, uint32_t cmu_clk_freq, sl_hal_iadc_config_adc_mode_t adc_mode, uint8_t scr_clk_prescaler)

Calculate prescaler for ADC_CLK clock.

uint8_t
sl_hal_iadc_calculate_timebase(IADC_TypeDef *iadc, uint32_t src_clk_freq)

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

sl_hal_iadc_read_single_result(IADC_TypeDef *iadc)

Read most recent single conversion result.

Pull result from single data FIFO.

sl_hal_iadc_read_scan_result(IADC_TypeDef *iadc)

Read most recent scan conversion result.

Pull result from scan data FIFO.

uint32_t
sl_hal_iadc_get_reference_voltage(sl_hal_iadc_voltage_reference_t reference)

Get reference voltage selection.

void
sl_hal_iadc_enable(IADC_TypeDef *iadc)

Enable the IADC.

void
sl_hal_iadc_wait_sync(IADC_TypeDef *iadc)

Wait for ongoing sync of register(s) to the low-frequency domain to complete.

void
sl_hal_iadc_wait_ready(IADC_TypeDef *iadc)

Wait for disabling to finish.

void
sl_hal_iadc_disable(IADC_TypeDef *iadc)

Disable the IADC.

void
sl_hal_iadc_start_scan(IADC_TypeDef *iadc)

Start the IADC scan queue.

void
sl_hal_iadc_stop_scan(IADC_TypeDef *iadc)

Stop the IADC scan queue.

void
sl_hal_iadc_start_single(IADC_TypeDef *iadc)

Start the IADC single queue.

void
sl_hal_iadc_stop_single(IADC_TypeDef *iadc)

Stop the IADC single queue.

void
sl_hal_iadc_enable_timer(IADC_TypeDef *iadc)

Enable the IADC's local timer.

void
sl_hal_iadc_disable_timer(IADC_TypeDef *iadc)

Disable the IADC's local timer and resets the counter.

uint32_t
sl_hal_iadc_get_status(IADC_TypeDef *iadc)

Get status bits of IADC.

void
sl_hal_iadc_clear_interrupts(IADC_TypeDef *iadc, uint32_t flags)

Clear one or more pending IADC interrupts.

void
sl_hal_iadc_disable_interrupts(IADC_TypeDef *iadc, uint32_t flags)

Disable one or more IADC interrupts.

void
sl_hal_iadc_enable_interrupts(IADC_TypeDef *iadc, uint32_t flags)

Enable one or more IADC interrupts.

uint32_t

Get pending IADC interrupt flags.

uint32_t

Get enabled and pending IADC interrupt flags.

void
sl_hal_iadc_set_pending_interrupts(IADC_TypeDef *iadc, uint32_t flags)

Set one or more pending IADC interrupts from SW.

uint32_t

Pull data from single data FIFO.

uint32_t
sl_hal_iadc_read_single_data(IADC_TypeDef *iadc)

Read most recent single conversion data.

uint32_t

Pull data from scan data FIFO.

uint32_t
sl_hal_iadc_read_scan_data(IADC_TypeDef *iadc)

Read most recent scan conversion data.

void
sl_hal_iadc_set_command(IADC_TypeDef *iadc, sl_hal_iadc_cmd_t cmd)

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

uint32_t
sl_hal_iadc_get_scan_mask(IADC_TypeDef *iadc)

Get the scan mask currently used in the IADC.

uint8_t

Get the number of elements in the IADC single FIFO.

uint8_t
sl_hal_iadc_get_scan_fifo_cnt(IADC_TypeDef *iadc)

Get the number of elements in the IADC scan FIFO.

sl_hal_iadc_port_pin_to_neg_port(const sl_gpio_t *gpio)

Convert the GPIO port/pin to IADC negative port input selection.

sl_hal_iadc_port_pin_to_pos_port(const sl_gpio_t *gpio)

Convert the GPIO port/pin to IADC positive port input selection.

Macros#

#define
SL_HAL_IADC_REF_VALID (ref)

Validation of IADC register block pointer reference for assert statements.

#define
SL_HAL_IADC_DEFAULT_VREF 1210

IADC default reference voltage in mV.

#define
SL_HAL_IADC_SCANTABLE_DEFAULT undefined
#define
SL_HAL_IADC_SCANTABLEENTRY_DEFAULT undefined

Default config for IADC scan table entry structure.

#define
SL_HAL_IADC_ALL_CONFIG undefined

Default IADC sructure for all configs.

#define
SL_HAL_IADC_INIT_DEFAULT undefined

Default config for IADC init structure.

#define
SL_HAL_IADC_CONFIG_DEFAULT undefined

Default IADC config structure.

#define
SL_HAL_IADC_INITSCAN_DEFAULT undefined

Default config for IADC scan init structure.

#define
SL_HAL_IADC_INITSINGLE_DEFAULT undefined

Default config for IADC single init structure.

#define
SL_HAL_IADC_SINGLEINPUT_DEFAULT undefined

Default config for IADC single input structure.

Enumeration Documentation#

sl_hal_iadc_warmup_t#

sl_hal_iadc_warmup_t

Warm-up mode.

Enumerator
SL_HAL_IADC_WARMUP_NORMAL

IADC shutdown after each conversion.

SL_HAL_IADC_WARMUP_KEEP_IN_STANDBY

IADC is kept in standby mode between conversion.

SL_HAL_IADC_WARMUP_KEEP_WARM

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


sl_hal_iadc_alignment_t#

sl_hal_iadc_alignment_t

IADC result alignment.

Enumerator
SL_HAL_IADC_ALIGNMENT_RIGHT_12

IADC results 12-bit right aligned.

SL_HAL_IADC_ALIGNMENT_LEFT_12

IADC results 12-bit left aligned.

SL_HAL_IADC_ALIGNMENT_RIGHT_16

IADC results 16-bit right aligned.

SL_HAL_IADC_ALIGNMENT_LEFT_16

IADC results 16-bit left aligned.

SL_HAL_IADC_ALIGNMENT_RIGHT_20

IADC results 20-bit right aligned.

SL_HAL_IADC_ALIGNMENT_LEFT_20

IADC results 20-bit left aligned.


sl_hal_iadc_voltage_reference_t#

sl_hal_iadc_voltage_reference_t

IADC Reference.

Enumerator
SL_HAL_IADC_REFERENCE_VREFINT_1V2

Internal 1.2V Band Gap Reference (buffered) to ground.

SL_HAL_IADC_VREF_EXT_1V25

External reference (unbuffered) VREFP to VREFN.

SL_HAL_IADC_VREF_EXT_2V5

External reference (unbuffered) VREFP to VREFN. Supports 2.5V in high accuracy mode.

SL_HAL_IADC_VREF_VDDX

VDDX (unbuffered) to ground.

SL_HAL_IADC_VREF_VDDX0P8BUF

0.8 * VDDX (buffered) to ground.


sl_hal_iadc_neg_input_port_gnd_pin_selection_t#

sl_hal_iadc_neg_input_port_gnd_pin_selection_t

IADC negative input ground pin selection.

Enumerator
SL_HAL_IADC_NEG_PIN_INPUT_GND_AUX

GND auxiliary.

SL_HAL_IADC_NEG_PIN_INPUT_GND

GND.


sl_hal_iadc_pos_input_port_supply_pin_selection_t#

sl_hal_iadc_pos_input_port_supply_pin_selection_t

IADC positive input supply pin selection.

Enumerator
SL_HAL_IADC_POS_PIN_INPUT_AVDD

AVDD / 4.

SL_HAL_IADC_POS_PIN_INPUT_IOVDD

VDDIO / 4.

SL_HAL_IADC_POS_PIN_INPUT_VSS

VSS.

SL_HAL_IADC_POS_PIN_INPUT_VSS_AUX

VSS auxiliary.

SL_HAL_IADC_POS_PIN_INPUT_DVDD

DVDD / 4.

SL_HAL_IADC_POS_PIN_INPUT_DECOUPLE

DECOUPLE / 4.


sl_hal_iadc_negative_port_input_t#

sl_hal_iadc_negative_port_input_t

IADC negative input port selection.

Enumerator
SL_HAL_IADC_NEG_PORT_INPUT_GND

Ground.

SL_HAL_IADC_NEG_PORT_INPUT_DAC_1

Direct connection to DAC_1 input pin.

SL_HAL_IADC_NEG_PORT_INPUT_PAD_ANA_1

Direct connection to Pad_ana_1 input pin.

SL_HAL_IADC_NEG_PORT_INPUT_PAD_ANA_3

Direct connection to Pad_ana_3 input pin.

SL_HAL_IADC_NEG_PORT_INPUT_PORT_A

GPIO port A.

SL_HAL_IADC_NEG_PORT_INPUT_PORT_B

GPIO port B.

SL_HAL_IADC_NEG_PORT_INPUT_PORT_C

GPIO port C.

SL_HAL_IADC_NEG_PORT_INPUT_PORT_D

GPIO port D.


sl_hal_iadc_positive_port_input_t#

sl_hal_iadc_positive_port_input_t

IADC positive input port selection.

Enumerator
SL_HAL_IADC_POS_PORT_INPUT_GND

Ground.

SL_HAL_IADC_POS_PORT_INPUT_SUPPLY

Supply.

SL_HAL_IADC_POS_PORT_INPUT_DAC_0

Direct connection to DAC_0 input pin.

SL_HAL_IADC_POS_PORT_INPUT_PAD_ANA_0

Direct connection to Pad_ana_0 input pin.

SL_HAL_IADC_POS_PORT_INPUT_PAD_ANA_2

Direct connection to Pad_ana_2 input pin.

SL_HAL_IADC_POS_PORT_INPUT_PORT_A

GPIO port A.

SL_HAL_IADC_POS_PORT_INPUT_PORT_B

GPIO port B.

SL_HAL_IADC_POS_PORT_INPUT_PORT_C

GPIO port C.

SL_HAL_IADC_POS_PORT_INPUT_PORT_D

GPIO port D.


sl_hal_iadc_gpio_port_input_pin_t#

sl_hal_iadc_gpio_port_input_pin_t

IADC pin input for GPIO port.

Enumerator
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_0
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_1
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_2
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_3
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_4
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_5
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_6
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_7
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_8
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_9
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_10
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_11
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_12
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_13
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_14
SL_HAL_IADC_GPIO_PORT_INPUT_PIN_15

sl_hal_iadc_channel_id_t#

sl_hal_iadc_channel_id_t

Channel identifier.

Enumerator
SL_HAL_IADC_CHANNEL_ID_0
SL_HAL_IADC_CHANNEL_ID_1
SL_HAL_IADC_CHANNEL_ID_2
SL_HAL_IADC_CHANNEL_ID_3
SL_HAL_IADC_CHANNEL_ID_4
SL_HAL_IADC_CHANNEL_ID_5
SL_HAL_IADC_CHANNEL_ID_6
SL_HAL_IADC_CHANNEL_ID_7
SL_HAL_IADC_CHANNEL_ID_8
SL_HAL_IADC_CHANNEL_ID_9
SL_HAL_IADC_CHANNEL_ID_10
SL_HAL_IADC_CHANNEL_ID_11
SL_HAL_IADC_CHANNEL_ID_12
SL_HAL_IADC_CHANNEL_ID_13
SL_HAL_IADC_CHANNEL_ID_14
SL_HAL_IADC_CHANNEL_ID_15
SL_HAL_IADC_CHANNEL_ID_MAX

sl_hal_iadc_cmd_t#

sl_hal_iadc_cmd_t

IADC Commands.

Enumerator
SL_HAL_IADC_CMD_START_SINGLE

Start single queue.

SL_HAL_IADC_CMD_STOP_SINGLE

Stop single queue.

SL_HAL_IADC_CMD_START_SCAN

Start scan queue.

SL_HAL_IADC_CMD_STOP_SCAN

Stop scan queue.

SL_HAL_IADC_CMD_ENABLE_TIMER

Enable Timer.

SL_HAL_IADC_CMD_DISABLE_TIMER

Disable Timer.


sl_hal_iadc_config_adc_mode_t#

sl_hal_iadc_config_adc_mode_t

IADC Configuration.

Enumerator
SL_HAL_IADC_CFG_ADC_MODE_NORMAL

Normal mode.

SL_HAL_IADC_CFG_ADC_MODE_HIGH_SPEED

High Speed mode.

SL_HAL_IADC_CFG_ADC_MODE_HIGH_ACCURACY

High Accuracy mode.


sl_hal_iadc_config_osr_high_speed_t#

sl_hal_iadc_config_osr_high_speed_t

IADC Over sampling rate for high speed.

Enumerator
SL_HAL_IADC_OSR_HIGH_SPEED_2X

High speed oversampling of 4x.

SL_HAL_IADC_OSR_HIGH_SPEED_4X

High speed oversampling of 4x.

SL_HAL_IADC_OSR_HIGH_SPEED_8X

High speed oversampling of 8x.

SL_HAL_IADC_OSR_HIGH_SPEED_16X

High speed oversampling of 16x.

SL_HAL_IADC_OSR_HIGH_SPEED_32X

High speed oversampling of 32x.

SL_HAL_IADC_OSR_HIGH_SPEED_64X

High speed oversampling of 64x.


sl_hal_iadc_config_osr_high_accuracy_t#

sl_hal_iadc_config_osr_high_accuracy_t

IADC Over sampling rate for high accuracy.

Enumerator
SL_HAL_IADC_OSR_HIGH_ACCURACY_16X

High accuracy oversampling of 16x.

SL_HAL_IADC_OSR_HIGH_ACCURACY_32X

High accuracy oversampling of 32x.

SL_HAL_IADC_OSR_HIGH_ACCURACY_64X

High accuracy oversampling of 64x.

SL_HAL_IADC_OSR_HIGH_ACCURACY_92X

High accuracy oversampling of 92x.

SL_HAL_IADC_OSR_HIGH_ACCURACY_128X

High accuracy oversampling of 128x.

SL_HAL_IADC_OSR_HIGH_ACCURACY_256X

High accuracy oversampling of 256x.


sl_hal_iadc_analog_gain_t#

sl_hal_iadc_analog_gain_t

IADC Analog Gain.

Enumerator
SL_HAL_IADC_ANALOG_GAIN_0P5

Analog gain of 0.5x.

SL_HAL_IADC_ANALOG_GAIN_1

Analog gain of 1x.

SL_HAL_IADC_ANALOG_GAIN_2

Analog gain of 2x.

SL_HAL_IADC_ANALOG_GAIN_3

Analog gain of 3x.

SL_HAL_IADC_ANALOG_GAIN_4

Analog gain of 4x.


sl_hal_iadc_config_twos_comp_t#

sl_hal_iadc_config_twos_comp_t

IADC Two's complement results.

Enumerator
SL_HAL_IADC_TWOS_COMP_AUTO

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

SL_HAL_IADC_TWOS_COMP_UNIPOLAR

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

SL_HAL_IADC_TWOS_COMP_BIPOLAR

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


sl_hal_iadc_trigger_t#

sl_hal_iadc_trigger_t

IADC trigger.

Enumerator
SL_HAL_IADC_TRIGGER_IMMEDIATE

Start single/scan queue immediately.

SL_HAL_IADC_TRIGGER_TIMER

Timer starts single/scan queue.

SL_HAL_IADC_TRIGGER_PRSCLKGRP

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

SL_HAL_IADC_TRIGGER_PRSPOS

PRS0 positive edge starts single/scan queue.

SL_HAL_IADC_TRIGGER_PRSNEG

PRS0 negative edge starts single/scan queue.


sl_hal_iadc_trigger_action_t#

sl_hal_iadc_trigger_action_t

IADC trigger action.

Enumerator
SL_HAL_IADC_TRIGGER_ACTION_ONCE

Convert single/scan queue once per trigger.

SL_HAL_IADC_TRIGGER_ACTION_CONTINUOUS

Convert single/scan queue continuously.


sl_hal_iadc_fifo_config_dvl_t#

sl_hal_iadc_fifo_config_dvl_t

IADC data valid level before requesting DMA transfer.

Enumerator
SL_HAL_IADC_DATA_VALID_1

Data valid level is 1 before requesting DMA transfer.

SL_HAL_IADC_DATA_VALID_2

Data valid level is 2 before requesting DMA transfer.

SL_HAL_IADC_DATA_VALID_3

Data valid level is 3 before requesting DMA transfer.

SL_HAL_IADC_DATA_VALID_4

Data valid level is 4 before requesting DMA transfer.

SL_HAL_IADC_DATA_VALID_5

Data valid level is 5 before requesting DMA transfer.

SL_HAL_IADC_DATA_VALID_6

Data valid level is 6 before requesting DMA transfer.

SL_HAL_IADC_DATA_VALID_7

Data valid level is 7 before requesting DMA transfer.

SL_HAL_IADC_DATA_VALID_8

Data valid level is 8 before requesting DMA transfer.


sl_hal_iadc_digital_averaging_t#

sl_hal_iadc_digital_averaging_t

IADC digital averaging function.

Enumerator
SL_HAL_IADC_AVERAGE_1

Average over 1 sample (no averaging).

SL_HAL_IADC_AVERAGE_2

Average over 2 sample.

SL_HAL_IADC_AVERAGE_4

Average over 4 sample.

SL_HAL_IADC_AVERAGE_8

Average over 8 sample.

SL_HAL_IADC_AVERAGE_16

Average over 16 sample.


Function Documentation#

sl_hal_iadc_init#

void sl_hal_iadc_init (IADC_TypeDef * iadc, const sl_hal_iadc_init_t * init, uint32_t src_clk_freq)

Initialize IADC.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

const sl_hal_iadc_init_t *[in]init

Pointer to IADC initialization structure.

uint32_t[in]src_clk_freq

CLK_SRC_ADC frequency wanted. The frequency will automatically be adjusted to be within valid range according to reference manual.

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

Note

  • This function will stop any ongoing conversions.


sl_hal_iadc_calculate_gain_offset#

void sl_hal_iadc_calculate_gain_offset (IADC_TypeDef * iadc, const sl_hal_iadc_init_t * init, sl_hal_iadc_config_adc_mode_t adc_mode, uint8_t config, uint32_t adc_clk_prescale)

Calculate gain and offset.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

const sl_hal_iadc_init_t *[in]init

Pointer to IADC initialization structure.

sl_hal_iadc_config_adc_mode_t[in]adc_mode

Mode for IADC config.

uint8_t[in]config

IADC config number.

uint32_t[in]adc_clk_prescale

IADC clock prescaler.

This function calculates the gain and offset values for the IADC based on the provided configuration.


sl_hal_iadc_reset#

void sl_hal_iadc_reset (IADC_TypeDef * iadc)

Reset IADC to same state as after a HW reset.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.


sl_hal_iadc_init_scan#

void sl_hal_iadc_init_scan (IADC_TypeDef * iadc, const sl_hal_iadc_init_scan_t * init, const sl_hal_iadc_scan_table_t * scan_table)

Initialize IADC scan sequence.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

const sl_hal_iadc_init_scan_t *[in]init

Pointer to IADC initialization structure.

const sl_hal_iadc_scan_table_t *[in]scan_table

Pointer to IADC scan table structure.

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.


sl_hal_iadc_update_scan_entry#

void sl_hal_iadc_update_scan_entry (IADC_TypeDef * iadc, uint8_t id, sl_hal_iadc_scan_table_entry_t * entry)

Add/update entry in scan table.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

uint8_t[in]id

ID of scan table entry to add.

sl_hal_iadc_scan_table_entry_t *[in]entry

Pointer to scan table entry structure.

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

Note

  • This function will stop any ongoing conversions.


sl_hal_iadc_set_scan_mask#

void sl_hal_iadc_set_scan_mask (IADC_TypeDef * iadc, uint32_t mask)

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

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

uint32_t[in]mask

Mask of 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.


sl_hal_iadc_set_scan_mask_multiple_entries#

void sl_hal_iadc_set_scan_mask_multiple_entries (IADC_TypeDef * iadc, const sl_hal_iadc_scan_table_t * scan_table)

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

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

const sl_hal_iadc_scan_table_t *[in]scan_table

Pointer to IADC scan table structure.

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.


sl_hal_iadc_init_single#

void sl_hal_iadc_init_single (IADC_TypeDef * iadc, const sl_hal_iadc_init_single_t * init, const sl_hal_iadc_single_input_t * input)

Initialize single IADC conversion.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

const sl_hal_iadc_init_single_t *[in]init

Pointer to IADC single initialization structure.

const sl_hal_iadc_single_input_t *[in]input

Pointer to IADC single input selection initialization structure.

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.


sl_hal_iadc_update_single_input#

void sl_hal_iadc_update_single_input (IADC_TypeDef * iadc, const sl_hal_iadc_single_input_t * input)

Update IADC single input selection.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

const sl_hal_iadc_single_input_t *[in]input

Pointer to single input selection structure.

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.


sl_hal_iadc_calculate_src_clk_prescale#

uint8_t sl_hal_iadc_calculate_src_clk_prescale (IADC_TypeDef * iadc, uint32_t src_clk_freq, uint32_t cmu_clk_freq)

Calculate prescaler for CLK_SRC_ADC high speed clock.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

uint32_t[in]src_clk_freq

CLK_SRC_ADC frequency wanted. The frequency will automatically be adjusted to be within valid range according to reference manual.

uint32_t[in]cmu_clk_freq

Frequency in Hz of reference CLK_CMU_ADC.

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

Returns

  • Divider value to use for IADC in order to achieve a high speed clock value.


sl_hal_iadc_calculate_adc_clk_prescale#

uint32_t sl_hal_iadc_calculate_adc_clk_prescale (IADC_TypeDef * iadc, uint32_t adc_clk_freq, uint32_t cmu_clk_freq, sl_hal_iadc_config_adc_mode_t adc_mode, uint8_t scr_clk_prescaler)

Calculate prescaler for ADC_CLK clock.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

uint32_t[in]adc_clk_freq

ADC_CLK frequency wanted. The frequency will automatically be adjusted to be within valid range according to reference manual.

uint32_t[in]cmu_clk_freq

Frequency in Hz of CLK_CMU_ADC.

sl_hal_iadc_config_adc_mode_t[in]adc_mode

Mode for IADC config.

uint8_t[in]scr_clk_prescaler

Precaler setting for ADC_CLK.

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

Returns

  • Divider value to use for IADC in order to achieve a ADC_CLK frequency.


sl_hal_iadc_calculate_timebase#

uint8_t sl_hal_iadc_calculate_timebase (IADC_TypeDef * iadc, uint32_t src_clk_freq)

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

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

uint32_t[in]src_clk_freq

Frequency in Hz of reference CLK_SRC_ADC clock.

Returns

  • Timebase value to use for IADC in order to achieve at least 1 us.


sl_hal_iadc_read_single_result#

sl_hal_iadc_result_t sl_hal_iadc_read_single_result (IADC_TypeDef * iadc)

Read most recent single conversion result.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

The result struct includes both the data and the ID (0x20) if show_id 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.

Returns

  • Single conversion result struct holding data and id.


sl_hal_iadc_read_single_fifo_result#

sl_hal_iadc_result_t sl_hal_iadc_read_single_fifo_result (IADC_TypeDef * iadc)

Pull result from single data FIFO.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

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

Note

  • Check data valid flag before calling this function.

Returns

  • Single conversion result struct holding data and id.


sl_hal_iadc_read_scan_result#

sl_hal_iadc_result_t sl_hal_iadc_read_scan_result (IADC_TypeDef * iadc)

Read most recent scan conversion result.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

The result struct includes both the data and the ID (0x20) if show_id 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.

Returns

  • Scan conversion result struct holding data and id.


sl_hal_iadc_pull_scan_fifo_result#

sl_hal_iadc_result_t sl_hal_iadc_pull_scan_fifo_result (IADC_TypeDef * iadc)

Pull result from scan data FIFO.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

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

Note

  • Check data valid flag before calling this function.

Returns

  • Scan conversion result struct holding data and id.


sl_hal_iadc_get_reference_voltage#

uint32_t sl_hal_iadc_get_reference_voltage (sl_hal_iadc_voltage_reference_t reference)

Get reference voltage selection.

Parameters
TypeDirectionArgument NameDescription
sl_hal_iadc_voltage_reference_t[in]reference

IADC Reference selection.

Returns

  • IADC reference voltage in millivolts.


sl_hal_iadc_enable#

void sl_hal_iadc_enable (IADC_TypeDef * iadc)

Enable the IADC.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

A pointer to the IADC peripheral register block.


sl_hal_iadc_wait_sync#

void sl_hal_iadc_wait_sync (IADC_TypeDef * iadc)

Wait for ongoing sync of register(s) to the low-frequency domain to complete.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

A pointer to the IADC peripheral register block.


sl_hal_iadc_wait_ready#

void sl_hal_iadc_wait_ready (IADC_TypeDef * iadc)

Wait for disabling to finish.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

A pointer to the ADC peripheral register block.


sl_hal_iadc_disable#

void sl_hal_iadc_disable (IADC_TypeDef * iadc)

Disable the IADC.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

A pointer to the IADC peripheral register block.


sl_hal_iadc_start_scan#

void sl_hal_iadc_start_scan (IADC_TypeDef * iadc)

Start the IADC scan queue.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

A pointer to the IADC peripheral register block.

Note

  • Enables The scan sequence and will start a scan if using the immediate trigger mode.


sl_hal_iadc_stop_scan#

void sl_hal_iadc_stop_scan (IADC_TypeDef * iadc)

Stop the IADC scan queue.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

A pointer to the IADC peripheral register block.


sl_hal_iadc_start_single#

void sl_hal_iadc_start_single (IADC_TypeDef * iadc)

Start the IADC single queue.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

A pointer to the IADC peripheral register block.

Note

  • Enables the scan sequence and will start a scan if using the immediate trigger mode.


sl_hal_iadc_stop_single#

void sl_hal_iadc_stop_single (IADC_TypeDef * iadc)

Stop the IADC single queue.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

A pointer to the IADC peripheral register block.


sl_hal_iadc_enable_timer#

void sl_hal_iadc_enable_timer (IADC_TypeDef * iadc)

Enable the IADC's local timer.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

A pointer to the IADC peripheral register block.


sl_hal_iadc_disable_timer#

void sl_hal_iadc_disable_timer (IADC_TypeDef * iadc)

Disable the IADC's local timer and resets the counter.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

A pointer to the IADC peripheral register block.


sl_hal_iadc_get_status#

uint32_t sl_hal_iadc_get_status (IADC_TypeDef * iadc)

Get status bits of IADC.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

Returns

  • IADC status bits.


sl_hal_iadc_clear_interrupts#

void sl_hal_iadc_clear_interrupts (IADC_TypeDef * iadc, uint32_t flags)

Clear one or more pending IADC interrupts.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

uint32_t[in]flags

Pending IADC interrupt source to clear. Use a bitwise logic OR combination of valid interrupt flags for the IADC module (IADC_IF_nnn).


sl_hal_iadc_disable_interrupts#

void sl_hal_iadc_disable_interrupts (IADC_TypeDef * iadc, uint32_t flags)

Disable one or more IADC interrupts.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

uint32_t[in]flags

IADC interrupt sources to disable. Use a bitwise logic OR combination of valid interrupt flags for the IADC module (IADC_IF_nnn).


sl_hal_iadc_enable_interrupts#

void sl_hal_iadc_enable_interrupts (IADC_TypeDef * iadc, uint32_t flags)

Enable one or more IADC interrupts.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

uint32_t[in]flags

IADC interrupt sources to enable. Use a bitwise logic OR combination of valid interrupt flags for the IADC module (IADC_IF_nnn).

Note

  • Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. Consider using sl_hal_iadc_clear_interrupts() prior to enabling if such a pending interrupt should be ignored.


sl_hal_iadc_get_pending_interrupts#

uint32_t sl_hal_iadc_get_pending_interrupts (IADC_TypeDef * iadc)

Get pending IADC interrupt flags.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer 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).

Note

  • The event bits are not cleared by the use of this function.


sl_hal_iadc_get_enable_pending_interrupts#

uint32_t sl_hal_iadc_get_enable_pending_interrupts (IADC_TypeDef * iadc)

Get enabled and pending IADC interrupt flags.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

Useful for handling more interrupt sources in the same interrupt handler.

Note

  • Interrupt flags are not cleared by the use of this function.

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

    • The OR combination of valid interrupt flags of the IADC module (IADCx_IF_nnn).


sl_hal_iadc_set_pending_interrupts#

void sl_hal_iadc_set_pending_interrupts (IADC_TypeDef * iadc, uint32_t flags)

Set one or more pending IADC interrupts from SW.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

uint32_t[in]flags

IADC interrupt sources to set to pending. Use a bitwise logic OR combination of valid interrupt flags for the IADC module (IADC_IF_nnn).


sl_hal_iadc_pull_single_fifo_data#

uint32_t sl_hal_iadc_pull_single_fifo_data (IADC_TypeDef * iadc)

Pull data from single data FIFO.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

If show_id was set when initializing single mode, the results will contain the ID (0x20).

Note

  • Check data valid flag before calling this function.

Returns

  • Single conversion data.


sl_hal_iadc_read_single_data#

uint32_t sl_hal_iadc_read_single_data (IADC_TypeDef * iadc)

Read most recent single conversion data.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

If show_id 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.

Returns

  • Single conversion data.


sl_hal_iadc_pull_scan_fifo_data#

uint32_t sl_hal_iadc_pull_scan_fifo_data (IADC_TypeDef * iadc)

Pull data from scan data FIFO.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

If show_id 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.

Returns

  • Scan conversion data.


sl_hal_iadc_read_scan_data#

uint32_t sl_hal_iadc_read_scan_data (IADC_TypeDef * iadc)

Read most recent scan conversion data.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

If show_id 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.

Returns

  • Scan conversion data.


sl_hal_iadc_set_command#

void sl_hal_iadc_set_command (IADC_TypeDef * iadc, sl_hal_iadc_cmd_t cmd)

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

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

sl_hal_iadc_cmd_t[in]cmd

Command to be performed.


sl_hal_iadc_get_scan_mask#

uint32_t sl_hal_iadc_get_scan_mask (IADC_TypeDef * iadc)

Get the scan mask currently used in the IADC.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

Returns

  • Mask of scan table entries currently included in scan.


sl_hal_iadc_get_single_fifo_cnt#

uint8_t sl_hal_iadc_get_single_fifo_cnt (IADC_TypeDef * iadc)

Get the number of elements in the IADC single FIFO.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

Returns

  • Number of elements in single FIFO.


sl_hal_iadc_get_scan_fifo_cnt#

uint8_t sl_hal_iadc_get_scan_fifo_cnt (IADC_TypeDef * iadc)

Get the number of elements in the IADC scan FIFO.

Parameters
TypeDirectionArgument NameDescription
IADC_TypeDef *[in]iadc

Pointer to IADC peripheral register block.

Returns

  • Number of elements in scan FIFO.


sl_hal_iadc_port_pin_to_neg_port#

sl_hal_iadc_negative_port_input_t sl_hal_iadc_port_pin_to_neg_port (const sl_gpio_t * gpio, pin)

Convert the GPIO port/pin to IADC negative port input selection.

Parameters
TypeDirectionArgument NameDescription
const sl_gpio_t *[in]gpio

GPIO port.

[in]pin

GPIO in.

Returns

  • IADC negative port input selection.


sl_hal_iadc_port_pin_to_pos_port#

sl_hal_iadc_positive_port_input_t sl_hal_iadc_port_pin_to_pos_port (const sl_gpio_t * gpio, pin)

Convert the GPIO port/pin to IADC positive port input selection.

Parameters
TypeDirectionArgument NameDescription
const sl_gpio_t *[in]gpio

GPIO port.

[in]pin

GPIO in.

Returns

  • IADC positive port input selection.