#include "drivers.h"
#if APP_LED_ENABLE
extern uint8_t led_data[LED_COUNT];
const uint8_t num_tbl[] = {
    0X3F, 0X06, 0X5B, 0X4F, 0X66, 0X6D, 0X7D, 0X07, 0X7F, 0X6F,
};
#define LED0_A ((Bits8_TypeDef *)(&(led_data[1])))->bit0
#define LED0_B ((Bits8_TypeDef *)(&(led_data[2])))->bit0
#define LED0_C ((Bits8_TypeDef *)(&(led_data[0])))->bit3
#define LED0_D ((Bits8_TypeDef *)(&(led_data[0])))->bit4
#define LED0_E ((Bits8_TypeDef *)(&(led_data[3])))->bit0
#define LED0_F ((Bits8_TypeDef *)(&(led_data[0])))->bit1
#define LED0_G ((Bits8_TypeDef *)(&(led_data[0])))->bit2
#define LED0_DP ((Bits8_TypeDef *)(&(led_data[5])))->bit0

#define LED1_A ((Bits8_TypeDef *)(&(led_data[2])))->bit1
#define LED1_B ((Bits8_TypeDef *)(&(led_data[3])))->bit1
#define LED1_C ((Bits8_TypeDef *)(&(led_data[1])))->bit4
#define LED1_D ((Bits8_TypeDef *)(&(led_data[5])))->bit1
#define LED1_E ((Bits8_TypeDef *)(&(led_data[4])))->bit1
#define LED1_F ((Bits8_TypeDef *)(&(led_data[1])))->bit2
#define LED1_G ((Bits8_TypeDef *)(&(led_data[1])))->bit3
#define LED1_DP ((Bits8_TypeDef *)(&(led_data[5])))->bit2

#define LED2_A ((Bits8_TypeDef *)(&(led_data[3])))->bit4
#define LED2_B ((Bits8_TypeDef *)(&(led_data[4])))->bit2
#define LED2_C ((Bits8_TypeDef *)(&(led_data[4])))->bit3
#define LED2_D ((Bits8_TypeDef *)(&(led_data[0])))->bit5
#define LED2_E ((Bits8_TypeDef *)(&(led_data[2])))->bit5
#define LED2_F ((Bits8_TypeDef *)(&(led_data[2])))->bit3
#define LED2_G ((Bits8_TypeDef *)(&(led_data[2])))->bit4
#define LED2_DP ((Bits8_TypeDef *)(&(led_data[5])))->bit3
/********************************************************
**	函数名	void LED_Default(void)
**	描述	：设置上电默认显示内容
**	传入	：无
**	返回	：无
*********************************************************/
void LED_Default(void)
{
    /*	默认显示		*/
	led_data[0] = 0X00;
	led_data[1] = 0X00;
	led_data[2] = 0X00;
}
/********************************************************
**	函数名	void LED_Load(void)
**	描述	：设置显示数据
**	传入	：无
**	返回	：无
*********************************************************/
void LED_Load(uint16_t num)
{
	uint8_t smg_data[3];
	smg_data[0] = 0X40;
	smg_data[1] = num_tbl[num / 10];
    smg_data[2] = num_tbl[num % 10];
	/*	SMG0	*/
	if(smg_data[0] & 0X01)
		LED0_A = 1;
	else
		LED0_A = 0;
	if(smg_data[0] & 0X02)
		LED0_B = 1;
	else
		LED0_B = 0;
	if(smg_data[0] & 0X04)
		LED0_C = 1;
	else
		LED0_C = 0;
	if(smg_data[0] & 0X08)
		LED0_D = 1;
	else
		LED0_D = 0;
	if(smg_data[0] & 0X10)
		LED0_E = 1;
	else
		LED0_E = 0;
	if(smg_data[0] & 0X20)
		LED0_F = 1;
	else
		LED0_F = 0;
	if(smg_data[0] & 0X40)
		LED0_G = 1;
	else
		LED0_G = 0;
	if(smg_data[0] & 0X80)
		LED0_DP = 1;
	else
		LED0_DP = 0;
	/*	SMG1	*/
	if(smg_data[1] & 0X01)
		LED1_A = 1;
	else
		LED1_A = 0;
	if(smg_data[1] & 0X02)
		LED1_B = 1;
	else
		LED1_B = 0;
	if(smg_data[1] & 0X04)
		LED1_C = 1;
	else
		LED1_C = 0;
	if(smg_data[1] & 0X08)
		LED1_D = 1;
	else
		LED1_D = 0;
	if(smg_data[1] & 0X10)
		LED1_E = 1;
	else
		LED1_E = 0;
	if(smg_data[1] & 0X20)
		LED1_F = 1;
	else
		LED1_F = 0;
	if(smg_data[1] & 0X40)
		LED1_G = 1;
	else
		LED1_G = 0;
	if(smg_data[1] & 0X80)
		LED1_DP = 1;
	else
		LED1_DP = 0;
	/*	SMG2	*/
	if(smg_data[2] & 0X01)
		LED2_A = 1;
	else
		LED2_A = 0;
	if(smg_data[2] & 0X02)
		LED2_B = 1;
	else
		LED2_B = 0;
	if(smg_data[2] & 0X04)
		LED2_C = 1;
	else
		LED2_C = 0;
	if(smg_data[2] & 0X08)
		LED2_D = 1;
	else
		LED2_D = 0;
	if(smg_data[2] & 0X10)
		LED2_E = 1;
	else
		LED2_E = 0;
	if(smg_data[2] & 0X20)
		LED2_F = 1;
	else
		LED2_F = 0;
	if(smg_data[2] & 0X40)
		LED2_G = 1;
	else
		LED2_G = 0;
	if(smg_data[2] & 0X80)
		LED2_DP = 1;
	else
		LED2_DP = 0;
}

#endif
