#include "usr_config.h"
#include "bsp_time.h"
#include "system.h"
#include "hal_led.h"
#include "nrf_gpio.h"
#include "hal_ble_client.h"
#include "hal_ble_host.h"
#include "app_charge.h"
#include "app_flash.h"
#include "hal_battery.h"
#include "ble_comm.h"
#include "hal_charge.h"

/************************ º¯ÊýÉùÃ÷ ***********************************/

/********************************************************/

static void app_charge_Process(void)
{
	static uint8_t app_charge_state = BLE_CHARGE_PULLOUT;
	
	uint8_t charge_state_c = hal_charge_Getstate();
	
	if(charge_state_c != app_charge_state){
		 switch(charge_state_c){
			 case BLE_CHARGE_PULLOUT:
			      LED_Stop(LED_CHARGE);
				    break;
			 case BLE_CHARGE_INSERT:
				    LED_Start(LED_CHARGE,COLOR_ORANGE);
				    break;
	     case BLE_CHARGE_DONE:
			      LED_Start(LED_CHARGE,COLOR_GREEN);
				    break;
			 default:
				    break;
		 }
		 app_charge_state = charge_state_c;
	}
}



void app_charge_Init(void)
{
	Process_Start(1000,"app_charge",app_charge_Process);
}


