nongye/STM32F103_App1/HardWare/ADC/adc.h

15 lines
348 B
C
Raw 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 "main.h"
/* 电池电量检测PA0, ADC1 通道0
* 分压比/偏移/电量区间在 main.h 的 BAT_* 宏配置,默认沿用控制板参数:
* 电压 = ADC/4096*3.3*11 + 0.6,电量% = 100*(V-10.8)/(12.6-10.8)12V 铅酸) */
void adcInit(void);
uint16_t getAdc(void);
int battery_percent(void); /* 0~100 */
#endif /* __ADC_H */