85 lines
1.8 KiB
C
85 lines
1.8 KiB
C
/*
|
||
******************************************************************************
|
||
*
|
||
* @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 CHG_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
|
||
|