2024-12-11 16:21:57 +08:00
|
|
|
|
/*
|
|
|
|
|
* bsp_adc.h
|
|
|
|
|
*
|
|
|
|
|
* Created on: 2024<EFBFBD><EFBFBD>11<EFBFBD><EFBFBD>29<EFBFBD><EFBFBD>
|
|
|
|
|
* Author: 123
|
|
|
|
|
*/
|
|
|
|
|
|
2025-06-11 10:07:00 +08:00
|
|
|
|
#ifndef __BSP_ADC_H__
|
|
|
|
|
#define __BSP_ADC_H__
|
2024-12-11 16:21:57 +08:00
|
|
|
|
|
2025-06-11 10:07:00 +08:00
|
|
|
|
#include "CONFIG.h"
|
2024-12-11 16:21:57 +08:00
|
|
|
|
|
2025-06-11 10:07:00 +08:00
|
|
|
|
// PA 2,3
|
|
|
|
|
#define ADC_VBAT_PIN GPIO_Pin_5
|
|
|
|
|
#define ADC_COIL_PIN GPIO_Pin_4
|
2025-03-31 17:33:05 +08:00
|
|
|
|
|
2025-06-11 10:07:00 +08:00
|
|
|
|
// channel
|
|
|
|
|
#define ADC_VBAT_CHANNEL 1
|
|
|
|
|
#define ADC_COIL_CHANNEL 0
|
2024-12-11 16:21:57 +08:00
|
|
|
|
|
2025-06-11 10:07:00 +08:00
|
|
|
|
#define VBAT_CHECK_EVT (0x0001 << 0)
|
2025-03-31 17:33:05 +08:00
|
|
|
|
|
2025-06-11 10:07:00 +08:00
|
|
|
|
extern tmosTaskID adc_task_id;
|
2025-03-31 17:33:05 +08:00
|
|
|
|
|
2025-06-11 11:20:42 +08:00
|
|
|
|
#define ADC_SAMPLING_TIME 20
|
2025-06-11 10:07:00 +08:00
|
|
|
|
|
|
|
|
|
void BSP_ADC_Init(void);
|
|
|
|
|
|
|
|
|
|
uint16_t BSP_ReadVbat(void);
|
|
|
|
|
|
|
|
|
|
#endif /* __BSP_ADC_H__ */
|