ADC16 driver APIs. More...
Data Structures | |
| struct | adc16_config_t |
| ADC16 common configuration struct. More... | |
| struct | adc16_channel_config_t |
| ADC16 channel configuration struct. More... | |
| struct | adc16_channel_threshold_t |
| ADC16 channel configuration struct. More... | |
| struct | adc16_dma_config_t |
| ADC16 DMA configuration struct. More... | |
| struct | adc16_seq_dma_data_t |
| ADC16 DMA configuration struct for the sequence mode. More... | |
| struct | adc16_pmt_dma_data_t |
| ADC16 DMA configuration struct for the preemption mode. More... | |
| struct | adc16_prd_config_t |
| ADC16 configuration struct for the period mode. More... | |
| struct | adc16_seq_queue_config_t |
| ADC16 queue configuration struct for the sequence mode. More... | |
| struct | adc16_seq_config_t |
| ADC16 configuration struct for the sequence mode. More... | |
| struct | adc16_pmt_config_t |
| ADC16 trigger configuration struct for the preemption mode. More... | |
Macros | |
| #define | ADC16_IS_CHANNEL_INVALID(CH) (CH > ADC16_SOC_MAX_CH_NUM) |
| Define ADC16 validity check for the channel number. More... | |
| #define | ADC16_IS_CHANNEL_SAMPLE_CYCLE_INVALID(CYC) (CYC == 0) |
| Define ADC16 validity check for the channel sample cycle. More... | |
| #define | ADC16_IS_TRIG_CH_INVLAID(CH) (CH > ADC_SOC_MAX_TRIG_CH_NUM) |
| Define ADC16 validity check for the trigger number. More... | |
| #define | ADC16_IS_TRIG_LEN_INVLAID(TRIG_LEN) (TRIG_LEN > ADC_SOC_MAX_TRIG_CH_LEN) |
| Define ADC16 validity check for the trigger length. More... | |
| #define | ADC16_IS_SEQ_LEN_INVLAID(LEN) ((LEN == 0) || (LEN > ADC_SOC_SEQ_MAX_LEN)) |
| Define ADC16 validity check for the sequence length. More... | |
| #define | ADC16_IS_SEQ_DMA_BUFF_LEN_INVLAID(LEN) ((LEN == 0) || (LEN > ADC_SOC_SEQ_MAX_DMA_BUFF_LEN_IN_4BYTES)) |
| Define ADC16 validity check for the DMA buffer length in the sequence mode. More... | |
| #define | ADC16_IS_PMT_DMA_BUFF_LEN_INVLAID(LEN) ((LEN == 0) || (LEN > ADC_SOC_PMT_MAX_DMA_BUFF_LEN_IN_4BYTES)) |
| Define ADC16 validity check for the DMA buffer length in the preemption mode. More... | |
Initialization and Deinitialization | |
| void | adc16_get_default_config (adc16_config_t *config) |
| Get a default configuration for an ADC16 instance. More... | |
| void | adc16_get_channel_default_config (adc16_channel_config_t *config) |
| Get a default configuration for an ADC16 Channel. More... | |
| hpm_stat_t | adc16_deinit (ADC16_Type *ptr) |
| De-initialize an ADC16 instance. More... | |
| hpm_stat_t | adc16_init (ADC16_Type *ptr, adc16_config_t *config) |
| Initialize an ADC16 instance. More... | |
| hpm_stat_t | adc16_init_channel (ADC16_Type *ptr, adc16_channel_config_t *config) |
| Initialize an ADC16 channel. More... | |
| hpm_stat_t | adc16_get_channel_threshold (ADC16_Type *ptr, uint8_t ch, adc16_channel_threshold_t *config) |
| Get thresholds of an ADC16 channel. More... | |
| hpm_stat_t | adc16_set_prd_config (ADC16_Type *ptr, adc16_prd_config_t *config) |
| Configure the the period mode for an ADC16 instance. More... | |
| hpm_stat_t | adc16_set_seq_config (ADC16_Type *ptr, adc16_seq_config_t *config) |
| Configure the sequence mode for an ADC16 instance. More... | |
| hpm_stat_t | adc16_set_pmt_config (ADC16_Type *ptr, adc16_pmt_config_t *config) |
| Configure the preemption mode for an ADC16 instance. More... | |
| hpm_stat_t | adc16_set_pmt_queue_enable (ADC16_Type *ptr, uint8_t trig_ch, bool enable) |
| Set the queue enable control. More... | |
| hpm_stat_t | adc16_enable_pmt_queue (ADC16_Type *ptr, uint8_t trig_ch) |
| Enable the specified preemption queue. More... | |
| hpm_stat_t | adc16_disable_pmt_queue (ADC16_Type *ptr, uint8_t trig_ch) |
| Disable the specified preemption queue. More... | |
Enablement Control | |
| static void | adc16_seq_enable_hw_trigger (ADC16_Type *ptr) |
| Enable the hw trigger control for the sequence mode. More... | |
| static void | adc16_seq_disable_hw_trigger (ADC16_Type *ptr) |
| Disable the hw trigger control for the sequence mode. More... | |
DMA Control | |
| static void | adc16_set_seq_stop_pos (ADC16_Type *ptr, uint16_t stop_pos) |
| Configure the stop position offset in the specified memory of DMA write operation for the sequence mode. More... | |
| static void | adc16_init_pmt_dma (ADC16_Type *ptr, uint32_t addr) |
| Configure the start address of DMA write operation for the preemption mode. More... | |
| hpm_stat_t | adc16_init_seq_dma (ADC16_Type *ptr, adc16_dma_config_t *config) |
| Configure the start address of DMA write operation for the sequence mode. More... | |
Status | |
| static uint32_t | adc16_get_status_flags (ADC16_Type *ptr) |
| Get all ADC16 status flags. More... | |
| static void | adc16_disable_busywait (ADC16_Type *ptr) |
| 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 void | adc16_enable_busywait (ADC16_Type *ptr) |
| Set value of the WAIT_DIS bit. ADC blocks access to the associated peripheral bus until the ADC completes the conversion. More... | |
| static void | adc16_set_nonblocking_read (ADC16_Type *ptr) |
| Set nonblocking read in oneshot mode. More... | |
| static void | adc16_set_blocking_read (ADC16_Type *ptr) |
| Set blocking read in oneshot mode. More... | |
| static bool | adc16_is_nonblocking_mode (ADC16_Type *ptr) |
| Judge whether the current setting is none-blocking mode or not. More... | |
| static bool | adc16_get_conv_valid_status (ADC16_Type *ptr, uint8_t ch) |
| Get the status of a conversion validity. More... | |
| static void | adc16_clear_status_flags (ADC16_Type *ptr, uint32_t mask) |
| Clear the status flags. More... | |
Interrupts | |
| static void | adc16_enable_interrupts (ADC16_Type *ptr, uint32_t mask) |
| Enable interrupts. More... | |
| static void | adc16_disable_interrupts (ADC16_Type *ptr, uint32_t mask) |
| Disable interrupts. More... | |
Trigger and Conversion | |
| hpm_stat_t | adc16_trigger_seq_by_sw (ADC16_Type *ptr) |
| Trigger ADC conversions by software in sequence mode. More... | |
| hpm_stat_t | adc16_trigger_pmt_by_sw (ADC16_Type *ptr, uint8_t trig_ch) |
| Trigger ADC conversions by software in preemption mode. More... | |
| hpm_stat_t | adc16_get_oneshot_result (ADC16_Type *ptr, uint8_t ch, uint16_t *result) |
| Get the result in oneshot mode. More... | |
| hpm_stat_t | adc16_get_prd_result (ADC16_Type *ptr, uint8_t ch, uint16_t *result) |
| Get the result in the period mode. More... | |
ADC16 driver APIs.
| #define ADC16_IS_CHANNEL_INVALID | ( | CH | ) | (CH > ADC16_SOC_MAX_CH_NUM) |
Define ADC16 validity check for the channel number.
| #define ADC16_IS_CHANNEL_SAMPLE_CYCLE_INVALID | ( | CYC | ) | (CYC == 0) |
Define ADC16 validity check for the channel sample cycle.
| #define ADC16_IS_PMT_DMA_BUFF_LEN_INVLAID | ( | LEN | ) | ((LEN == 0) || (LEN > ADC_SOC_PMT_MAX_DMA_BUFF_LEN_IN_4BYTES)) |
Define ADC16 validity check for the DMA buffer length in the preemption mode.
| #define ADC16_IS_SEQ_DMA_BUFF_LEN_INVLAID | ( | LEN | ) | ((LEN == 0) || (LEN > ADC_SOC_SEQ_MAX_DMA_BUFF_LEN_IN_4BYTES)) |
Define ADC16 validity check for the DMA buffer length in the sequence mode.
| #define ADC16_IS_SEQ_LEN_INVLAID | ( | LEN | ) | ((LEN == 0) || (LEN > ADC_SOC_SEQ_MAX_LEN)) |
Define ADC16 validity check for the sequence length.
| #define ADC16_IS_TRIG_CH_INVLAID | ( | CH | ) | (CH > ADC_SOC_MAX_TRIG_CH_NUM) |
Define ADC16 validity check for the trigger number.
| #define ADC16_IS_TRIG_LEN_INVLAID | ( | TRIG_LEN | ) | (TRIG_LEN > ADC_SOC_MAX_TRIG_CH_LEN) |
Define ADC16 validity check for the trigger length.
Define ADC16 Clock Divider.
| enum adc16_irq_event_t |
Define ADC16 irq events.
| enum adc16_resolution_t |
|
inlinestatic |
Clear the status flags.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | mask | A mask that means the specified flags to be cleared. Please refer to adc16_irq_event_t. |
| hpm_stat_t adc16_deinit | ( | ADC16_Type * | ptr | ) |
De-initialize an ADC16 instance.
| [in] | ptr | An ADC16 peripheral base address. |
| status_success | De-initialize an ADC16 instance successfully. Please refer to hpm_stat_t. |
| status_invalid_argument | De-initialize an ADC16 instance unsuccessfully due to passing one or more invalid arguments. Please refer to hpm_stat_t. |
|
inlinestatic |
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] | ptr | An ADC16 peripheral base address. |
|
inlinestatic |
Disable interrupts.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | mask | A mask indicating the specified interrupt events. Please refer to adc16_irq_event_t. |
| hpm_stat_t adc16_disable_pmt_queue | ( | ADC16_Type * | ptr, |
| uint8_t | trig_ch | ||
| ) |
Disable the specified preemption queue.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | trig_ch | An ADC16 peripheral trigger channel. |
| status_success | Get the result of an ADC16 conversion in oneshot mode successfully. |
| status_invalid_argument | Get the result of an ADC16 conversion in oneshot mode unsuccessfully due to passing invalid arguments. |
|
inlinestatic |
Set value of the WAIT_DIS bit. ADC blocks access to the associated peripheral bus until the ADC completes the conversion.
| [in] | ptr | An ADC16 peripheral base address. |
|
inlinestatic |
Enable interrupts.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | mask | A mask indicating the specified ADC interrupt events. Please refer to adc16_irq_event_t. |
| hpm_stat_t adc16_enable_pmt_queue | ( | ADC16_Type * | ptr, |
| uint8_t | trig_ch | ||
| ) |
Enable the specified preemption queue.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | trig_ch | An ADC16 peripheral trigger channel. |
| status_success | Get the result of an ADC16 conversion in oneshot mode successfully. |
| status_invalid_argument | Get the result of an ADC16 conversion in oneshot mode unsuccessfully due to passing invalid arguments. |
| void adc16_get_channel_default_config | ( | adc16_channel_config_t * | config | ) |
Get a default configuration for an ADC16 Channel.
| [out] | config | A pointer to the configuration struct of adc16_channel_config_t. |
| hpm_stat_t adc16_get_channel_threshold | ( | ADC16_Type * | ptr, |
| uint8_t | ch, | ||
| adc16_channel_threshold_t * | config | ||
| ) |
Get thresholds of an ADC16 channel.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | ch | An ADC16 channel number |
| [out] | config | A pointer to the structure of channel threshold |
| status_success | Initialize an ADC16 channel successfully. Please refer to hpm_stat_t. |
| status_invalid_argument | Initialize an ADC16 channel unsuccessfully due to passing one or more invalid arguments. Please refer to hpm_stat_t. |
|
inlinestatic |
Get the status of a conversion validity.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | ch | An ADC16 peripheral channel. |
| void adc16_get_default_config | ( | adc16_config_t * | config | ) |
Get a default configuration for an ADC16 instance.
| [out] | config | A pointer to the configuration struct of adc16_config_t. |
| hpm_stat_t adc16_get_oneshot_result | ( | ADC16_Type * | ptr, |
| uint8_t | ch, | ||
| uint16_t * | result | ||
| ) |
Get the result in oneshot mode.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | ch | An ADC16 peripheral channel. |
| [out] | result | A pointer to an ADC16 conversion result. |
| status_success | Get the result of an ADC16 conversion in oneshot mode successfully. Please refer to hpm_stat_t. |
| status_invalid_argument | Get the result of an ADC16 conversion in oneshot mode unsuccessfully due to passing invalid arguments. Please refer to hpm_stat_t. |
| hpm_stat_t adc16_get_prd_result | ( | ADC16_Type * | ptr, |
| uint8_t | ch, | ||
| uint16_t * | result | ||
| ) |
Get the result in the period mode.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | ch | An ADC16 peripheral channel. |
| [out] | result | A pointer to a specified ADC16 conversion result |
| status_success | Get the result of an ADC16 conversion in the period mode successfully. Please refer to hpm_stat_t. |
| status_invalid_argument | Get the result of an ADC16 conversion in the period mode unsuccessfully due to passing invalid arguments. Please refer to hpm_stat_t. |
|
inlinestatic |
Get all ADC16 status flags.
| [in] | ptr | An ADC16 peripheral base address. |
| A | mask. Please refer to adc16_irq_event_t. |
| hpm_stat_t adc16_init | ( | ADC16_Type * | ptr, |
| adc16_config_t * | config | ||
| ) |
Initialize an ADC16 instance.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | config | A pointer to the configuration struct of adc16_config_t. |
| status_success | Initialize an ADC16 instance successfully. Please refer to hpm_stat_t. |
| status_invalid_argument | Initialize an ADC16 instance unsuccessfully due to passing one or more invalid arguments. Please refer to hpm_stat_t. |
| hpm_stat_t adc16_init_channel | ( | ADC16_Type * | ptr, |
| adc16_channel_config_t * | config | ||
| ) |
Initialize an ADC16 channel.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | config | A pointer to the configuration struct of adc16_channel_config_t. |
| status_success | Initialize an ADC16 channel successfully. Please refer to hpm_stat_t. |
| status_invalid_argument | Initialize an ADC16 channel unsuccessfully due to passing one or more invalid arguments. Please refer to hpm_stat_t. |
|
inlinestatic |
Configure the start address of DMA write operation for the preemption mode.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | addr | A start address of DMA write operation. |
| hpm_stat_t adc16_init_seq_dma | ( | ADC16_Type * | ptr, |
| adc16_dma_config_t * | config | ||
| ) |
Configure the start address of DMA write operation for the sequence mode.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | config | A pointer to configuration struct of adc16_dma_config_t. |
| status_success | ADC16 initialize in sequence mode successfully. Please refert to hpm_stat_t. |
| status_invalid_argument | ADC16 initialize in sequence mode unsuccessfully due to passing invalid arguments. Please refert to hpm_stat_t. |
|
inlinestatic |
Judge whether the current setting is none-blocking mode or not.
| [in] | ptr | An ADC16 peripheral base address. |
| True | means that nonblocking reading. |
| False | means that blocking reading. |
|
inlinestatic |
Disable the hw trigger control for the sequence mode.
| [in] | ptr | An ADC16 peripheral base address. |
|
inlinestatic |
Enable the hw trigger control for the sequence mode.
| [in] | ptr | An ADC16 peripheral base address. |
|
inlinestatic |
Set blocking read in oneshot mode.
| [in] | ptr | An ADC16 peripheral base address. |
|
inlinestatic |
Set nonblocking read in oneshot mode.
| [in] | ptr | An ADC16 peripheral base address. |
| hpm_stat_t adc16_set_pmt_config | ( | ADC16_Type * | ptr, |
| adc16_pmt_config_t * | config | ||
| ) |
Configure the preemption mode for an ADC16 instance.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | config | A pointer to configuration struct of adc16_pmt_config_t. |
| status_success | Configure the preemption mode successfully. Please refer to hpm_stat_t. |
| status_invalid_argument | Configure the preemption mode unsuccessfully due to passing one or more invalid arguments. Please refer to hpm_stat_t. |
| hpm_stat_t adc16_set_pmt_queue_enable | ( | ADC16_Type * | ptr, |
| uint8_t | trig_ch, | ||
| bool | enable | ||
| ) |
Set the queue enable control.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | trig_ch | An ADC16 peripheral trigger channel. |
| [in] | enable | Set true to enable and false to disable. |
| status_success | Get the result of an ADC16 conversion in oneshot mode successfully. |
| status_invalid_argument | Get the result of an ADC16 conversion in oneshot mode unsuccessfully due to passing invalid arguments. |
| hpm_stat_t adc16_set_prd_config | ( | ADC16_Type * | ptr, |
| adc16_prd_config_t * | config | ||
| ) |
Configure the the period mode for an ADC16 instance.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | config | A pointer to the configuration struct of adc16_prd_config_t. |
| status_success | Configure the the period mode successfully. Please refer to hpm_stat_t. |
| status_invalid_argument | Configure the the period mode unsuccessfully due to passing one or more invalid arguments. Please refer to hpm_stat_t. |
| hpm_stat_t adc16_set_seq_config | ( | ADC16_Type * | ptr, |
| adc16_seq_config_t * | config | ||
| ) |
Configure the sequence mode for an ADC16 instance.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | config | A pointer to configuration struct of adc16_seq_config_t. |
| status_success | Configure the sequence mode successfully. Please refer to hpm_stat_t. |
| status_invalid_argument | Configure the sequence mode unsuccessfully due to passing one or more invalid arguments. Please refer to hpm_stat_t. |
|
inlinestatic |
Configure the stop position offset in the specified memory of DMA write operation for the sequence mode.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | stop_pos | A stop position offset. |
| hpm_stat_t adc16_trigger_pmt_by_sw | ( | ADC16_Type * | ptr, |
| uint8_t | trig_ch | ||
| ) |
Trigger ADC conversions by software in preemption mode.
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | trig_ch | A trigger channel number(e.g. TRIG0A,TRIG0B,TRIG0C...). |
| status_success | ADC16 software triggers successfully. Please refer to hpm_stat_t. |
| status_fail | ADC16 software triggers unsuccessfully. Please refer to hpm_stat_t. |
| hpm_stat_t adc16_trigger_seq_by_sw | ( | ADC16_Type * | ptr | ) |
Trigger ADC conversions by software in sequence mode.
| [in] | ptr | An ADC16 peripheral base address. |
| status_success | ADC16 software triggers successfully. Please refer to hpm_stat_t. |
| status_fail | ADC16 software triggers unsuccessfully. Please refer to hpm_stat_t. |