#include "led.h"
// #include "main.h"
#include "FreeRTOS.h"
#include "cmsis_os.h"

extern struct led led_0;
extern struct led led_1;
extern int Led_Port();
extern void Led_Task();


osThreadId_t ledHandle;
const osThreadAttr_t led_attributes = {
.name = "led",
.stack_size = 256 * 4,
.priority = (osPriority_t) osPriorityBelowNormal,
};

struct led led_0;
struct led led_1;

int Led_Port()
{

  led_register(&led_0, LED0_GPIO_Port, LED0_Pin, LED_STATE_ON, RESET);
  // led_register(&led_1, LED1_GPIO_Port, LED1_Pin, LED_STATE_ON, RESET);
  // led_set_state(&led_1, LED_STATE_FLICKER_MEDIUM);
  led_set_state(&led_0, LED_STATE_FLICKER_MEDIUM);
  ledHandle = osThreadNew(Led_Task, NULL, &led_attributes);
  return 0;
}


void Led_Task()
{
  for (;;)
  {
    led_callback();
    osDelay(200);
  }
}