BackLight.c 772 Bytes
Newer Older
李俭双's avatar
李俭双 committed
1 2 3 4 5 6 7 8

#include "BackLight\BackLight.h"
#include "Components.h"
#include "Application.h"
#include "TrmerM\TrmerM.h"


#define BACK_LIGHT_DAY 600
李俭双's avatar
李俭双 committed
9
#define BACK_LIGHT_NIGHT 420
李俭双's avatar
李俭双 committed
10 11 12 13 14 15 16 17 18 19 20 21
_Light g_Light;

void BackLight_Init(void)
{
    g_Light.Light_Day    = 0XFFFF;
    g_Light.Light_Night  = 0XFFFF;
}

void BackLight_Process(void)
{
    if (SYS_OPR_STAT_IGN_ON)
    {
李俭双's avatar
李俭双 committed
22 23 24 25 26 27 28 29 30
        if ( HighBeam_Timer.LED_Turnon == 5 )
        {
            TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_NIGHT);
        }
        else
        {
            TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_DAY);
        }
        
李俭双's avatar
李俭双 committed
31 32 33 34 35 36 37 38
    }
    else
    {
        g_Light.Light_Day = 0;
        g_Light.Light_Night = 0;
        TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 0);
    }
}