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 ++++++++++++++++------ include/System.h | 1 + include/reception.h | 9 +++++++++ 3 files changed, 26 insertions(+), 6 deletions(-) (limited to 'include') 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 } diff --git a/include/System.h b/include/System.h index 028a840..cf6bf03 100644 --- a/include/System.h +++ b/include/System.h @@ -2,5 +2,6 @@ #define SYSTEM_H void SystemInit(void); +void SystemDeinit(void); #endif /* SYSTEM_H */ diff --git a/include/reception.h b/include/reception.h index 80a6acb..571443a 100644 --- a/include/reception.h +++ b/include/reception.h @@ -1,7 +1,16 @@ #ifndef RECEPTION_H #define RECEPTION_H +#ifdef __cplusplus +extern "C" +{ +#endif + void reception_ev(void); void reception_loop(void); +#ifdef __cplusplus +} +#endif + #endif /* RECEPTION_H */ -- cgit v1.2.3