/*
 * uart3.h
 *
 *  Created on: Sep 17, 2021
 *      Author: thomm
 */

#ifndef PHFETSOS_UART3_H_
#define PHFETSOS_UART3_H_

#if BOARD_MSC == 3
// ran out of SRAM pulling in math routines for Isus, reducing buffer sizes
#define UART3_RX_BUFFER_SIZE     64     // Interface to MMS Digital, 256 short ints are clocked, FIFO is drained with little buffering required
#define UART3_TX_BUFFER_SIZE     64
#else
#define UART3_RX_BUFFER_SIZE     256     //128  Size for worst case string from Aanderaa Optode
#define UART3_TX_BUFFER_SIZE     128
#endif

int uart3_stateMachine(int uart3_state);

void uart3_init(void);
void uart3_setup(uint32_t ui32Baud, uint32_t ui32SrcClock);

int uart3_write(const char *pcBuf, uint32_t ui32Len);
int uart3_rx_str(char *pcBuf, uint32_t ui32Len);
int uart3_rx_buf(unsigned char *pcBuf, uint32_t ui32Len);

unsigned char uart3_rx_byte(void);
int uart3_tx_byte(unsigned char c);

int uart3_rx_bytes_avail(void);
int uart3_tx_bufr_bytes_free(void);
int uart3_rx_bufr_peek(unsigned char ucChar);
void uart3_rx_bufr_flush(void);
void uart3_tx_bufr_flush(bool bDiscard);

void uart3_echo_set(bool bEnable);

void uart3_isr(void);           // plug this into interrupt table in tm4c123gh6pge_startup_ccs.c




#endif /* PHFETSOS_UART3_H_ */
