Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
RMS_UART.h
00001 /** 00002 ****************************************************************************** 00003 * @file RMS_UART.cpp 00004 * @author Surasak N 00005 * @version V2 00006 * @date 20/09/2016 00007 * @brief Command for Mini-RMS <> RMS via UART 00008 ******************************************************************************/ 00009 00010 #ifndef RMS_UART_H 00011 #define RMS_UART_H 00012 00013 #define EXT_SERIAL 1 00014 #define MSG_BUF_SIZE 25 00015 #define MSG2CMD 2 00016 #define MSG2FILENAME (MSG_BUF_SIZE - MSG2CMD) 00017 #define CONTENT_BUF_SIZE 1536 00018 00019 #define CMD_END_OF_CONTENT "*end*" 00020 #define CMD_LISTFILE "ls" 00021 #define CMD_READFILE "rd" 00022 #define CMD_WRITEFILE "ed" 00023 #define CMD_DELETEFILE "df" 00024 #define CMD_SYS_RESTART "rs" 00025 #define CMD_SYS_PAUSE "sp" 00026 #define CMD_HELP "-h" 00027 00028 #define FOUND_CSV_FILE ".csv" 00029 #define FOUND_XML_FILE ".xml" 00030 #define FOUND_LOG_FILE ".log" 00031 00032 #define _SPACE '\0' 00033 #define FLAG_STATUS_OK "OK" 00034 #define FLAG_STATUS_ERROR "ER" 00035 #define FLAG_STATUS_END "*END*" 00036 00037 00038 #define RMS_STATUS_LIST_OK "LK" 00039 #define RMS_STATUS_READ_OK "RK" 00040 00041 #define EC_CMD_ERROR "E1" 00042 #define EC_FILE_NOT_FOUND "E2" 00043 #define EC_WRITE_ERROR "E3" 00044 #define EC_FILE_TOO_LARGE "E4" 00045 00046 #define BPS_9600 9600 00047 00048 /** 00049 * @brief Command request definition 00050 */ 00051 typedef enum { 00052 REQ_NONE, /** None Type : UART do nothing */ 00053 REQ_LISTDIR, /** Connect Type : List files as in directory */ 00054 REQ_READ, /** Read Type : Read file as file name */ 00055 REQ_WRITE, /** Write Type : Create/Write as file name and contens */ 00056 REQ_DELETE, /** Delete Type : Delete file as file name */ 00057 REQ_FLAG_OK, /** Flag OK Type " Send "OK" flag via UART */ 00058 REQ_READ_CHECK /** Read Check Type : Check available file as in SD card */ 00059 } FileRequest_CMD_Type; 00060 00061 /* ############### Declare functions extern ################## */ 00062 extern Serial serial_device; 00063 extern FileRequest_CMD_Type reqFileCmdType; 00064 extern char FileName[MSG2FILENAME]; 00065 extern char Content_RxBuf[CONTENT_BUF_SIZE + 1]; 00066 extern bool MsgContentManagement; 00067 00068 /* ############### Function Prototype ################## */ 00069 /** 00070 * @note The detail as RMS_UART.cpp 00071 */ 00072 void Init_SerialDevice(); 00073 void RxMsgInterruptCallback(); 00074 void DoTheMsgCmd(); 00075 void DoTheContent(); 00076 void GetListFileCmd(); 00077 void CheckReadEditCmd(); 00078 void GetFileName(); 00079 void SendContentToFile(); 00080 void GetCmdError(); 00081 void ClearCmdIndexAndBuf(); 00082 void ClearContentIndexAndBuf(); 00083 void CheckContentMsg(); 00084 void ClearFileNameBuf(); 00085 void CheckCmdType(); 00086 void ClearFileNameBuf(); 00087 void GetHelpCmd(); 00088 00089 #endif /* End of RMS_UART_H */
Generated on Wed Jul 13 2022 06:05:38 by
1.7.2