BLE5.2 1.0
开发文档说明
| 枚举 | 函数
xc_drv_adc.h 文件参考

The header of xc_drv_adc.c 更多...

浏览源代码.

struct  ADC_FIFO_TypeDef_t
 
struct  ADC_InitCfg_t
 

枚举

enum  ADC_ChannelTypeDef_t {
  ADC_CH0_PIN21 = 0 , ADC_CH1_PIN20 = 1 , ADC_CH2_PIN19 = 2 , ADC_CH3_PIN18 = 3 ,
  ADC_CH4_PIN0 = 4 , ADC_CH5_PIN1 = 5 , ADC_CH6_PIN4 = 6 , ADC_CH7_PIN5 = 7 ,
  ADC_CH8_NOPIN = 8 , ADC_CH9_NOPIN = 9 , ADC_CH10_NOPIN = 10 , ADC_CH11_NOPIN = 11 ,
  ADC_CH12_PIN2 = 12 , ADC_CH13_PIN3 = 13 , ADC_CH14_PIN6 = 14 , ADC_CH15_PIN7 = 15
}
 
enum  ADC_RefVolTypeDef_t { ADC_REF_VOL_2_48V = 0 , ADC_REF_VOL_3_3V = 1 }
 
enum  ADC_FreqTypeDef_t {
  ADC_FREQ_8M = 0x00 , ADC_FREQ_4M = 0x01 , ADC_FREQ_2M = 0x03 , ADC_FREQ_1M = 0x07 ,
  ADC_FREQ_500K = 0x0f
}
 
enum  ADC_SampModeTypeDef_t { ADC_SAMPMODE_SINGLE_ENDED = 0x00UL , ADC_SAMPMODE_DIFFERENTIAL = 0x01UL }
 
enum  ADC_SampEdgeTypeDef_t { ADC_SAMPEDGE_FALL = 0x00UL , ADC_SAMPEDGE_RISE = 0x01UL }
 

函数

static __inline void xc_adc_fifo_flush (void)
 
static __inline void xc_adc_refvol_set (uint8_t ref_vol)
 
static __inline void xc_adc_freq_set (uint8_t freq)
 
void xc_adc_init (ADC_InitCfg_t *adc_cfg)
 xc_adc_init
 
void xc_adc_start_get_value (ADC_ChannelTypeDef_t Channel, uint16_t *adc_val)
 xc_adc_startgetvalue
 
void xc_adc_enable_it (uint8_t it)
 xc_adc_enable_it
 
void xc_adc_disable_it (uint8_t it)
 
void xc_adc_fifo_req_len_set (uint8_t len)
 xc_adc_fifo_req_len_set
 
void xc_adc_wait_time_set (uint8_t timer0, uint16_t timer1)
 xc_adc_wait_time_set
 
void xc_adc_ch_auto_enable (void)
 xc_adc_ch_auto_enable
 
void xc_adc_ch_auto_disable (void)
 xc_adc_ch_auto_enable
 
void xc_adc_ch_auto_set (uint8_t ch)
 xc_adc_ch_auto_set
 
void xc_adc_ch_not_auto_set (uint8_t ch)
 xc_adc_ch_auto_set
 
void xc_adc_it_set (uint8_t it)
 xc_adc_it_set
 
uint8_t xc_adc_it_get (void)
 xc_adc_it_get
 
uint32_t xc_adc_data_get (void)
 xc_adc_data_get
 
void xc_adc_enable (void)
 xc_adc_enable
 
void xc_adc_disable (void)
 xc_adc_disable
 
uint16_t xc_adc_it_collectval_get (void)
 xc_adc_it_collectval_get
 
void xc_adc_channel_gpio_config (ADC_ChannelTypeDef_t Channel)
 xc_adc_data_average
 
void adc_intr_callback (void)
 adc_intr_callback
 

详细描述

The header of xc_drv_adc.c

_ __ _ ________ _
| |/ /(_)___ / ____/ /_ (_)___
| // / __ \/ / / __ \/ / __ \
/ |/ / / / / /___/ / / / / /_/ /
/_/|_/_/_/ /_/\____/_/ /_/_/ .___/
/_/
(C) 2022-2025 XinChip
作者
( XinChip ) Alex-J
( XinChip )

