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

#ifndef PHFETSOS_UART4_H_
#define PHFETSOS_UART4_H_

#define UART4_RX_BUFFER_SIZE     256        // was 128 17 Nov 2022
#define UART4_TX_BUFFER_SIZE     128

int uart4_stateMachine(int uart4_state);

void uart4_init(void);
void uart4_setup(uint32_t ui32Baud, uint32_t ui32SrcClock);

int uart4_write(const char *pcBuf, uint32_t ui32Len);
int uart4_rx_str(char *pcBuf, uint32_t ui32Len);

unsigned char uart4_rx_byte(void);
void uart4_tx_byte(unsigned char c);

int uart4_rx_bytes_avail(void);
int uart4_tx_bufr_bytes_free(void);
int uart4_rx_bufr_peek(unsigned char ucChar);
void uart4_rx_bufr_flush(void);
void uart4_tx_bufr_flush(bool bDiscard);

void uart4_echo_set(bool bEnable);

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

#endif /* PHFETSOS_UART4_H_ */
