ADC HAL driver APIs. More...
Data Structures | |
| union | adc_base |
| An ADC peripheral base address. More... | |
| struct | adc_config_t |
| ADC common configuration struct. More... | |
| struct | adc_channel_config_t |
| ADC channel configuration struct. More... | |
| struct | adc_dma_config_t |
| ADC DMA configuration struct. More... | |
| struct | adc_prd_config_t |
| ADC configuration struct for period mode. More... | |
| struct | adc_seq_config_t |
| ADC configuration struct for sequence mode. More... | |
| struct | adc_pmt_config_t |
| ADC trigger configuration struct for preempt mode. More... | |
| struct | adc_type |
Macros | |
| #define | ADCX_MODULE_ADC12 1 |
| use adc12 or adc16. More... | |
| #define | ADCX_MODULE_ADC16 2 |
Enumerations | |
| enum | adc_module { adc_module_adc12 = 1 , adc_module_adc16 = 2 } |
Functions | |
| static void | hpm_adc_init_default_config (adc_config_t *config) |
| Get a default configuration for an ADC instance. More... | |
| static void | hpm_adc_init_channel_default_config (adc_channel_config_t *config) |
| Get a default configuration for an ADC channel instance. More... | |
| static hpm_stat_t | hpm_adc_init (adc_config_t *config) |
| Initialize an ADC instance. More... | |
| static hpm_stat_t | hpm_adc_channel_init (adc_channel_config_t *config) |
| Initialize an ADC channel. More... | |
| static hpm_stat_t | hpm_adc_set_period_config (adc_prd_config_t *config) |
| Configure the periodic mode for an ADC instance. More... | |
| static hpm_stat_t | hpm_adc_set_sequence_config (adc_seq_config_t *config) |
| Configure the sequence mode for an ADC instance. More... | |
| static hpm_stat_t | hpm_adc_set_preempt_config (adc_pmt_config_t *config) |
| Configure the preemption mode for an ADC instance. More... | |
| static void | hpm_adc_set_seq_stop_pos (adc_type *ptr, uint16_t stop_pos) |
| Configure the stop position offset in the specified memory for DMA write operation for sequence mode. More... | |
| static void | hpm_adc_init_pmt_dma (adc_type *ptr, uint32_t addr) |
| Configure the start address of DMA write operation for preemption mode. More... | |
| static void | hpm_adc_init_seq_dma (adc_dma_config_t *config) |
| Configure the start address of DMA write operation for preemption mode. More... | |
| static void | hpm_adc_disable_busywait (adc_dma_config_t *config) |
| Reset value of the WAIT_DIS bit. ADC blocks access to the associated peripheral bus until the ADC completes the conversion. More... | |
| static void | hpm_adc_enable_busywait (adc_dma_config_t *config) |
| Set value of the WAIT_DIS bit. The ADC does not block access to the associated peripheral bus until the ADC has completed its conversion. More... | |
| static uint32_t | hpm_adc_get_status_flags (adc_type *ptr) |
| Get ADC status flags. More... | |
| static bool | hpm_adc_get_conv_valid_status (adc_type *ptr, uint8_t ch) |
| Get status flag of a conversion. More... | |
| static void | hpm_adc_clear_status_flags (adc_type *ptr, uint32_t mask) |
| Clear status flags. More... | |
| static void | hpm_adc_enable_interrupts (adc_type *ptr, uint32_t mask) |
| Enable interrupts. More... | |
| static void | hpm_adc_disable_interrupts (adc_type *ptr, uint32_t mask) |
| Disable interrupts. More... | |
| static hpm_stat_t | hpm_adc_get_oneshot_result (adc_type *ptr, uint8_t ch, uint16_t *result) |
| Get the result in oneshot mode. More... | |
| static hpm_stat_t | hpm_adc_get_prd_result (adc_type *ptr, uint8_t ch, uint16_t *result) |
| Get the result in periodic mode. More... | |
| static hpm_stat_t | hpm_adc_trigger_seq_by_sw (adc_type *ptr) |
| Do a software trigger for sequence mode. More... | |
ADC HAL driver APIs.
| #define ADCX_MODULE_ADC12 1 |
#include <components/adc/hpm_adc.h>
use adc12 or adc16.
| #define ADCX_MODULE_ADC16 2 |
#include <components/adc/hpm_adc.h>
| enum adc_module |
#include <components/adc/hpm_adc.h>
| Enumerator | |
|---|---|
| adc_module_adc12 | |
| adc_module_adc16 | |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Initialize an ADC channel.
| [in] | config | A pointer to the configuration struct of "adc_config_t". |
| status_success | Initialize an ADC instance successfully. |
| status_invalid_argument | Initialize an ADC instance unsuccessfully because of passing one or more invalid arguments. |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Clear status flags.
Only the specified flags can be cleared by writing INT_STS register.
| [in] | ptr | An ADC peripheral base address. |
| [in] | mask | Mask value for flags to be cleared. Refer to "adc12_irq_event_t". Refer to "adc16_irq_event_t". |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Reset value of the WAIT_DIS bit. ADC blocks access to the associated peripheral bus until the ADC completes the conversion.
| [in] | config | A pointer to configuration struct of "adc_dma_config_t". |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Disable interrupts.
| [in] | ptr | An ADC peripheral base address. |
| [in] | mask | Mask value for interrupt events. Refer to "adc12_irq_event_t".Refer to "adc16_irq_event_t". |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Set value of the WAIT_DIS bit. The ADC does not block access to the associated peripheral bus until the ADC has completed its conversion.
| [in] | config | A pointer to configuration struct of "adc_dma_config_t". |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Enable interrupts.
| [in] | ptr | An ADC peripheral base address. |
| [in] | mask | Mask value for interrupt events. Refer to "adc12_irq_event_t".Refer to "adc16_irq_event_t". |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Get status flag of a conversion.
This status flag is only used when wait_dis is set to disable.
| [in] | ptr | An ADC peripheral base address. |
| [in] | ch | An ADC peripheral channel. |
| Status | It means the current conversion is valid. |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Get the result in oneshot mode.
| [in] | ptr | An ADC peripheral base address. |
| [in] | ch | An ADC peripheral channel. |
| [out] | result | The result of an ADC12 conversion. |
| status_success | Get the result of an ADC12 conversion in oneshot mode successfully. |
| status_invalid_argument | Get the result of an ADC12 conversion in oneshot mode unsuccessfully because of passing invalid arguments. |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Get the result in periodic mode.
| [in] | ptr | An ADC12 peripheral base address. |
| [in] | ch | An ADC12 peripheral channel. |
| [out] | result | The result of an ADC12 conversion. |
| status_success | Get the result of an ADC12 conversion in periodic mode successfully. |
| status_invalid_argument | Get the result of an ADC12 conversion in periodic mode unsuccessfully because of passing invalid arguments. |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Get ADC status flags.
This function gets all ADC status flags.
| [in] | ptr | An ADC peripheral base address. |
| Status | The ADC interrupt status flags. |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Initialize an ADC instance.
| [in] | config | A pointer to the configuration struct of "adc_config_t". |
| status_success | Initialize an ADC instance successfully. |
| status_invalid_argument | Initialize an ADC instance unsuccessfully because of passing one or more invalid arguments. |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Get a default configuration for an ADC channel instance.
| [out] | config | A pointer to the configuration struct of "adc_channel_config_t". |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Get a default configuration for an ADC instance.
| [out] | config | A pointer to the configuration struct of "adc_config_t". |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Configure the start address of DMA write operation for preemption mode.
| [in] | ptr | An ADC peripheral base address. |
| [in] | addr | The start address of DMA write operation. |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Configure the start address of DMA write operation for preemption mode.
| [in] | config | A pointer to configuration struct of "adc_dma_config_t". |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Configure the periodic mode for an ADC instance.
| [in] | config | A pointer to the configuration struct of "adc_prd_config_t". |
| status_success | Configure the periodic mode for an ADC instance successfully. |
| status_invalid_argument | Configure the periodic mode for an ADC instance unsuccessfully because of passing one or more invalid arguments. |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Configure the preemption mode for an ADC instance.
| [in] | config | a pointer to configuration struct of "adc_pmt_config_t". |
| status_success | Configure the preemption mode for an ADC instance successfully. |
| status_invalid_argument | Configure the preemption mode for an ADC instance unsuccessfully because of passing one or more invalid arguments. |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Configure the stop position offset in the specified memory for DMA write operation for sequence mode.
| [in] | ptr | An ADC peripheral base address. |
| [in] | stop_pos | The stop position offset. |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Configure the sequence mode for an ADC instance.
| [in] | config | A pointer to configuration struct of "adc_seq_config_t". |
| status_success | Configure the sequence mode for an ADC instance successfully. |
| status_invalid_argument | Configure the sequence mode for an ADC instance unsuccessfully because of passing one or more invalid arguments. |
|
inlinestatic |
#include <components/adc/hpm_adc.h>
Do a software trigger for sequence mode.
| [in] | ptr | An adc peripheral base address. |