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


#define BACK_LIGHT_DAY 600
#define BACK_LIGHT_NIGHT 420
_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)
    {
        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);
        }
        
    }
    else
    {
        g_Light.Light_Day = 0;
        g_Light.Light_Night = 0;
        TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 0);
    }
}
