15 lines
348 B
C
15 lines
348 B
C
#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 */
|