From 68e21103e09c7a59292485ab805683760b86e6ba Mon Sep 17 00:00:00 2001 From: Xavi Del Campo Date: Sun, 8 Mar 2020 17:23:03 +0100 Subject: Implemented message protocol, not tested yet --- include/Serial.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'include/Serial.h') diff --git a/include/Serial.h b/include/Serial.h index 88e50db..a1ec824 100644 --- a/include/Serial.h +++ b/include/Serial.h @@ -7,6 +7,7 @@ #include #include +#include #ifdef __cplusplus extern "C" @@ -16,13 +17,22 @@ extern "C" #define SERIAL_DATA_PACKET_SIZE 8 #define ACK_BYTE_STRING "b" -void SerialInit(void); -void SerialRead(uint8_t *ptrArray, size_t nBytes); -void SerialWrite(const void* ptrArray, size_t nBytes); +enum +{ + FIFO_SZ = 132 +}; + +typedef volatile struct +{ + unsigned char buf[FIFO_SZ]; + size_t pending, processed; + bool full; +} fifo; + +extern fifo rx; -#ifdef SERIAL_INTERFACE -void Serial_printf(const char* str, ...); -#endif // SERIAL_INTERFACE +void SerialInit(void); +void SerialWrite(unsigned char byte); #ifdef __cplusplus } -- cgit v1.2.3