#include "led.h"
#include "gpio.h"

led_t led; // 自定义led结构体;

// 驱动led开关
void led_on_off(uint8_t leds, uint8_t on_off)
{
    switch (leds)
    {
    case 0:
    {
        if (0x00 == on_off)
        {
            // GPIO_LED0(0x00);
            led.led_state.bits.led0_state_flag = 0;
        }
        else
        {
            // GPIO_LED0(0x01);
            led.led_state.bits.led0_state_flag = 1;
        }
        break;
    }
    case 1:
    {
        if (0x00 == on_off)
        {
            GPIO_LED1(0x00);
            led.led_state.bits.led1_state_flag = 0;
        }
        else
        {
            GPIO_LED1(0x01);
            led.led_state.bits.led1_state_flag = 1;
        }
        break;
    }
    default:
        break;
    }
}