MT7697 API Reference  LinkIt SDK v4
ADC

This section describes the programming interfaces of the Analog-to-Digital Converter (ADC) HAL driver. More...

Overview

This section describes the programming interfaces of the Analog-to-Digital Converter (ADC) HAL driver.

Terms and acronyms

The following provides descriptions to the terms commonly used in the ADC driver and how to use its various functions.

Terms Details
ADC ADC is an Analog-to-Digital Converter that converts a continuous physical quantity (usually voltage) to a digital number that represents the quantity's amplitude.

Supported features

The ADC is a Successive Approximation ADC . The supported channels vary based on the actual MCU devices used. Resolution of ADC is 12 bits.

How to use this driver

Functions

hal_adc_status_t hal_adc_init (void)
 ADC init function. More...
 
hal_adc_status_t hal_adc_deinit (void)
 ADC deinit function. More...
 
hal_adc_status_t hal_adc_get_data_polling (hal_adc_channel_t channel, uint32_t *data)
 ADC receives a sample data for a channel. More...
 

Modules

 Enum
 

Function Documentation

hal_adc_status_t hal_adc_deinit ( void  )

ADC deinit function.

This function resets the ADC peripheral registers to their default values.

Returns
HAL_ADC_STATUS_OK, ADC deinit success.
HAL_ADC_STATUS_ERROR, ADC clock disable failed.
hal_adc_status_t hal_adc_get_data_polling ( hal_adc_channel_t  channel,
uint32_t *  data 
)

ADC receives a sample data for a channel.

Parameters
[in]channelis the channel that will be sampled. This parameter can only be the value of type hal_adc_channel_t.
[out]datais the raw data of the channel.
Returns
HAL_ADC_STATUS_OK, ADC get data success.
HAL_ADC_STATUS_ERROR_CHANNEL, the channel number is invalid.
HAL_ADC_STATUS_INVALID_PARAMETER, data is NULL.
Example
Sample code please refer to Use ADC driver to get sample data for a channel of How to use this driver
hal_adc_status_t hal_adc_init ( void  )

ADC init function.

Returns
HAL_ADC_STATUS_OK, ADC init success.
HAL_ADC_STATUS_ERROR_BUSY, ADC is busy.
HAL_ADC_STATUS_ERROR, ADC clock enable failed.