diff options
| author | XaviDCR92 <xavi.dcr@gmail.com> | 2017-07-21 00:09:35 +0200 |
|---|---|---|
| committer | XaviDCR92 <xavi.dcr@gmail.com> | 2017-07-21 00:09:35 +0200 |
| commit | 627de0d81f81ad60d26d782f2425be1e6f5a3dbc (patch) | |
| tree | 91ffa502aa62c03c2fecf28529ebc8c6b20828c5 /Source/Serial.h | |
+ First commit. It works painfully slow, but gets the job done. Still lots of room for improvement.
Diffstat (limited to 'Source/Serial.h')
| -rw-r--r-- | Source/Serial.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Source/Serial.h b/Source/Serial.h new file mode 100644 index 0000000..da2c4ce --- /dev/null +++ b/Source/Serial.h @@ -0,0 +1,49 @@ +#ifndef __SERIAL_HEADER__ +#define __SERIAL_HEADER__ + +/* ************************************* + * Includes + * *************************************/ + +#include "Global_Inc.h" +#include "System.h" +#include "Gfx.h" +#include "Font.h" + +/* ************************************* + * Defines + * *************************************/ + +#define ACK_BYTE_STRING "b" + +/* ************************************** + * Structs and enums * + * *************************************/ + +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; + +/* ************************************* + * Global prototypes + * *************************************/ + +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__ |
