BackLight.h 2.16 KB
Newer Older
崔立宝's avatar
崔立宝 committed
1 2 3
//背光调节
#ifndef _BackLight_H_
#define _BackLight_H_
4

崔立宝's avatar
崔立宝 committed
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
#include "GPIO.h"
#include "PWM.h"
//#include "TIMER0.h"
#include "Warning_Processor.h"
#include "Popup_Scheduler.h"
#include "Startup_Animation.h"
#include "IPC.h"
#include "GPIO.h"
#include "main.h"
#include "Menus.h"
/******************************************************************************
全局变量
******************************************************************************/
//extern volatile uint8_t BLPWMDutyCycle;
//#define   BL_PWM_DUTY_CYCLE                 dutyCycle

/******************************************************************************
背光设置
******************************************************************************/
#define   BL_PWM_DUTY_CYCLE_FILTER          5    //接收到的占空比差大于此值认为是无效占空比
#define   BL_PWM_FILTER_MAX_CNT             10   //最大阻止接收次数
#define   BL_SAMPLE_POINT                   10   //10
#define   BL_PWM_DUTY_CYCLE_MAX             95
#define   BL_PWM_DUTY_CYCLE_MIN             7
#define   BL_PWM_DUTY_CYCLE_HYSTERESIS      5    //回差
#define   BL_PWM_DUTY_CYCLE_APPR_FACTOR     8    //占空比逼近系数 
#define   BL_PWM_DUTY_CYCLE_APPR_SPEED      20   //占空比逼近周期,单位ms  

#define   BL_OFF_TIME_DOOR_OPEN_ONLY        150

/******************************************************************************
结构声明
******************************************************************************/
typedef struct
{
  uint8_t   Backup;
  uint16_t  Timer;
  uint16_t  HiLvTimer;
} BlPWMCaptureStruct;

typedef struct
{
  uint8_t   InitTimer;
  uint8_t   Backup;
  uint8_t   BackupCnt;
  uint8_t   Sample[BL_SAMPLE_POINT];
  uint8_t   Ptr;
  uint8_t   Cnt;
  uint8_t   Locked;
  uint8_t   Timer;
  uint8_t   Current;
} BlPWMFilterStruct;

typedef struct
{
  uint8_t   DoorStatusBackup;
  uint16_t  Timer;
} BlOFFCtrlStruct;
/*************************函数*********************************/
void BackLight_Plate_Needle_Set(uint8_t duty);
void BackLight_Plate_Needle_Close(void);
void BackLight_TFT_Set(uint8_t duty);
void BackLight_TFT_Close(void);
void BL_Management_Service(void);
void PWM_INIT(void);
void BL_Init(void);
//void BL_PWM_Duty_Cycle_Capture_ISR(void);
#endif