summaryrefslogtreecommitdiff
path: root/include/Serial.h
diff options
context:
space:
mode:
authorXavi Del Campo <xavi.dcr@tutanota.com>2020-03-03 18:39:09 +0100
committerXavi Del Campo <xavi.dcr@tutanota.com>2020-03-03 19:40:00 +0100
commit792e22676786a577b2edc0ed0ed78e51c5b38245 (patch)
tree3a5b1092af322003be3189bf6d58f362dcfe1dca /include/Serial.h
parent62adc2edd17cbd39272715d29d1b4c8650ef7dde (diff)
downloadopensend-792e22676786a577b2edc0ed0ed78e51c5b38245.tar.gz
Refactoring
Diffstat (limited to 'include/Serial.h')
-rw-r--r--include/Serial.h58
1 files changed, 20 insertions, 38 deletions
diff --git a/include/Serial.h b/include/Serial.h
index da2c4ce..88e50db 100644
--- a/include/Serial.h
+++ b/include/Serial.h
@@ -1,49 +1,31 @@
-#ifndef __SERIAL_HEADER__
-#define __SERIAL_HEADER__
+#ifndef SERIAL_H
+#define SERIAL_H
/* *************************************
- * Includes
+ * Includes
* *************************************/
-#include "Global_Inc.h"
-#include "System.h"
-#include "Gfx.h"
-#include "Font.h"
+#include <stdint.h>
+#include <stddef.h>
-/* *************************************
- * Defines
- * *************************************/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#define SERIAL_DATA_PACKET_SIZE 8
#define ACK_BYTE_STRING "b"
-/* **************************************
- * Structs and enums *
- * *************************************/
+void SerialInit(void);
+void SerialRead(uint8_t *ptrArray, size_t nBytes);
+void SerialWrite(const void* ptrArray, size_t nBytes);
-typedef enum
-{
- SERIAL_STATE_INIT = 0,
- SERIAL_STATE_STANDBY,
- SERIAL_STATE_WRITING_ACK,
- SERIAL_STATE_READING_HEADER,
- SERIAL_STATE_READING_EXE_SIZE,
- SERIAL_STATE_READING_EXE_DATA,
- SERIAL_STATE_WAITING_USER_INPUT,
- SERIAL_STATE_CLEANING_MEMORY,
-}SERIAL_STATE;
+#ifdef SERIAL_INTERFACE
+void Serial_printf(const char* str, ...);
+#endif // SERIAL_INTERFACE
-/* *************************************
- * Global prototypes
- * *************************************/
+#ifdef __cplusplus
+}
+#endif
-void SerialInit(void);
-bool SerialRead(uint8_t* ptrArray, size_t nBytes);
-bool SerialWrite(void* ptrArray, size_t nBytes);
-void ISR_Serial(void);
-void SerialSetState(SERIAL_STATE state);
-void SerialSetPCAddress(uint32_t addr);
-void SerialSetRAMDestAddress(uint32_t addr);
-void SerialSetExeSize(size_t size);
-void SerialSetExeBytesReceived(uint32_t bytes_read);
-
-#endif // __SERIAL_HEADER__
+#endif /* SERIAL_H */