b15f/usart.h

26 lines
457 B
C
Raw Normal View History

2019-03-26 10:35:41 +00:00
#ifndef USART_H
#define USART_H
#include <avr/io.h>
#include <stdint.h>
constexpr uint16_t BAUDRATE = 38400UL; //9600UL//9600
class USART
{
public:
void init(void);
2019-03-26 14:02:58 +00:00
2019-03-26 10:35:41 +00:00
void writeByte(uint8_t);
2019-03-26 14:02:58 +00:00
void writeInt(uint16_t);
void writeLong(uint32_t);
2019-03-26 10:35:41 +00:00
uint8_t readByte(void);
2019-03-26 14:02:58 +00:00
uint16_t readInt(void);
uint32_t readLong(void);
2019-03-26 10:35:41 +00:00
constexpr static uint8_t MSG_OK = 0xFF;
constexpr static uint8_t MSG_FAIL = 0xFE;
};
#endif // USART_H