/**
 * @file        comm.h
 */

/* Define to prevent recursive inclusion **************************************/
#ifndef INC_COMM_H
#define INC_COMM_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes *******************************************************************/
#include <stdbool.h>
#include <stdint.h>
#include "commserial.h"
#include "comm_defines.h"

#define VERSION_1 0x01
#define VERSION_2 0x02
#define VERSION_3 0x03
#define COMM_MOTOR_TIMEOUT 5000
/* Public Functions ***********************************************************/

/**
 * @brief   COMM_Handler()
 *          This functions checks new incoming messages via the comm line.
 *          In a case of a new message, the comm state machine is invoked to
 *          response.
 *
 * @return  None
 */
void COMM_Handler(void);

/**
 * @brief   COMM_StateMachine()
 *          Contains all commnostic functions.
 *
 * @param   msg     [in/out]    Diagnostic message.
 * @return  None
 */
void COMM_StateMachine(commserial_msg_t* msg);
void COMM_Init(void);
void COMM_SetPulseError(uint16_t pulse);


#ifdef __cplusplus
}
#endif

#endif /* INC_COMM_H */
