rename
This commit is contained in:
parent
949591a50d
commit
b6d0b4c8f5
29 changed files with 0 additions and 0 deletions
32
firmware/usart.h
Normal file
32
firmware/usart.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#ifndef USART_H
|
||||
#define USART_H
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
#include <stdint.h>
|
||||
|
||||
constexpr uint32_t BAUDRATE = 115200; // 38400
|
||||
constexpr uint8_t CRC7_POLY = 0x91;
|
||||
constexpr uint8_t MAX_BLOCK_SIZE = 16;
|
||||
|
||||
class USART
|
||||
{
|
||||
public:
|
||||
void init(void);
|
||||
void flush(void);
|
||||
|
||||
void writeByte(uint8_t);
|
||||
void writeInt(uint16_t);
|
||||
void writeLong(uint32_t);
|
||||
void writeStr(const char*, uint8_t);
|
||||
uint8_t writeBlock(uint8_t*, uint8_t);
|
||||
uint8_t readByte(void);
|
||||
uint16_t readInt(void);
|
||||
uint32_t readLong(void);
|
||||
void readBlock(uint8_t*, uint8_t);
|
||||
|
||||
constexpr static uint8_t MSG_OK = 0xFF;
|
||||
constexpr static uint8_t MSG_FAIL = 0xFE;
|
||||
};
|
||||
|
||||
#endif // USART_H
|
Loading…
Add table
Add a link
Reference in a new issue