32 lines
782 B
C
32 lines
782 B
C
|
|
/*----------------------------------------------------------------*
|
|||
|
|
* *
|
|||
|
|
* 电池电压读取模块 *
|
|||
|
|
* *
|
|||
|
|
* 作者:钱向红 *
|
|||
|
|
* *
|
|||
|
|
* 时间:2017-02-10 *
|
|||
|
|
* *
|
|||
|
|
*----------------------------------------------------------------*/
|
|||
|
|
|
|||
|
|
#ifndef USER_ADC_BAT_PRESENT
|
|||
|
|
#define USER_ADC_BAT_PRESENT
|
|||
|
|
|
|||
|
|
// 颠倒字节顺序
|
|||
|
|
uint16_t ntohs(uint16_t n);
|
|||
|
|
uint32_t ntohl(uint32_t n);
|
|||
|
|
#define htons(n) ntohs(n)
|
|||
|
|
#define htonl(n) ntohl(n)
|
|||
|
|
|
|||
|
|
// 初始化引脚
|
|||
|
|
void Battery_Init(void);
|
|||
|
|
void Battery_Open();
|
|||
|
|
|
|||
|
|
// 读电池数据并解析
|
|||
|
|
uint32_t DS2788_ReadBattery(data_dtu_t *sample);
|
|||
|
|
|
|||
|
|
// 充放电改变标志
|
|||
|
|
extern uint8_t bat_CurrentEvent;
|
|||
|
|
extern uint32_t Poweroff_time;
|
|||
|
|
|
|||
|
|
#endif
|