//////////////////////////////////////////////////////////////////
//
// App:			Run LED Task
// Author:		Milan Korinek
// Version:		1.0
// Notice:		Blinking with LED
//////////////////////////////////////////////////////////////////


#ifndef RUN_LED_H_
#define RUN_LED_H_

#include <config_tasks.h>
#include "support/support.h"
#include "tasks/ports_controller.h"

#define RUN_LED_RUN_ON		(1000UL / portTICK_RATE_MS)
#define RUN_LED_RUN_OFF		(1000UL / portTICK_RATE_MS)
#define RUN_LED_WARNING_ON	(100UL / portTICK_RATE_MS)
#define RUN_LED_WARNING_OFF	(900UL / portTICK_RATE_MS)
#define RUN_LED_ERROR_ON	(100UL / portTICK_RATE_MS)
#define RUN_LED_ERROR_OFF	(100UL / portTICK_RATE_MS)

/* Messages types with auto generate string names */
#define FOREACH_run_led_msg_type(ITEM) \
ITEM(RUN_LED_MSG_ON)      \
ITEM(RUN_LED_MSG_OFF)	  \
ITEM(RUN_LED_MSG_RUN)	  \
ITEM(RUN_LED_MSG_WARNING) \
ITEM(RUN_LED_MSG_ERROR)   \

typedef enum {
	FOREACH_run_led_msg_type(GENERATE_ENUM)
} run_led_msg_type_t;

extern const char *const run_led_msg_type_str[];

typedef struct {
	run_led_msg_type_t message;
} run_led_msg_t;

typedef struct {
	xTaskHandle task_handle;
	xQueueHandle control_pipe;
} run_led_handle_t;

status_code_t run_led_init(ports_controller_handle_t * ports_controller_handle, run_led_handle_t * task_handle);

void run_led_task(void *pvParameters);

extern run_led_handle_t run_led_handle;

#endif /* RUN_LED_H_ */