/** ##########################################################################
**     Filename  : WheelHeat.h
**     Project   :
**     Module    :
**     Processor :
**     Version   : 1.0
**     Compiler  :
**     Date/Time :
**     Abstract  :
**     Contents  :
**     Note      :
**     (c) Copyright dmdz Co.,Ltd
**  --------------------------------------------------------------------------
**               R E V I S I O N   H I S T O R Y
**  --------------------------------------------------------------------------
**  Date        Ver      Author             Description

**  -20231107-  V01-- --Linboyi---            --初版--
** #########################################################################*/
#ifndef WHEEL_HEAT_H
#define WHEEL_HEAT_H




/*****************************************************************************
* I N C L U D E   F I L E S
*****************************************************************************/
#include "common_types.h"
/*****************************************************************************
* D E F I N E S / M A C R O S
*****************************************************************************/
#define WHEEL_HEAT_TASK_CYCLE_TIME  10u  



#define WHEEL_HEAT_EVENT_IDLE   0u
#define WHEEL_HEAT_EVENT_OPEN   1u
#define WHEEL_HEAT_EVENT_CLOSE  2u
#define WHEEL_HEAT_EVENT_LV1  3u  
#define WHEEL_HEAT_EVENT_LV2  4u 
#define WHEEL_HEAT_EVENT_LV3  5u 

#define WHEEL_HEAT_NTC_LV1   3600u
#define WHEEL_HEAT_NTC_LV2   3450u
#define WHEEL_HEAT_NTC_LV3   3280u


#define WHEEL_HEAT_NTCLV_NUM   4u

/* NTC 温度 不代表加热盘温度 */
#define TEMP_NEGATIVE_25C   (uint16_t)4762  //-25℃ 
#define TEMP_NEGATIVE_5C    (uint16_t)4461
#define TEMP_NEGATIVE_20C   (uint16_t)4701  //-20℃   加热功能强数据
#define TEMP_NEGATIVE_15C   (uint16_t)4610  //-15℃
#define TEMP_NEGATIVE_10C   (uint16_t)4551  //-10℃
#define TEMP_POSITIVE_0C    (uint16_t)4363  //0℃
#define TEMP_POSITIVE_20C   (uint16_t)4025 //15
#define TEMP_POSITIVE_30C   (uint16_t)3907 //20
#define TEMP_POSITIVE_35C   (uint16_t)3788 //25
#define TEMP_POSITIVE_40C   (uint16_t)3610
#define TEMP_POSITIVE_45C   (uint16_t)3552 // 35 
#define TEMP_POSITIVE_48C   (uint16_t)3452  // 38
#define TEMP_POSITIVE_50C   (uint16_t)3420  //41
#define TEMP_POSITIVE_55C   (uint16_t)3350 //45 
#define TEMP_POSITIVE_56C   (uint16_t)3335


#define WHEEL_HEAT_FORCE_OUTPUT_4MIN    ((4u*60u*1000u) / WHEEL_HEAT_TASK_CYCLE_TIME)
#define WHEEL_HEAT_FORCE_OUTPUT_5MIN    ((5u*60u*1000u) / WHEEL_HEAT_TASK_CYCLE_TIME)
#define WHEEL_HEAT_FORCE_OUTPUT_6MIN    ((6u*60u*1000u) / WHEEL_HEAT_TASK_CYCLE_TIME)
#define WHEEL_HEAT_FORCE_OUTPUT_7MIN    ((7u*60u*1000u) / WHEEL_HEAT_TASK_CYCLE_TIME)
#define WHEEL_HEAT_FORCE_OUTPUT_8MIN    ((8u*60u*1000u) / WHEEL_HEAT_TASK_CYCLE_TIME)
#define WHEEL_HEAT_FORCE_OUTPUT_10MIN   ((10u*60u*1000u) / WHEEL_HEAT_TASK_CYCLE_TIME)

#define WHEEL_HEAT_NTC_NORMAL  0u
#define WHEEL_HEAT_NTC_SHORT  1u
#define WHEEL_HEAT_NTC_OPEN  2u
#define WHEEL_HEAT_OVERCURRENT  1u

#define HEAT_DIAG_DISABLE 0u
#define HEAT_DIAG_ENABLE 1u

#define HEAT_CURRENT 50u

/*****************************************************************************
* T Y P E   D E F I N I T I O N S
*****************************************************************************/
#define WHEEL_HEAT_DCM_CONTROL_OPEN		1u
#define WHEEL_HEAT_DCM_CONTROL_CLOSE	0u
/*****************************************************************************
* G L O B A L   V A R I A B L E S
* only configuration table allowed here,variables are not allowed!
*****************************************************************************/

/*****************************************************************************
* C O N S T A N T S
*****************************************************************************/

/*****************************************************************************
* F U N C T I O N   P R O T O T Y P E
*****************************************************************************/
extern void WheelHeat_SetEvent(uint8_t Event);
extern void WheelHeat_MainFunction(void);
extern void WheelHeat_Init(void);
extern void WheelHeat_SetGearEvevt(uint8_t Evevt);
extern void WheelHeat_ControlForDcm(uint8_t Open);
void WheelHeat_Set_Heat_Limit_ACC(uint8_t Evevt);
void WheelHeat_ReturnControlForEcu(void);
void WheelHeat_SetHeating_Gear(uint8_t Evevt);
uint8_t WheelHeat_GetHeatOverCurrent(void);
uint8_t WheelHeat_GetNtcState(void);
void WheelHeat_HeatingGear_STATE_ON(void);
void WheelHeat_HeatingGear_STATE_HOLD(void);
void WheelHeat_Wire_Short_Check_PowerOn(void);

#endif