templature_fan/Source/User/demo/inc/bsp_adc.h

31 lines
862 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __ADC_H
#define __ADC_H
#include "hk32f030m.h"
// ADC 编号选择
// 可以是 ADC1
#define ADC_APBxClock_FUN RCC_APB2PeriphClockCmd
#define ADCx ADC1
#define ADC_CLK RCC_APB2Periph_ADC
// ADC GPIO宏定义
// 注意用作ADC采集的IO必须没有复用否则采集电压会有影响
#define ADC_GPIO_AHBxClock_FUN RCC_AHBPeriphClockCmd
#define ADC_GPIO_CLK RCC_AHBPeriph_GPIOD
#define ADC_PORT GPIOD
#define ADC_PIN GPIO_Pin_2
// ADC 通道宏定义
#define ADC_CHANNEL ADC_Channel_4
// ADC 中断相关宏定义
#define ADC_IRQ ADC1_IRQn
#define ADC_IRQHandler ADC1_IRQHandler
void ADCx_Init(void);
#endif /* __ADC_H */