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


#define BACK_LIGHT_DAY 200
uint8_t interact_PWM_Low_Duty = 0;
void BackLight_Process(void)
{
    if (Get_CAN_Power_State() != PKEY_ON && Get_CAN_Power_State() != KEY_OFF )
    {
        TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_DAY);
    }
    else
    {
        TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 0);
    }
}

void Interact_Light_Process(void)
{
    if (Get_CAN_Power_State() != PKEY_ON && Get_CAN_Power_State() != KEY_OFF )
    {
        TimerM_PWM_set_duty(TIMERM_COUNTER0, TIMERM_CHD, interact_PWM_Low_Duty * 10);
    }
    else
    {
        TimerM_PWM_set_duty(TIMERM_COUNTER0, TIMERM_CHD, 0);
    }
}
uint8_t Get_Interact_Light_State(void)
{
    uint8_t stata = 0x0;
    if(interact_PWM_Low_Duty == 0)
    {
        stata = 0x1;
    }
    else if(interact_PWM_Low_Duty == 30)
    {
        stata = 0x2;
    }
    else if(interact_PWM_Low_Duty == 50)
    {
        stata = 0x3;
    }
    return stata;
}