在文件 xc_drv_adc.h 中定义.

枚举类型说明

◆ ADC_ChannelTypeDef_t

枚举值
ADC_CH0_PIN21 
ADC_CH1_PIN20 
ADC_CH2_PIN19 
ADC_CH3_PIN18 
ADC_CH4_PIN0 
ADC_CH5_PIN1 
ADC_CH6_PIN4 
ADC_CH7_PIN5 
ADC_CH8_NOPIN 
ADC_CH9_NOPIN 
ADC_CH10_NOPIN 
ADC_CH11_NOPIN 
ADC_CH12_PIN2 
ADC_CH13_PIN3 
ADC_CH14_PIN6 
ADC_CH15_PIN7 

在文件 xc_drv_adc.h131 行定义.

◆ ADC_FreqTypeDef_t

枚举值
ADC_FREQ_8M 
ADC_FREQ_4M 
ADC_FREQ_2M 
ADC_FREQ_1M 
ADC_FREQ_500K 

在文件 xc_drv_adc.h157 行定义.

◆ ADC_RefVolTypeDef_t

枚举值
ADC_REF_VOL_2_48V 
ADC_REF_VOL_3_3V 

在文件 xc_drv_adc.h151 行定义.

◆ ADC_SampEdgeTypeDef_t

枚举值
ADC_SAMPEDGE_FALL 

Single-ended mode. PSELN will be ignored, negative input to ADC shorted to GND.

ADC_SAMPEDGE_RISE 

Differential mode.

在文件 xc_drv_adc.h174 行定义.

◆ ADC_SampModeTypeDef_t

枚举值
ADC_SAMPMODE_SINGLE_ENDED 
ADC_SAMPMODE_DIFFERENTIAL 

在文件 xc_drv_adc.h166 行定义.

函数说明

◆ adc_intr_callback()

void adc_intr_callback ( void  )

adc_intr_callback

ADC interrupts the callback function that gets ADC sampled data

参数
[in]void
[out]void
返回值
void

在文件 xc_drv_adc.c535 行定义.

◆ xc_adc_ch_auto_disable()

void xc_adc_ch_auto_disable ( void  )

xc_adc_ch_auto_enable

Disable the ADC automatic switching function

参数
[in]void
[out]void
返回值
void

在文件 xc_drv_adc.c393 行定义.

◆ xc_adc_ch_auto_enable()

void xc_adc_ch_auto_enable ( void  )

xc_adc_ch_auto_enable

The ADC automatic switchover was enabled

参数
[in]void
[out]void
返回值
void

在文件 xc_drv_adc.c377 行定义.

◆ xc_adc_ch_auto_set()

void xc_adc_ch_auto_set ( uint8_t  ch)

xc_adc_ch_auto_set

Set the channel to be switched automatically

参数
[in]ch: Automatic switching channel ( 1-->4 channel ?A bit represents a channel )
[out]void
返回值
void

在文件 xc_drv_adc.c409 行定义.

◆ xc_adc_ch_not_auto_set()

void xc_adc_ch_not_auto_set ( uint8_t  ch)

xc_adc_ch_auto_set

ADC channel selection for non-automatic switching channels

参数
[in]ch: 0 - 13(ADC_CH0_PIN21 - ADC_CH13_PIN6)
[out]void
返回值
void

在文件 xc_drv_adc.c425 行定义.

◆ xc_adc_channel_gpio_config()

void xc_adc_channel_gpio_config ( ADC_ChannelTypeDef_t  Channel)

xc_adc_data_average

Select and initialize the GPIO port based on the channel

参数
[in]Channel: adc Channel
[out]void
返回值
void

在文件 xc_drv_adc.c147 行定义.

◆ xc_adc_data_get()

uint32_t xc_adc_data_get ( void  )

xc_adc_data_get

Get ADC sampling data

参数
[in]void
[out]void
返回值
adcfifo data

在文件 xc_drv_adc.c480 行定义.

◆ xc_adc_disable()

void xc_adc_disable ( void  )

xc_adc_disable

Stop adc sampling

参数
[in]void
[out]void
返回值
void

在文件 xc_drv_adc.c297 行定义.

◆ xc_adc_disable_it()

void xc_adc_disable_it ( uint8_t  it)

在文件 xc_drv_adc.c319 行定义.

