/******************************************************************************
* Copyright                                                                   *
* Scintillating Fibre Beam Profile Monitor Software by Michal Dziewiecki,     *
* Blake Leverington and Liqing Qin is licensed under CC BY 4.0                *
* https://creativecommons.org/licenses/by/4.0/                                *
* funded by the Deutsche Forschungsgemeinschaft                               *
* (DFG, German Research Foundation) Projektnummer 419255448                   *
* Project Leader: B.Leverington                                               *
*******************************************************************************
* Create Date - Aug 14, 2017                                                  *
* Author: M.Dziewiecki                                                        *
* Module - control.h                                                          *
******************************************************************************/

#ifndef CONTROL_H_
#define CONTROL_H_

//**************************

#include "dev_commands.h"

//**************************

#define CONTROL_TASK_PRIORITY		10
#define CONTROL_STACK_SIZE			(6144+8192)

#define CONTROL_MAX_DATA_LENGTH		16		//maximum command data length in WORDS (16-bit)
#define CONTROL_TIMEOUT				1000	//timeout to get command data in unknown time units

#define CONTROL_PORT				4000
#define DATA_PORT					4001

#define CONTROL_SWAP_BYTES 			1		//playing around endianness in PC communication

typedef struct
{
	unsigned short marker;	//must be 0x5555
	unsigned short command;
	unsigned short length;
} command_header;

	//Initialize control task
void control_init();


#endif /* CONTROL_H_ */
