SY8835_For_Demo_Ourself/UsrInc/charger/charger_module.h
Alex xu 075256bef7 更改内容:1、优化ADC采样逻辑,更改在ADC中断中采样为在主程序中轮询采样,减小系统开销;
2、更改NTC保护相关逻辑,由ADC电压值更改为ADC码值;
3、优化Boost放电逻辑;
4、更改灯效显示功能;
5、优化双向通讯功能;
6、其它优化。
2024-12-27 11:05:00 +08:00

85 lines
1.8 KiB
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.

/*
******************************************************************************
*
* @file Charger_module.h
* @brief charger module
* @ic sy8835
*
* @version 1.0
* @date 2024/11/01 09:59:40
* @author Alex Xu
*
* Copyright (c) 2013-2099,Tkplusemi Technology Co.,Ltd.
* All Rights Reserved
*
* History:
* Revision Date Author Desc
* 1.0.0 2024/11/01 Alex build this file
******************************************************************************
*/
#ifndef __CHARGER_MODULE_H__
#define __CHARGER_MODULE_H__
#include "define.h"
#ifdef NTC_ENABLE
extern bit NTC_Pro_Flag;
#endif
// 充电状态定义
typedef enum
{
CHG_NONE = 0x00,
CHG_PROTECT,
CHG_STA_ING, // 充电中
CHG_STA_COMPLETED, // 充电完成
} TE_CHG_STA;
extern idata TE_CHG_STA ChgStatus; // 系统状态定义
#if CHARGER_ENABLE
/* Charger Current Setting */
typedef struct {
uint8_t nTrickle_Cur; //Set Trickle Current Trickle charge 电流配置step 10mA;
uint8_t nConstant_Cur; //Set Constant Current 恒流 cc 电流配置step 25mA
uint8_t nIterm_Cur; //Set Iterm Current iterm charge 电流配置(范围5mA ~ 50mA ,step 5mA)
uint8_t nVFloat;
} s_gCharger_Cfg;
/*充电电流设置在系统初始化时通过配置寄存器REG_CHG1配置。
REG_CHG1 = CHG_CURRENT_300MA;
*/
#define CHG_CURRENT_100MA 0x00
#define CHG_CURRENT_200MA 0x01
#define CHG_CURRENT_250MA 0x02
#define CHG_CURRENT_300MA 0x03
#define CHG_CURRENT_350MA 0x04
#define CHG_CURRENT_400MA 0x05
#define CHG_CURRENT_450MA 0x06
#define CHG_CURRENT_500MA 0x07
#define CHG_CONSTANT_CUR_TIM 1
#define DIE_OT_RECOVER_TIM 25 //NTC保护后恢复正常后等待250ms重新开启充电
extern void Charger_Init(void);
extern void Charger_Handler(void);
#ifdef NTC_ENABLE
extern uint8_t PMU_NTC_Handle(uint8_t Charge_sta);
#endif
#endif
#endif