ADC16 driver APIs.
More...
|
| enum | adc16_resolution_t { adc16_res_8_bits = 9
, adc16_res_10_bits = 11
, adc16_res_12_bits = 14
, adc16_res_16_bits = 21
} |
| | Define ADC16 resolutions. More...
|
| |
| enum | adc16_conversion_mode_t { adc16_conv_mode_oneshot = 0
, adc16_conv_mode_period
, adc16_conv_mode_sequence
, adc16_conv_mode_preemption
} |
| | Define ADC16 conversion modes. More...
|
| |
| enum | adc16_clock_divider_t {
adc16_clock_divider_1 = 1
, adc16_clock_divider_2
, adc16_clock_divider_3
, adc16_clock_divider_4
,
adc16_clock_divider_5
, adc16_clock_divider_6
, adc16_clock_divider_7
, adc16_clock_divider_8
,
adc16_clock_divider_9
, adc16_clock_divider_10
, adc16_clock_divider_11
, adc16_clock_divider_12
,
adc16_clock_divider_13
, adc16_clock_divider_14
, adc16_clock_divider_15
, adc16_clock_divider_16
} |
| | Define ADC16 Clock Divider. More...
|
| |
| enum | adc16_irq_event_t {
adc16_event_trig_complete = ADC16_INT_STS_TRIG_CMPT_MASK
, adc16_event_trig_sw_conflict = ADC16_INT_STS_TRIG_SW_CFLCT_MASK
, adc16_event_trig_hw_conflict = ADC16_INT_STS_TRIG_HW_CFLCT_MASK
, adc16_event_read_conflict = ADC16_INT_STS_READ_CFLCT_MASK
,
adc16_event_seq_sw_conflict = ADC16_INT_STS_SEQ_SW_CFLCT_MASK
, adc16_event_seq_hw_conflict = ADC16_INT_STS_SEQ_HW_CFLCT_MASK
, adc16_event_seq_dma_abort = ADC16_INT_STS_SEQ_DMAABT_MASK
, adc16_event_seq_full_complete = ADC16_INT_STS_SEQ_CMPT_MASK
,
adc16_event_seq_single_complete = ADC16_INT_STS_SEQ_CVC_MASK
, adc16_event_dma_fifo_full = ADC16_INT_STS_DMA_FIFO_FULL_MASK
} |
| | Define ADC16 irq events. More...
|
| |
|
| 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...
|
| |
ADC16 driver APIs.
◆ ADC16_IS_CHANNEL_INVALID
◆ ADC16_IS_CHANNEL_SAMPLE_CYCLE_INVALID
| #define ADC16_IS_CHANNEL_SAMPLE_CYCLE_INVALID |
( |
|
CYC | ) |
(CYC == 0) |
◆ ADC16_IS_PMT_DMA_BUFF_LEN_INVLAID
◆ ADC16_IS_SEQ_DMA_BUFF_LEN_INVLAID
◆ ADC16_IS_SEQ_LEN_INVLAID
◆ ADC16_IS_TRIG_CH_INVLAID
◆ ADC16_IS_TRIG_LEN_INVLAID
◆ adc16_clock_divider_t
#include <drivers/inc/hpm_adc16_drv.h>
Define ADC16 Clock Divider.
| Enumerator |
|---|
| adc16_clock_divider_1 | |
| adc16_clock_divider_2 | |
| adc16_clock_divider_3 | |
| adc16_clock_divider_4 | |
| adc16_clock_divider_5 | |
| adc16_clock_divider_6 | |
| adc16_clock_divider_7 | |
| adc16_clock_divider_8 | |
| adc16_clock_divider_9 | |
| adc16_clock_divider_10 | |
| adc16_clock_divider_11 | |
| adc16_clock_divider_12 | |
| adc16_clock_divider_13 | |
| adc16_clock_divider_14 | |
| adc16_clock_divider_15 | |
| adc16_clock_divider_16 | |
◆ adc16_conversion_mode_t
#include <drivers/inc/hpm_adc16_drv.h>
Define ADC16 conversion modes.
| Enumerator |
|---|
| adc16_conv_mode_oneshot | |
| adc16_conv_mode_period | |
| adc16_conv_mode_sequence | |
| adc16_conv_mode_preemption | |
◆ adc16_irq_event_t
#include <drivers/inc/hpm_adc16_drv.h>
Define ADC16 irq events.
| Enumerator |
|---|
| adc16_event_trig_complete | This mask indicates that a trigger conversion is complete.
|
| adc16_event_trig_sw_conflict | This mask indicates that a conflict caused by software-triggered conversions.
|
| adc16_event_trig_hw_conflict | This mask indicates that a conflict caused by hardware-triggered conversions.
|
| adc16_event_read_conflict | This mask indicates that a conflict caused when bus reading from different channels.
|
| adc16_event_seq_sw_conflict | This mask indicates that a conflict caused by sequence-triggered conversions.
|
| adc16_event_seq_hw_conflict | This mask indicates that a conflict caused by hardware-triggered conversions.
|
| adc16_event_seq_dma_abort | This mask indicates that DMA is stopped currently.
|
| adc16_event_seq_full_complete | This mask indicates that all of the configured conversion(s) in a queue is(are) complete.
|
| adc16_event_seq_single_complete | This mask indicates that one of the configured conversion(s) in a queue is complete.
|
| adc16_event_dma_fifo_full | This mask indicates that DMA FIFO is full currently.
|
◆ adc16_resolution_t
#include <drivers/inc/hpm_adc16_drv.h>
Define ADC16 resolutions.
| Enumerator |
|---|
| adc16_res_8_bits | |
| adc16_res_10_bits | |
| adc16_res_12_bits | |
| adc16_res_16_bits | |
◆ adc16_clear_status_flags()
| static void adc16_clear_status_flags |
( |
ADC16_Type * |
ptr, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
#include <drivers/inc/hpm_adc16_drv.h>
Clear the status flags.
- Parameters
-
| [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. |
- Note
- Only the specified flags can be cleared by writing the INT_STS register.
◆ adc16_deinit()
#include <drivers/inc/hpm_adc16_drv.h>
De-initialize an ADC16 instance.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
- Returns
- A result of de-initializing an ADC16 instance.
- Return values
-
| 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. |
◆ adc16_disable_busywait()
| static void adc16_disable_busywait |
( |
ADC16_Type * |
ptr | ) |
|
|
inlinestatic |
#include <drivers/inc/hpm_adc16_drv.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.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
- Deprecated:
- This API will be deleted from V2.0.x
◆ adc16_disable_interrupts()
| static void adc16_disable_interrupts |
( |
ADC16_Type * |
ptr, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
◆ adc16_disable_pmt_queue()
#include <drivers/inc/hpm_adc16_drv.h>
Disable the specified preemption queue.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | trig_ch | An ADC16 peripheral trigger channel. |
- Returns
- A result of setting queue enable in preemption.
- Return values
-
| 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. |
◆ adc16_enable_busywait()
| static void adc16_enable_busywait |
( |
ADC16_Type * |
ptr | ) |
|
|
inlinestatic |
#include <drivers/inc/hpm_adc16_drv.h>
Set value of the WAIT_DIS bit. ADC blocks access to the associated peripheral bus until the ADC completes the conversion.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
- Deprecated:
- This API will be deleted from V2.0.x
◆ adc16_enable_interrupts()
| static void adc16_enable_interrupts |
( |
ADC16_Type * |
ptr, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
◆ adc16_enable_pmt_queue()
#include <drivers/inc/hpm_adc16_drv.h>
Enable the specified preemption queue.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | trig_ch | An ADC16 peripheral trigger channel. |
- Returns
- A result of setting queue enable in preemption.
- Return values
-
| 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. |
◆ adc16_get_channel_default_config()
◆ adc16_get_channel_threshold()
#include <drivers/inc/hpm_adc16_drv.h>
Get thresholds of an ADC16 channel.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | ch | An ADC16 channel number |
| [out] | config | A pointer to the structure of channel threshold |
- Returns
- A result of getting thresholds of an ADC16 channel .
- Return values
-
| 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. |
◆ adc16_get_conv_valid_status()
| static bool adc16_get_conv_valid_status |
( |
ADC16_Type * |
ptr, |
|
|
uint8_t |
ch |
|
) |
| |
|
inlinestatic |
#include <drivers/inc/hpm_adc16_drv.h>
Get the status of a conversion validity.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | ch | An ADC16 peripheral channel. |
- Returns
- Status indicating the validity of the current conversion result.
- Note
- This function is only used when the WAIT_DIS bit in the BUF_RESULT register is 1.
◆ adc16_get_default_config()
◆ adc16_get_oneshot_result()
#include <drivers/inc/hpm_adc16_drv.h>
Get the result in oneshot mode.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | ch | An ADC16 peripheral channel. |
| [out] | result | A pointer to an ADC16 conversion result. |
- Returns
- An implementation result of getting an ADC16 conversion result in oneshot mode.
- Return values
-
| 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. |
◆ adc16_get_prd_result()
#include <drivers/inc/hpm_adc16_drv.h>
Get the result in the period mode.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | ch | An ADC16 peripheral channel. |
| [out] | result | A pointer to a specified ADC16 conversion result |
- Returns
- An implementation of getting an ADC16 conversion result in the period mode.
- Return values
-
| 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. |
◆ adc16_get_status_flags()
| static uint32_t adc16_get_status_flags |
( |
ADC16_Type * |
ptr | ) |
|
|
inlinestatic |
#include <drivers/inc/hpm_adc16_drv.h>
Get all ADC16 status flags.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
- Returns
- A mask indicating all corresponding interrupt statuses.
- Return values
-
◆ adc16_init()
#include <drivers/inc/hpm_adc16_drv.h>
Initialize an ADC16 instance.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | config | A pointer to the configuration struct of adc16_config_t. |
- Returns
- A result of initializing an ADC16 instance.
- Return values
-
| 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. |
◆ adc16_init_channel()
#include <drivers/inc/hpm_adc16_drv.h>
Initialize an ADC16 channel.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | config | A pointer to the configuration struct of adc16_channel_config_t. |
- Returns
- A result of initializing an ADC16 channel.
- Return values
-
| 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. |
◆ adc16_init_pmt_dma()
| static void adc16_init_pmt_dma |
( |
ADC16_Type * |
ptr, |
|
|
uint32_t |
addr |
|
) |
| |
|
inlinestatic |
#include <drivers/inc/hpm_adc16_drv.h>
Configure the start address of DMA write operation for the preemption mode.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | addr | A start address of DMA write operation. |
◆ adc16_init_seq_dma()
#include <drivers/inc/hpm_adc16_drv.h>
Configure the start address of DMA write operation for the sequence mode.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | config | A pointer to configuration struct of adc16_dma_config_t. |
- Returns
- An implementation result of DMA initializing for the sequence mode
- Return values
-
| 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. |
◆ adc16_is_nonblocking_mode()
| static bool adc16_is_nonblocking_mode |
( |
ADC16_Type * |
ptr | ) |
|
|
inlinestatic |
#include <drivers/inc/hpm_adc16_drv.h>
Judge whether the current setting is none-blocking mode or not.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
- Returns
- A result indicating the status of bus waiting.
- Return values
-
| True | means that nonblocking reading. |
| False | means that blocking reading. |
◆ adc16_seq_disable_hw_trigger()
| static void adc16_seq_disable_hw_trigger |
( |
ADC16_Type * |
ptr | ) |
|
|
inlinestatic |
#include <drivers/inc/hpm_adc16_drv.h>
Disable the hw trigger control for the sequence mode.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
◆ adc16_seq_enable_hw_trigger()
| static void adc16_seq_enable_hw_trigger |
( |
ADC16_Type * |
ptr | ) |
|
|
inlinestatic |
#include <drivers/inc/hpm_adc16_drv.h>
Enable the hw trigger control for the sequence mode.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
◆ adc16_set_blocking_read()
| static void adc16_set_blocking_read |
( |
ADC16_Type * |
ptr | ) |
|
|
inlinestatic |
#include <drivers/inc/hpm_adc16_drv.h>
Set blocking read in oneshot mode.
- Note
- An ADC blocks access to the associated peripheral bus until it completes a conversion.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
◆ adc16_set_nonblocking_read()
| static void adc16_set_nonblocking_read |
( |
ADC16_Type * |
ptr | ) |
|
|
inlinestatic |
#include <drivers/inc/hpm_adc16_drv.h>
Set nonblocking read in oneshot mode.
- Note
- An ADC does not block access to the associated peripheral whether it completes a conversion or not.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
◆ adc16_set_pmt_config()
#include <drivers/inc/hpm_adc16_drv.h>
Configure the preemption mode for an ADC16 instance.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | config | A pointer to configuration struct of adc16_pmt_config_t. |
- Returns
- A result of configuring the preemption mode for an ADC16 instance.
- Return values
-
| 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. |
◆ adc16_set_pmt_queue_enable()
#include <drivers/inc/hpm_adc16_drv.h>
Set the queue enable control.
- Parameters
-
| [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. |
- Returns
- A result of setting queue enable in preemption.
- Return values
-
| 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. |
- Deprecated:
- This API will be deleted from V2.0.x
◆ adc16_set_prd_config()
#include <drivers/inc/hpm_adc16_drv.h>
Configure the the period mode for an ADC16 instance.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | config | A pointer to the configuration struct of adc16_prd_config_t. |
- Returns
- A result of configuring the the period mode for an ADC16 instance.
- Return values
-
| 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. |
◆ adc16_set_seq_config()
#include <drivers/inc/hpm_adc16_drv.h>
Configure the sequence mode for an ADC16 instance.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | config | A pointer to configuration struct of adc16_seq_config_t. |
- Returns
- A result of configuring the sequence mode for an ADC16 instance.
- Return values
-
| 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. |
◆ adc16_set_seq_stop_pos()
| static void adc16_set_seq_stop_pos |
( |
ADC16_Type * |
ptr, |
|
|
uint16_t |
stop_pos |
|
) |
| |
|
inlinestatic |
#include <drivers/inc/hpm_adc16_drv.h>
Configure the stop position offset in the specified memory of DMA write operation for the sequence mode.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | stop_pos | A stop position offset. |
◆ adc16_trigger_pmt_by_sw()
#include <drivers/inc/hpm_adc16_drv.h>
Trigger ADC conversions by software in preemption mode.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
| [in] | trig_ch | A trigger channel number(e.g. TRIG0A,TRIG0B,TRIG0C...). |
- Returns
- An implementation result of getting an ADC16 software trigger.
- Return values
-
| status_success | ADC16 software triggers successfully. Please refer to hpm_stat_t. |
| status_fail | ADC16 software triggers unsuccessfully. Please refer to hpm_stat_t. |
◆ adc16_trigger_seq_by_sw()
#include <drivers/inc/hpm_adc16_drv.h>
Trigger ADC conversions by software in sequence mode.
- Parameters
-
| [in] | ptr | An ADC16 peripheral base address. |
- Returns
- An implementation result of getting an ADC16 software trigger.
- Return values
-
| status_success | ADC16 software triggers successfully. Please refer to hpm_stat_t. |
| status_fail | ADC16 software triggers unsuccessfully. Please refer to hpm_stat_t. |