/* * usart.h * * Created on: 19.05.2015 * Author: dode@luniks.net */ #ifndef USART_H_ #define USART_H_ #include <stdbool.h> #include <stdio.h> #define USART_LENGTH 128 #ifndef BAUD #define BAUD 9600 #endif /** * Sets the baudrate and enables the transmitter and receiver. */ void initUSART(void); /** * Returns true if a CR or LF terminated line of data was received via USART. */ bool isUSARTReceived(void); /** * Disable/enable accepting commands by disabling/enabling interrupts * when data was received. * * @param enabled disable/enable commands. */ void setStreaming(bool enabled); /** * Returns true if accepting commands is disabled, false otherwise. * * @return true if disabled, false otherwise */ bool isStreaming(void); /** * Appends the data received via USART to the given string with the given * length. */ void getUSARTData(char *data, size_t length); /** * Prints the given string via USART. */ void printString(const char *data); /** * Prints the given unsigned integer including CR + LF via USART. */ void printUint(uint8_t data); /** * Prints the given unsigned integer in binary notation including CR + LF * via USART. */ void printByte(uint8_t data); #endif /* USART_H_ */