summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorXavi Del Campo <xavi.dcr@tutanota.com>2020-03-08 17:23:03 +0100
committerXavi Del Campo <xavi.dcr@tutanota.com>2020-03-08 22:33:58 +0100
commit68e21103e09c7a59292485ab805683760b86e6ba (patch)
tree92c33d6211eeae35600525e2520a138503e8281d /include
parent96b0c9d692fd4b41d41e13cdcd8fc773b3976dde (diff)
downloadopensend-68e21103e09c7a59292485ab805683760b86e6ba.tar.gz
Implemented message protocol, not tested yet
Diffstat (limited to 'include')
-rw-r--r--include/Serial.h22
-rw-r--r--include/System.h1
-rw-r--r--include/reception.h9
3 files changed, 26 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
}
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 */