BGLInterface.h 3.23 KB
Newer Older
hu's avatar
hu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#ifndef _BGLINTERFACE_H
#define _BGLINTERFACE_H
#define uint8_t unsigned char 
#define uint16_t unsigned short/*3360 324*/ 
/*#define uint16_t unsigned int*/ /*Freesecale */
/*#define uint32_t unsigned long*//*Freesecale */
#define uint32_t unsigned int
#define COLOR_LED_DEBUG 0u
/*占空比最大值*/
#define BACKLIGHTCYCLE 721u
#define NTC_AD_MAX 4096u
/*有小灯背光降到当前显示等级的百分比*/
#define POSITION_LIGHT_PERCENT 50u
enum {
    BGL_IGN_OFF,
    BGL_IGN_ON,
};

enum {
    BGL_GRADUAL,
    BGL_DIRECT,
};
enum {
    BL_TYPE_DAY,
    BL_TYPE_EVENING,
    BL_TYPE_NIGHT,
    BL_TYPE_TOTAL,
};
enum {
    BL_THEME_RED,
    BL_THEME_BLUE,
    BL_THEME_WHITE,
    BL_THEME_TOTAL,
};
enum {
36 37
    BL_LV_MIN = 0u,
    BL_LV_1,
hu's avatar
hu committed
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
    BL_LV_2,
    BL_LV_3,
    BL_LV_4,
    BL_LV_5,
    BL_LV_6,
    BL_LV_7,
    BL_LV_8,
    BL_LV_9,
    BL_LV_10,
    BL_LV_11,
    BL_LV_12,
    BL_LV_13,
    BL_LV_14,
    BL_LV_15,
    BL_LV_MAX,
    BL_LV_TOTAL,
};
enum {
    BL_TFT,
    BL_DIAL,
58 59 60
    LED_FUEL,
    LED_TEMP,
    LED_TEMPBL,
hu's avatar
hu committed
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
    BACKLIGHT_TOTAL,
};
typedef struct {
    uint16_t DestBackLightDuty;
    uint16_t CurBackLightDuty;
    uint16_t BackLightDutyMin;
}BACKLIGHT_PARA;
typedef struct {
    uint8_t BL_User_PowerSt;
    uint8_t BL_User_WakeFlag;
    uint16_t BL_User_TFTDuty;
    uint16_t BL_User_GaugesDuty;
    uint16_t BL_User_RDuty;
    uint16_t BL_User_GDuty;
    uint16_t BL_User_BDuty;
    uint16_t BL_User_TFTDuty_MIN;
    uint16_t BL_User_GaugesDuty_MIN;
    uint16_t BL_User_RDuty_MIN;
    uint16_t BL_User_GDuty_MIN;
    uint16_t BL_User_BDuty_MIN;
}BL_USER_PARA;
typedef struct {
    uint8_t BL_User_Theme;
    uint8_t BL_User_Type;
    uint8_t BL_User_Lvl;
    uint8_t BL_User_Lvl_Total;
    uint16_t BL_User_NTC_AD;
    uint16_t BL_User_NTC_AD_MAX;
    uint8_t BL_User_effect;
}BL_STATE_PARA;
extern void  BGLPwm_Config(uint8_t BGLType,  uint16_t DutyVal);
extern void BackLightDeal(BL_USER_PARA  BL_FunPara,BL_STATE_PARA BLFunStatePara);
extern void BGLPwm_Stop(uint8_t BGLType);
extern void BGLPwm_Start(uint8_t BGLType);
/*以下主函数调用*/
/*得到主题模式可自己在枚举中定义 在BackGroundLight.c里填表*/
extern void GetBGLTheme(uint8_t BGLTheme);
/*得到工作模式 白天 傍晚 夜晚 在枚举中已定义*/
extern void GetBGLType(uint8_t BGLType);
/*得到背光等级 可自己在枚举中定义 在BackGroundLight.c里填表*/
extern void  GetBGLLvl(uint8_t BGLLvl,uint8_t FunPositionLight);
/*小灯暗级处理*/
uint8_t  ProcessLittleLight(uint8_t BGLLvl);
/*得到热敏电阻电压参数为100倍电压值*/
extern void GetBGLNTCVol(uint16_t BGLNTCVol);
/*主函数中调用第一个参数电源状态 1是 ON档 2 off 第二个参数 唤醒条件 1是TTF唤醒 2 是表盘唤醒 3 是表盘和屏都有唤醒,0无唤醒*/
extern void BackLightSchedu(uint8_t BGLPowerSt,uint8_t WakeFlag);
/*定时函数中调用 1ms函数中调用 TimeX 填1u*/
extern void BackLightDamp(uint8_t TimeX);
/*调试用*/
#if COLOR_LED_DEBUG
extern void  DebugBGLPara(void);
extern void  SetTFTDebugPara(uint16_t TestTFTDuty);
extern void  SetGaugesDebugPara(uint16_t TestGaugesDuty);
extern void  SetRDebugPara(uint16_t TestRDuty);
extern void  SetGDebugPara(uint16_t TestGDuty);
extern void  SetBDebugPara(uint16_t TestBDuty);
#endif
#endif