sggt/App/IP5310/ip5310_i2c.h

43 lines
971 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.

/*
* @Author: wujunchao wujunchao@wuxismart.com
* @Date: 2025-03-17 13:35:17
* @LastEditors: wujunchao wujunchao@wuxismart.com
* @LastEditTime: 2025-03-24 17:34:13
* @FilePath: \signal_generator\App\APP_WU\Inc\ip5310_i2c.h
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
#ifndef __IP5310_I2C_H
#define __IP5310_I2C_H
#include "apps_gather.h"
extern uint8_t bat_cpa;
extern uint8_t charge_flag;
extern uint8_t charging_flag;
//电芯电量寄存器
//bits [4~7]->[0000, 0001, 0011, 0111, 1111]->[<3%, 3~25%, 25~50%, 50~75%, >75%]
#define BATTERY_CAPACITY 0x74
//[3]bit, 1充电开启, 0充电关闭
#define CHARGE_FLAG 0x70
//[3]bit, 1充电结束, 0充电中
#define CHARGING_FLAG 0x71
//读命令
#define READ_CMD 0xEB
//写命令
#define WRITE_CMD 0xEA
//I2C读取电池电量
void read_battery(void);
#endif