#ifndef UART_H
#define UART_H

#ifdef __cplusplus
extern "C" {
#endif

#include "system.h"
#include "Touch_GestureEngine.h"
  
#define FRAME_LABEL_SIGNAL                's'
#define FRAME_LABEL_RAW_DATA              'r'
#define FRAME_LABEL_FINGER_POS            'f'
#define FRAME_LABEL_GESTURE_ID            'g'
#define FRAME_LABEL_MSG                   'm'
#define FRAME_LABEL_CALIBRATION           'c'
    
#define encode_raw_data_frame()           encode_frame(FRAME_LABEL_RAW_DATA,0,data_set.buffer,16)  
  
void uart0_init(void);
void uart0_putchar(uint8 ch);
void uart0_puts(char *str); 
void uart0_printf(char *fmt,...);

void uart1_init(void);
void uart1_putchar(uint8 ch);
void uart1_puts(char *str);
void uart1_printf(char *fmt,...);

uint8 encode_frame(uint8 label, uint8 extra_label, uint8 *buffer, uint8 size);
uint8 encode_finger_position_frame(void);
uint8 encode_calibration_frame(uint16 data);
uint8 encode_gesture_frame(uint8 gesture_id);
uint8 encode_msg_frame(char *str);
void send_frame(uint8 size);
const char *get_gesture_string(uint8 gesture_id);

#ifdef __cplusplus
};
#endif

#endif