Analog to Digital Converter#
Introduction#
The Analog-to-Digital Converter (ADC) is a crucial peripheral in microcontrollers, enabling the conversion of analog signals (continuous voltage levels) into digital data (discrete binary values). This conversion allows microcontrollers to interface with analog sensors, such as temperature sensors, light sensors, or joysticks, effectively translating real-world analog signals into data that can be processed by digital systems.
ADCs are essential in a wide range of applications, including:
Sensor Data Acquisition: Converting sensor outputs into digital form for processing.
Audio Processing: Digitizing analog audio signals for further manipulation.
Instrumentation and Measurement: Precise measurement of analog signals.
Motor Control: Monitoring and controlling motor performance.
Battery Monitoring and Management: Ensuring optimal battery usage.
Feedback Control Systems: Providing digital feedback for control systems.
Configuration#
Configuring the ADC involves several key steps to ensure accurate and efficient operation. These steps vary based on the specific hardware and application requirements. Below are some essential configuration tasks:
Channel and Mode Configuration: Set the number of ADC channels and the operating mode by configuring the
sl_adc_config_t
structure. Use this structure with the APIsl_si91x_adc_set_channel_configuration()
to apply the settings.Channel-Specific Settings: Define input type, sample count (1-1023), and sampling rate (1-2,500,000 samples per second) in the
sl_adc_channel_config_t
structure. After configuring this structure, callsl_si91x_adc_set_channel_configuration()
to set the channel parameters.
For more detailed configuration information, see the specific peripheral example README documents.
Usage#
After defining the ADC configuration structures, use the following functions to initialize and control the ADC module:
Configure Clock: sl_si91x_adc_configure_clock
Initialize ADC: sl_si91x_adc_init
Set Channel Configuration: sl_si91x_adc_set_channel_configuration
Register Event Callback: sl_si91x_adc_register_event_callback
Start ADC: sl_si91x_adc_start
Read Data: sl_si91x_adc_read_data
Deinitialize ADC: sl_si91x_adc_deinit
Modules#
Enumerations#
Enumeration for ADC input types.
Enumeration for ADC operation mode.
Enumeration for ADC DMA type.
Enumeration for ADC channel selection modes.
Enumeration for ADC channels.
Typedefs#
Renamed ADC channel configuration structure.
Renamed ADC configuration structure.
Renamed ADC internal configuration structure.
Typedef for a user-provided callback function that is invoked upon the completion of an ADC sample.
Functions#
To set the ADC peripheral clock and configure the PLL clock based on user-specified values in the clock configuration structure.
To initialize the ADC peripheral.
To configure the ADC channel parameters.
To register the user callback function.
To unregister the user callback function.
To configure the ADC sampling rate for the ADC channels.
To configure the ADC ping and pong memory location and length.
To enable ping-pong for the corresponding ADC channels.
To disable ping-pong for the corresponding ADC channels.
To enable DMA for the corresponding ADC channels.
To disable DMA for the corresponding ADC channels.
To configure the ADC in Static Mode.
To configure the ADC in FIFO Mode.
To enable the ADC channel.
To disable the ADC channel.
To power on or off the ADC.
To enable or disable the noise averaging mode for ADC.
To enable the temperature sensor.
To configure ADC FIFO Threshold.
To configure the ADC threshold to compare threshold value with ADC data.
To read the ADC sample data for FIFO mode of operation.
To read the ADC sampled data for static mode of operation.
To get the channel sampling rate value configured to ADC.
To deinitialize the ADC.
To start the ADC operation.
To stop the ADC operation.
To get the ADC version.
Macros#
Internal DMA event.
Static mode event.
Sign/magnitude bit.
Enumeration Documentation#
sl_adc_input_type_typedef_t#
sl_adc_input_type_typedef_t
Enumeration for ADC input types.
Enumerator | |
---|---|
SL_ADC_SINGLE_ENDED | Single-ended input: measures the voltage between the input and ground. |
SL_ADC_DIFFERENTIAL | Differential input: measures the voltage difference between two inputs. |
SL_ADC_INPUT_TYPE_LAST | Marks the last enumeration value for validation checks. |
83
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_adc_operation_mode_typedef_t#
sl_adc_operation_mode_typedef_t
Enumeration for ADC operation mode.
Enumerator | |
---|---|
SL_ADC_FIFO_MODE | Operation mode as FIFO mode. |
SL_ADC_STATIC_MODE | Operation mode as static mode. |
SL_ADC_OPERATION_MODE_LAST | Last member of enum for validation. |
92
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_adc_dma_type_typedef_t#
sl_adc_dma_type_typedef_t
Enumeration for ADC DMA type.
Enumerator | |
---|---|
SL_ADC_INTERNAL_DMA | Internal DMA type. |
SL_ADC_EXTERNAL_DMA | External DMA type. |
SL_ADC_DMA_TYPE_LAST | Last member of enum for validation. |
101
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_adc_channel_type_typedef_t#
sl_adc_channel_type_typedef_t
Enumeration for ADC channel selection modes.
Enumerator | |
---|---|
SL_ADC_SINGLE_CHNL | Selects a single ADC channel (dynamic mode disabled). |
SL_ADC_MULTI_CHNL | Selects multiple ADC channels (dynamic mode enabled). |
SL_ADC_CHANNEL_TYPE_LAST | Last member of enum for validation. |
110
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_adc_channel_id_t#
sl_adc_channel_id_t
Enumeration for ADC channels.
Enumerator | |
---|---|
SL_ADC_CHANNEL_1 | ADC channel 1. |
SL_ADC_CHANNEL_2 | ADC channel 2. |
SL_ADC_CHANNEL_3 | ADC channel 3. |
SL_ADC_CHANNEL_4 | ADC channel 4. |
SL_ADC_CHANNEL_5 | ADC channel 5. |
SL_ADC_CHANNEL_6 | ADC channel 6. |
SL_ADC_CHANNEL_7 | ADC channel 7. |
SL_ADC_CHANNEL_8 | ADC channel 8. |
SL_ADC_CHANNEL_9 | ADC channel 9. |
SL_ADC_CHANNEL_10 | ADC channel 10. |
SL_ADC_CHANNEL_11 | ADC channel 11. |
SL_ADC_CHANNEL_12 | ADC channel 12. |
SL_ADC_CHANNEL_13 | ADC channel 13. |
SL_ADC_CHANNEL_14 | ADC channel 14. |
SL_ADC_CHANNEL_15 | ADC channel 15. |
SL_ADC_CHANNEL_16 | ADC channel 16. |
119
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
Typedef Documentation#
sl_adc_channel_config_t#
typedef adc_ch_config_t sl_adc_channel_config_t
Renamed ADC channel configuration structure.
53
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_adc_config_t#
typedef adc_config_t sl_adc_config_t
Renamed ADC configuration structure.
58
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_adc_internal_config_t#
typedef adc_inter_config_t sl_adc_internal_config_t
Renamed ADC internal configuration structure.
63
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_adc_callback_t#
typedef void(* sl_adc_callback_t) (uint8_t channel, uint8_t event) )(uint8_t channel, uint8_t event)
Typedef for a user-provided callback function that is invoked upon the completion of an ADC sample.
[in] | channel | ADC channel number sl_adc_channel_id_t. |
[in] | event | ADC event for different interrupts. |
72
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
Function Documentation#
sl_si91x_adc_configure_clock#
sl_status_t sl_si91x_adc_configure_clock (sl_adc_clock_config_t * clock_configuration)
To set the ADC peripheral clock and configure the PLL clock based on user-specified values in the clock configuration structure.
[in] | clock_configuration | Pointer to the clock structure variables ( sl_adc_clock_config_t) |
This API configures the ADC clock. The ADC clock configurations include:
soc_pll_clock
(Frequency range from 1 to 180 MHz)soc_pll_reference_clock
(Frequency range from 15 to 65 MHz)division_factor
(0 to 1023)
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully configured the clock.
SL_STATUS_FAIL - Function failed.
SL_STATUS_NOT_INITIALIZED - Clock is not initialized.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
SL_STATUS_NULL_POINTER - The parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
202
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_init#
sl_status_t sl_si91x_adc_init (sl_adc_channel_config_t adc_channel_config, sl_adc_config_t adc_config, float vref_value)
To initialize the ADC peripheral.
[in] | adc_channel_config | ADC channels configuration structure variable, see sl_adc_channel_config_t. |
[in] | adc_config | ADC operation configuration structure variable, see sl_adc_config_t. |
[in] | vref_value | Reference voltage (range from 1.8 to 3.6 V). |
This API initializes the ADC by:
Setting the clock source.
Configuring the reference voltage.
Powering on the ADC block.
Calibrating the ADC offset and gain.
Pre-condition:
sl_si91x_adc_configure_clock - Required only for FIFO mode on PS4 (Power State) state.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully initialized the ADC.
SL_STATUS_BUSY - The function is already active.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
SL_STATUS_NULL_POINTER - The parameter is a null pointer.
SL_STATUS_INVALID_RANGE - Mismatch range.
SL_STATUS_INVALID_COUNT - Mismatch count.
For more information on status codes, see SL STATUS DOCUMENTATION.
232
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_set_channel_configuration#
sl_status_t sl_si91x_adc_set_channel_configuration (sl_adc_channel_config_t adc_channel_config, sl_adc_config_t adc_config)
To configure the ADC channel parameters.
[in] | adc_channel_config | ADC channels configuration structure variable, see sl_adc_channel_config_t. |
[in] | adc_config | ADC configuration structure variable, see sl_adc_config_t. |
This API configures the following parameters:
Number of channels
ADC operation mode (Static mode/FIFO mode)
Sample length
Input type (Single-ended/differential type)
Sampling rate (1 - 2.5 Msps (megasamples per second))
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully configured the ADC channel.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
SL_STATUS_NULL_POINTER - The parameter is a null pointer.
SL_STATUS_INVALID_RANGE - Mismatch range.
For more information on status codes, see SL STATUS DOCUMENTATION.
Note
If Static mode is configured, the sample length should be '1'.
263
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_register_event_callback#
sl_status_t sl_si91x_adc_register_event_callback (sl_adc_callback_t callback_event)
To register the user callback function.
[in] | callback_event | Pointer to the function that should be called during an interrupt event, see sl_adc_callback_t. |
This API registers a user-provided callback function that is invoked when an event occurs.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully registered the callback.
SL_STATUS_BUSY - Driver is busy.
SL_STATUS_NULL_POINTER - The parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
Note
Before calling this function again, it is mandatory to call the sl_si91x_adc_unregister_event_callback function to unregister the callback; otherwise, it returns the SL_STATUS_BUSY error code.
290
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_unregister_event_callback#
void sl_si91x_adc_unregister_event_callback (void )
To unregister the user callback function.
N/A |
This API unregisters the callback function registered using sl_si91x_adc_register_event_callback. This function must be called before registering the callback again.
Pre-condition:
302
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_configure_channel_sampling_rate#
sl_status_t sl_si91x_adc_configure_channel_sampling_rate (sl_adc_internal_config_t adc_internal_config, uint8_t channel_num)
To configure the ADC sampling rate for the ADC channels.
[in] | adc_internal_config | ADC internal configuration structure for setting the sampling rate, see sl_adc_internal_config_t. |
[in] | channel_num | Channel number. |
This API adjusts the channel offset and frequency for each channel to determine the sample rate. This API ensures that the Nyquist sampling rate criteria are met by setting the channel swallow factor to no less than '3'.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully configured the sampling rate.
For more information on status codes, see SL STATUS DOCUMENTATION.
325
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_configure_ping_pong_memory_address#
sl_status_t sl_si91x_adc_configure_ping_pong_memory_address (sl_adc_internal_config_t adc_internal_config, uint8_t channel_num)
To configure the ADC ping and pong memory location and length.
[in] | adc_internal_config | ADC internal trigger configuration sl_adc_internal_config_t structure variable. |
[in] | channel_num | Channel number. |
This API configures the ping and pong memory locations, as well as the ping and pong memory lengths. Applicable only for FIFO mode of ADC operation. FIFO mode has a dual-buffer cyclic mode that prevents data loss when the buffer is full. In dual-buffer cyclic mode, if the Ping buffer for a given channel is full, incoming sampled data is written into the Pong buffer, allowing the controller to read back samples from the Ping buffer during this period.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully configured ping and pong memory address and length.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
354
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_enable_ping_pong#
sl_status_t sl_si91x_adc_enable_ping_pong (uint8_t channel_num)
To enable ping-pong for the corresponding ADC channels.
[in] | channel_num | Channel number. |
This API enables the ping-pong mode for the specified ADC channel. Ping-pong mode is applicable only for FIFO mode of ADC operation.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully enabled ping-pong for the given channel.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
379
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_disable_ping_pong#
sl_status_t sl_si91x_adc_disable_ping_pong (uint8_t channel_num)
To disable ping-pong for the corresponding ADC channels.
[in] | channel_num | Channel number. |
This API disables the ping-pong mode for the specified ADC channel. Ping-pong mode is applicable only for FIFO mode of ADC operation.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully disabled the ping-pong for the given channel.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
405
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_internal_per_channel_dma_enable#
sl_status_t sl_si91x_adc_internal_per_channel_dma_enable (uint8_t channel_num)
To enable DMA for the corresponding ADC channels.
[in] | channel_num | Channel number. |
This API enables DMA for the specified ADC channel. This is applicable only for FIFO mode of ADC operation.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully enabled DMA for the given channel.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
428
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_internal_per_channel_dma_disable#
sl_status_t sl_si91x_adc_internal_per_channel_dma_disable (uint8_t channel_num)
To disable DMA for the corresponding ADC channels.
[in] | channel_num | Channel number. |
This API disables DMA for the specified ADC channel. This is applicable only for FIFO mode of ADC operation.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully disabled DMA for the given channel.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
454
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_configure_static_mode#
sl_status_t sl_si91x_adc_configure_static_mode (sl_adc_channel_config_t adc_channel_config, uint8_t channel_num)
To configure the ADC in Static Mode.
[in] | adc_channel_config | ADC channels configuration structure variable, see sl_adc_channel_config_t. |
[in] | channel_num | Channel number. |
This API configures the ADC to static mode with the specified positive and negative input channels and input type.
Note
Applicable only for static mode of ADC operation.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully configured to static mode.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
SL_STATUS_INVALID_RANGE - Mismatch range.
For more information on status codes, see SL STATUS DOCUMENTATION.
480
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_configure_fifo_mode#
sl_status_t sl_si91x_adc_configure_fifo_mode (sl_adc_channel_config_t adc_channel_config, uint8_t channel_num)
To configure the ADC in FIFO Mode.
[in] | adc_channel_config | ADC channels configuration structure variable, see sl_adc_channel_config_t. |
[in] | channel_num | Channel number. |
This API configures the ADC for FIFO mode, where it samples data from the ADC input and writes it to the FIFO buffer.
Note
Applicable only for FIFO mode of ADC operation.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully configured to FIFO mode.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
SL_STATUS_INVALID_RANGE - Mismatch range.
For more information on status codes, see SL STATUS DOCUMENTATION.
510
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_channel_enable#
sl_status_t sl_si91x_adc_channel_enable (uint8_t channel_num)
To enable the ADC channel.
[in] | channel_num | Channel number. |
This API enables the ADC channel. Data will be sampled from the ADC only when the corresponding channel is enabled.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully enabled the given channel.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
532
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_channel_disable#
sl_status_t sl_si91x_adc_channel_disable (uint8_t channel_num)
To disable the ADC channel.
[in] | channel_num | Channel number. |
This API stops data sampling when the corresponding channel is disabled.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully disabled the given channel.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
556
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_set_power_mode#
sl_status_t sl_si91x_adc_set_power_mode (POWER_STATE state)
To power on or off the ADC.
[in] | state | POWER_STATE type indicating whether to power on or off the ADC.
|
This API powers up or powers down the ADC power gates based on the provided state.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully set the power mode.
For more information on status codes, see SL STATUS DOCUMENTATION.
578
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_set_noise_average_mode#
sl_status_t sl_si91x_adc_set_noise_average_mode (boolean_t state)
To enable or disable the noise averaging mode for ADC.
[in] | state | 1 - To enable bypass noise averaging mode, 0 - To disable bypass noise averaging mode. |
This API enables or disables the noise averaging mode for the ADC. If bypass noise averaging is enabled, the sampled data will be more accurate. Disabling bypass noise averaging may cause an additional clock cycle latency.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Success.
For more information on status codes, see SL STATUS DOCUMENTATION.
602
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_temperature_sensor_enable#
sl_status_t sl_si91x_adc_temperature_sensor_enable (void )
To enable the temperature sensor.
N/A |
This API enables the BJT-based temperature sensor as an input to the ADC.
Note
The operation mode of the ADC should be Static for this input selection. If the ADC input sample is obtained from a temperature sensor, the positive input selection value must be '23'.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully enabled the ADC temperature sensor.
For more information on status codes, see SL STATUS DOCUMENTATION.
624
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_fifo_threshold_configuration#
sl_status_t sl_si91x_adc_fifo_threshold_configuration (sl_adc_config_t adc_config, sl_adc_fifo_thrld_config_t adc_fifo_threshold)
To configure ADC FIFO Threshold.
[in] | adc_config | ADC operation configuration structure variable, see sl_adc_config_t. |
[in] | adc_fifo_threshold | ADC FIFO structure variable like an empty FIFO, a full FIFO threshold level, see sl_adc_fifo_thrld_config_t. |
This API configures the ADC FIFO threshold. The maximum FIFO depth is 16, and the threshold value can be configured to indicate when the FIFO is almost full or almost empty for ADC operations. This allows for setting either a "FIFO almost full" or "FIFO almost empty" threshold, depending on the specific requirements of ADC configuration.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully configured FIFO threshold.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
SL_STATUS_INVALID_RANGE - Mismatch range.
For more information on status codes, see SL STATUS DOCUMENTATION.
651
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_threshold_configuration#
sl_status_t sl_si91x_adc_threshold_configuration (sl_adc_threshold_config_t adc_threshold)
To configure the ADC threshold to compare threshold value with ADC data.
[in] | adc_threshold | ADC threshold configuration structure variable, see sl_adc_threshold_config_t. |
This API configures the ADC threshold values for comparison with ADC data. This API applies when the ADC mode of operation is static.
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully configured ADC threshold.
For more information on status codes, see SL STATUS DOCUMENTATION.
674
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_read_data#
sl_status_t sl_si91x_adc_read_data (sl_adc_channel_config_t adcchconfig, uint8_t channel_num)
To read the ADC sample data for FIFO mode of operation.
[in] | adcchconfig | ADC channels configuration structure variable, see sl_adc_channel_config_t. |
[in] | channel_num | Channel number. |
This API reads the ADC sample data when the ADC is configured in FIFO mode.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully read the data.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
SL_STATUS_INVALID_RANGE - Mismatch range.
For more information on status codes, see SL STATUS DOCUMENTATION.
700
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_read_data_static#
sl_status_t sl_si91x_adc_read_data_static (sl_adc_channel_config_t adc_channel_config, sl_adc_config_t adc_config, uint16_t * adc_value)
To read the ADC sampled data for static mode of operation.
[in] | adc_channel_config | ADC channels configuration structure variable, see sl_adc_channel_config_t. |
[in] | adc_config | ADC operation configuration structure variable, see sl_adc_config_t. |
[out] | adc_value | Store the reading data in adc_value. |
This API reads the ADC sampled data when the ADC is configured in static mode.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully read the data.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
SL_STATUS_INVALID_RANGE - Mismatch range.
For more information on status codes, see SL STATUS DOCUMENTATION.
727
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_get_sampling_rate#
uint32_t sl_si91x_adc_get_sampling_rate (uint8_t channel_num)
To get the channel sampling rate value configured to ADC.
[in] | channel_num | Channel number. |
This API retrieves the sampling rate value that is configured for the specified ADC channel.
Pre-conditions:
Returns
uint32_t Sampling rate retrieved from the register.
747
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_deinit#
sl_status_t sl_si91x_adc_deinit (sl_adc_config_t adc_config)
To deinitialize the ADC.
[in] | adc_config | ADC operation configuration structure variable, see sl_adc_config_t. |
This API deinitializes the ADC. If the DMA (Direct Memory Access) is enabled, it also deinitializes the DMA. It will power down the ADC block and disable the dynamic mode if FIFO mode of ADC operation is used.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully deinitialized the ADC.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
770
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_start#
sl_status_t sl_si91x_adc_start (sl_adc_config_t adc_config)
To start the ADC operation.
[in] | adc_config | ADC operation configuration structure variable, see sl_adc_config_t. |
This API starts the signal to the ADC controller and enables dynamic mode if FIFO mode of ADC operation is configured.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully started the ADC.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
793
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_stop#
sl_status_t sl_si91x_adc_stop (sl_adc_config_t adc_config)
To stop the ADC operation.
[in] | adc_config | ADC operation configuration structure variable, see sl_adc_config_t. |
This API stops the signal to the ADC controller and disables dynamic mode if FIFO mode of ADC operation is configured.
Pre-conditions:
Returns
sl_status_t Status code indicating the result:
SL_STATUS_OK - Successfully stopped the ADC operation.
SL_STATUS_INVALID_PARAMETER - Parameters are invalid.
For more information on status codes, see SL STATUS DOCUMENTATION.
818
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
sl_si91x_adc_get_version#
sl_adc_version_t sl_si91x_adc_get_version (void )
To get the ADC version.
N/A |
This API returns the release, major, and minor version of the ADC.
Note
Returns the API version of the ADC.
Returns
sl_adc_version_t Structure containing the version information, see sl_adc_version_t.
830
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
Macro Definition Documentation#
SL_INTERNAL_DMA#
#define SL_INTERNAL_DMAValue:
INTERNAL_DMA
Internal DMA event.
76
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
SL_ADC_STATIC_MODE_EVENT#
#define SL_ADC_STATIC_MODE_EVENTValue:
ADC_STATIC_MODE_CALLBACK
Static mode event.
77
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h
SIGN_BIT#
#define SIGN_BITValue:
BIT(11)
Sign/magnitude bit.
78
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_adc.h