diff options
| author | Xavi Del Campo <xavi.dcr@tutanota.com> | 2020-03-08 17:23:03 +0100 |
|---|---|---|
| committer | Xavi Del Campo <xavi.dcr@tutanota.com> | 2020-03-08 22:33:58 +0100 |
| commit | 68e21103e09c7a59292485ab805683760b86e6ba (patch) | |
| tree | 92c33d6211eeae35600525e2520a138503e8281d /include/Serial.h | |
| parent | 96b0c9d692fd4b41d41e13cdcd8fc773b3976dde (diff) | |
| download | opensend-68e21103e09c7a59292485ab805683760b86e6ba.tar.gz | |
Implemented message protocol, not tested yet
Diffstat (limited to 'include/Serial.h')
| -rw-r--r-- | include/Serial.h | 22 |
1 files changed, 16 insertions, 6 deletions
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 <stdint.h> #include <stddef.h> +#include <stdbool.h> #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 } |
