Initial commit
This commit is contained in:
31
serial.h
Normal file
31
serial.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef SERIAL_H
|
||||
#define SERIAL_H
|
||||
|
||||
#define BAUD 38400
|
||||
#define BUFFER_SIZE 64
|
||||
|
||||
#include <util/setbaud.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <string.h>
|
||||
|
||||
class Serial
|
||||
{
|
||||
private:
|
||||
char _terminator = '\n';
|
||||
uint16_t _rxIndex=0;
|
||||
|
||||
public:
|
||||
Serial();
|
||||
void putChar(const char c);
|
||||
void putString(const char* in, const unsigned int length);
|
||||
void putString(const char in[]);
|
||||
bool dataIsWaiting();
|
||||
char getChar();
|
||||
int getString(char* buffer, const int bufferLength);
|
||||
void flush();
|
||||
void setTerminator(const char terminator);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user