1st release (without comment)
Diff: RMS_UART.h
- Revision:
- 1:5e6c5fbd48d6
- Parent:
- 0:bc10ea82aec3
- Child:
- 2:38567b4310a4
--- a/RMS_UART.h Thu Sep 15 01:47:46 2016 +0000 +++ b/RMS_UART.h Thu Sep 15 08:07:31 2016 +0000 @@ -1,3 +1,12 @@ +/** + ****************************************************************************** + * @file RMS_UART.cpp + * @author Surasak N + * @version V1 + * @date 15/09/2016 + * @brief Command for Mini-RMS <> RMS via UART + ******************************************************************************/ + #ifndef RMS_UART_H #define RMS_UART_H @@ -5,12 +14,44 @@ #define MSG_BUF_SIZE 25 #define MSG2CMD 2 #define MSG2FILENAME (MSG_BUF_SIZE - MSG2CMD) -#define CONTENT_BUF_SIZE 6000 +#define CONTENT_BUF_SIZE 1000 + +#define CMD_END_OF_CONTENT "*end*" +#define CMD_LISTFILE "ls" +#define CMD_READFILE "rd" +#define CMD_WRITEFILE "ed" +#define CMD_DELETEFILE "df" +#define CMD_SYS_RESTART "rs" + +#define FOUND_CSV_FILE ".csv" +#define FOUND_XML_FILE ".xml" +#define FOUND_LOG_FILE ".log" #define BPS_9600 9600 -#define BPS_14400 14400 + +/** + * @brief Command request definition + */ +typedef enum { + REQ_NONE, /** None Type : UART do nothing */ + REQ_LISTDIR, /** Connect Type : List files as in directory */ + REQ_READ, /** Read Type : Read file as file name */ + REQ_WRITE, /** Write Type : Create/Write as file name and contens */ + REQ_DELETE /** Delete Type : Delete file as file name */ +} FileRequest_CMD_Type; -void Init_SerialDevice(); +/* ############### Declare functions extern ################## */ +extern Serial serial_device; +extern FileRequest_CMD_Type reqFileCmdType; +extern char FileName[MSG2FILENAME]; +extern char Content_RxBuf[CONTENT_BUF_SIZE + 1]; + + +/* ############### Function Prototype ################## */ +/** + * @note The detail as RMS_UART.cpp + */ +void Init_SerialDevice(); void RxMsgInterruptCallback(); void DoTheMsgCmd(); void DoTheContent(); @@ -21,5 +62,8 @@ void GetCmdError(); void ClearCmdIndexAndBuf(); void ClearContentIndexAndBuf(); +void CheckContentMsg(); +void CheckCmdType(); +void ClearFileNameBuf(); -#endif \ No newline at end of file +#endif /* End of RMS_UART_H */ \ No newline at end of file