HPM SDK
HPMicro Software Development Kit
hpm_adc.h File Reference
#include "hpm_common.h"
#include "hpm_soc_feature.h"

Go to the source code of this file.

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