#ifndef QMSK_SERIAL_H
#define QMSK_SERIAL_H
/** Serial modes */
enum serial_mode {
SERIAL_MODE_ASYNC = 0b00,
SERIAL_MODE_DEFAULT = SERIAL_MODE_ASYNC
};
enum serial_baud {
SERIAL_BAUD_9600 = 103,
};
enum serial_parity {
SERIAL_PARITY_N = 0b00,
};
enum serial_stopbits {
SERIAL_STOPBITS_1 = 0b0,
};
enum serial_chars {
SERIAL_CHARS_8 = 0b011,
};
/* Size of RX buffer */
#define SERIAL_BUF 64
/*
* Setup the UART for serial mode.
*/
void serial_init (
enum serial_baud baud,
enum serial_parity parity,
enum serial_stopbits stopbits
);
/*
* Read a single input char from the rx buffer.
*
* Returns 0 if the rx buf is empty.
*/
char serial_read ();
/*
* Write a single output char, either directly or via the tx "buffer".
*
* XXX: currently only has a tx buffer of 1 byte.
*/
void serial_write (char c);
#endif