2021-04-03 17:21:59 +02:00
|
|
|
#ifndef UART_H_
|
|
|
|
|
#define UART_H_
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include <avr/io.h>
|
|
|
|
|
|
|
|
|
|
// Initialize UART
|
|
|
|
|
void uartInit();
|
|
|
|
|
|
|
|
|
|
// Transmit a single character
|
|
|
|
|
void uartPutChar(unsigned char data);
|
|
|
|
|
|
|
|
|
|
// Transmit a string
|
|
|
|
|
void uartPutString(char* data);
|
|
|
|
|
|
2021-04-16 20:31:25 +02:00
|
|
|
// Transmit a string followed by a line break
|
|
|
|
|
void uartPutLine(char* data);
|
|
|
|
|
|
2021-04-17 02:32:28 +02:00
|
|
|
// Convert an integer to decimal ASCII and transmit
|
|
|
|
|
void uartPutInteger(int value);
|
|
|
|
|
|
|
|
|
|
// Convert a byte to hexadecimal ASCII and transmit
|
|
|
|
|
void uartPutHexByte(uint8_t byte);
|
2021-04-16 22:37:14 +02:00
|
|
|
|
2021-04-03 17:21:59 +02:00
|
|
|
// Read a single character (blocking)
|
|
|
|
|
unsigned char uartGetChar();
|
|
|
|
|
|
|
|
|
|
// Read a string until \n (blocking)
|
|
|
|
|
uint8_t uartGetLine(char* buffer, uint8_t maxLength);
|
|
|
|
|
|
|
|
|
|
#endif /* UART_H_ */
|