| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #ifndef _USER_ADC_H__
- #define _USER_ADC_H__
- #include <stdint.h>
- #include <stdbool.h>
- #include "define.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define TEMPE_OWNER 0
- #define TEMP_INTERVAL 1000
- #define ADC_TASK_PRIO (configMAX_PRIORITIES - 1)
- #define ADC_VDDA 3300
- #define ADC_BUFFER_SIZE 100
- #if TEMPE_OWNER == 1
- #define TEMPE_AVG_SLOPE -4.3f //内部温度斜率mV
- #define TEMPE_V_25 1400.0f //25摄氏度是电压mV
- #define ADC_COUNT 3
- #else
- #define ADC_COUNT 2
- #endif
- #define ADC_RCC_ENABLE RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE );
- #define ADC_GPIO_RCC_ENABLE RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
- #define ADC_CHANNEL ADC1
- /*!< GPIO define */
- #define LEFT_NTC_GPIO GPIOA
- #define LEFT_NTC_PIN GPIO_Pin_0
- #define LEFT_NTC_CHANNEL ADC_Channel_0
- #define RIGHT_NTC_GPIO GPIOA
- #define RIGHT_NTC_PIN GPIO_Pin_1
- #define RIGHT_NTC_CHANNEL ADC_Channel_1
- typedef struct{
- uint16_t left_ntc;
- uint16_t right_ntc;
- #if TEMPE_OWNER == 1
- float tmp_chip;
- #endif
- }adc_data_s;
- typedef void (*adc_upload_func)(adc_data_s data, bool tmp_stat);
-
- //初始化SAADC,配置使用的SAADC通道的参数和缓存
- void set_adc_upload_func(adc_upload_func func);
- void adc_init(void);
- void adc_task_start(void);
- uint16_t adc_task_process_event(uint8_t task_id, uint16_t events);
- void vUser_adc_dma_finish(void);
-
- #ifdef __cplusplus
- }
- #endif
- #endif // BAT_H__
- /** @} */
|