//////////////////////////////////////////////////////////////////
//
// App:			Controller
// Author:		Milan Korinek
// Version:		1.0
// Notice:		Main control of Digital I/O USB Card
//////////////////////////////////////////////////////////////////


#ifndef CONTROLLER_H_
#define CONTROLLER_H_
#include <config_tasks.h>
#include "support/support.h"
#include "tasks/ports_controller.h"
#include "tasks/run_led.h"

/* Messages types with auto generate string names */
#define FOREACH_controller_msg_type(ITEM) \
ITEM(CONTROLLER_BASIC_CONFIG)   \

typedef enum {
	FOREACH_controller_msg_type(GENERATE_ENUM)
} controller_msg_type_t;

extern const char *const controller_msg_type_str[];

typedef struct {
	controller_msg_type_t message;
	uint32_t settings;
} controller_msg_t;

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

status_code_t controller_init(_In_ run_led_handle_t  * run_led_handle, 
							  _In_ ports_controller_handle_t  * ports_controller_handle, 
							  _Out_ controller_handle_t * task_handle);

void controller_task(_In_ void *pvParameters);

extern controller_handle_t controller_handle;

#endif /* CONTROLLER_H_ */