/****************************************************************************/
/* Copyright 2016 MBARI.                                                    */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/


#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include "device.h"


/*---------------------------------------------------------------------------
  MACRO: True if the serial ports input buffer contains received data
---------------------------------------------------------------------------*/
#define mIsU1RXDataAvailable() (U1STAbits.URXDA)

#define RxFifoSz (32)  //Number of characters in the Fifo ring buffer
extern unsigned char RxFifo[]; // The static FIFO allocated in interrupts.c
extern unsigned char *RxPutPt; //    Pointer of where to put next char in SCI1 FIFO
extern unsigned char *RxGetPt; //    Pointer of where to get next char from SCI1 FIFO
                      // FIFO is empty if PutPt=GetPt 
                      // FIFO is full  if PutPt+1=GetPt

//function declaration
//void vInitU1 ( void );
//void vInitU2 ( void );
void ClearRxFifo (void);
void vPutCharU ( unsigned short cChar , int chan);
void vPutStrU ( unsigned char* pcStr, int chan );
void vPutStrMaxon ( unsigned short pcStr[], int size, int chan );
unsigned char cGetCharU( int chan );
int RxStr2(int maxchar, char *buf,int ms_to1,int ms_bet); //read RxD1 to LF
int RxStr(int maxchar,unsigned char *buf,int ms_to1,int ms_bet); //read RxD2 to LF
int UI_parse (int ms);