◆ xc_adc_enable()

void xc_adc_enable ( void  )

xc_adc_enable

Start adc sampling

参数
[in]void
[out]void
返回值
void

在文件 xc_drv_adc.c281 行定义.

◆ xc_adc_enable_it()

void xc_adc_enable_it ( uint8_t  it)

xc_adc_enable_it

Enable adc interrupt

参数
[in]it
[out]void
返回值
void

在文件 xc_drv_adc.c314 行定义.

◆ xc_adc_fifo_flush()

static __inline void xc_adc_fifo_flush ( void  )
static

在文件 xc_drv_adc.h200 行定义.

◆ xc_adc_fifo_req_len_set()

void xc_adc_fifo_req_len_set ( uint8_t  len)

xc_adc_fifo_req_len_set

fifo receive length Settings for adc

参数
[in]len: fifo length (ADC_FIFO_CTL_READ_REQ_THRESH_LEN_1 ~ ADC_FIFO_CTL_READ_REQ_THRESH_LEN_15)
[out]void
返回值
void

在文件 xc_drv_adc.c337 行定义.

◆ xc_adc_freq_set()

static __inline void xc_adc_freq_set ( uint8_t  freq)
static

在文件 xc_drv_adc.h218 行定义.

◆ xc_adc_init()

void xc_adc_init ( ADC_InitCfg_t adc_cfg)

xc_adc_init

ADC initialization

参数
[in]adc_cfgThis is the structure parameter that the ADC initializes
[out]void
返回值
void
@other
adc_cfg.Freq = ADC_FREQ_2M; adc_cfg.RefVol = ADC_REF_VOL_3_3V; adc_cfg.SampEdge = ADC_SAMPEDGE_RISE; adc_cfg.ExtDataMode = ADC_EXT_DATA_MODE_32BIT; adc_cfg.ExtEdgeSel = ADC_EXT_EDGE_SEL_INTER; adc_cfg.ExtSampleNum = ADC_EXT_SAMPLE_NUM_8; adc_cfg.ExtTriggerSel = ADC_EXT_TRIGGER_SEL_PWM0;

adc_init(&adc_cfg);

在文件 xc_drv_adc.c67 行定义.

◆ xc_adc_it_collectval_get()

uint16_t xc_adc_it_collectval_get ( void  )

xc_adc_it_collectval_get

Gets the data saved by the ADC interrupt

参数
[in]void
[out]void
返回值
adc_it_val

在文件 xc_drv_adc.c509 行定义.

◆ xc_adc_it_get()

uint8_t xc_adc_it_get ( void  )

xc_adc_it_get

Gets the ADC interrupt enable

参数
[in]void
[out]void
返回值
nterruptenable register

在文件 xc_drv_adc.c463 行定义.

◆ xc_adc_it_set()

void xc_adc_it_set ( uint8_t  it)

xc_adc_it_set

ADC Interrupt setting

参数
[in]it: Bits Field Name Reset Value
1 FIFO_ERROR_INT 0 0 READ_REQ_INT 0
[out]void
返回值
void

在文件 xc_drv_adc.c446 行定义.

◆ xc_adc_refvol_set()

static __inline void xc_adc_refvol_set ( uint8_t  ref_vol)
static

在文件 xc_drv_adc.h206 行定义.

◆ xc_adc_start_get_value()

void xc_adc_start_get_value ( ADC_ChannelTypeDef_t  Channel,
uint16_t *  adc_val 
)

xc_adc_startgetvalue

The corresponding ADC sampling value is obtained according to the channel

参数
[in]Channel: The ADC sampling channel to be obtained
[in]*adc_valADC sample storage area
[out]void
返回值
void

在文件 xc_drv_adc.c210 行定义.

◆ xc_adc_wait_time_set()

void xc_adc_wait_time_set ( uint8_t  timer0,
uint16_t  timer1 
)

xc_adc_wait_time_set

ADC sampling wait time and interval Settings

参数
[in]timer0Sampling wait time
[in]timer1Sampling interval time ADC switches automatically when activated: sampling time(sampling frequency) = timer0 + timer1; (1M sampling(1US) = 0X1 + 31) timer0 < timer1
[out]void
返回值
void

在文件 xc_drv_adc.c360 行定义.