1st release (without comment)
RMS_UART.h@8:f08bb4074bc8, 2016-09-19 (annotated)
- Committer:
- nsrwsurasak
- Date:
- Mon Sep 19 04:00:29 2016 +0000
- Revision:
- 8:f08bb4074bc8
- Parent:
- 4:cd5fb2575b50
- Child:
- 9:025a189e5082
Add stop command
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nsrwsurasak | 1:5e6c5fbd48d6 | 1 | /** |
nsrwsurasak | 1:5e6c5fbd48d6 | 2 | ****************************************************************************** |
nsrwsurasak | 1:5e6c5fbd48d6 | 3 | * @file RMS_UART.cpp |
nsrwsurasak | 1:5e6c5fbd48d6 | 4 | * @author Surasak N |
nsrwsurasak | 1:5e6c5fbd48d6 | 5 | * @version V1 |
nsrwsurasak | 1:5e6c5fbd48d6 | 6 | * @date 15/09/2016 |
nsrwsurasak | 1:5e6c5fbd48d6 | 7 | * @brief Command for Mini-RMS <> RMS via UART |
nsrwsurasak | 1:5e6c5fbd48d6 | 8 | ******************************************************************************/ |
nsrwsurasak | 1:5e6c5fbd48d6 | 9 | |
nsrwsurasak | 0:bc10ea82aec3 | 10 | #ifndef RMS_UART_H |
nsrwsurasak | 0:bc10ea82aec3 | 11 | #define RMS_UART_H |
nsrwsurasak | 0:bc10ea82aec3 | 12 | |
nsrwsurasak | 0:bc10ea82aec3 | 13 | #define EXT_SERIAL 1 |
nsrwsurasak | 0:bc10ea82aec3 | 14 | #define MSG_BUF_SIZE 25 |
nsrwsurasak | 0:bc10ea82aec3 | 15 | #define MSG2CMD 2 |
nsrwsurasak | 0:bc10ea82aec3 | 16 | #define MSG2FILENAME (MSG_BUF_SIZE - MSG2CMD) |
nsrwsurasak | 3:ff36fb2cefb0 | 17 | #define CONTENT_BUF_SIZE 1500 |
nsrwsurasak | 1:5e6c5fbd48d6 | 18 | |
nsrwsurasak | 1:5e6c5fbd48d6 | 19 | #define CMD_END_OF_CONTENT "*end*" |
nsrwsurasak | 1:5e6c5fbd48d6 | 20 | #define CMD_LISTFILE "ls" |
nsrwsurasak | 1:5e6c5fbd48d6 | 21 | #define CMD_READFILE "rd" |
nsrwsurasak | 1:5e6c5fbd48d6 | 22 | #define CMD_WRITEFILE "ed" |
nsrwsurasak | 1:5e6c5fbd48d6 | 23 | #define CMD_DELETEFILE "df" |
nsrwsurasak | 1:5e6c5fbd48d6 | 24 | #define CMD_SYS_RESTART "rs" |
nsrwsurasak | 8:f08bb4074bc8 | 25 | #define CMD_STOP "sp" |
nsrwsurasak | 4:cd5fb2575b50 | 26 | #define CMD_HELP "-h" |
nsrwsurasak | 1:5e6c5fbd48d6 | 27 | |
nsrwsurasak | 1:5e6c5fbd48d6 | 28 | #define FOUND_CSV_FILE ".csv" |
nsrwsurasak | 1:5e6c5fbd48d6 | 29 | #define FOUND_XML_FILE ".xml" |
nsrwsurasak | 1:5e6c5fbd48d6 | 30 | #define FOUND_LOG_FILE ".log" |
nsrwsurasak | 0:bc10ea82aec3 | 31 | |
nsrwsurasak | 0:bc10ea82aec3 | 32 | #define BPS_9600 9600 |
nsrwsurasak | 1:5e6c5fbd48d6 | 33 | |
nsrwsurasak | 1:5e6c5fbd48d6 | 34 | /** |
nsrwsurasak | 1:5e6c5fbd48d6 | 35 | * @brief Command request definition |
nsrwsurasak | 1:5e6c5fbd48d6 | 36 | */ |
nsrwsurasak | 1:5e6c5fbd48d6 | 37 | typedef enum { |
nsrwsurasak | 1:5e6c5fbd48d6 | 38 | REQ_NONE, /** None Type : UART do nothing */ |
nsrwsurasak | 1:5e6c5fbd48d6 | 39 | REQ_LISTDIR, /** Connect Type : List files as in directory */ |
nsrwsurasak | 1:5e6c5fbd48d6 | 40 | REQ_READ, /** Read Type : Read file as file name */ |
nsrwsurasak | 1:5e6c5fbd48d6 | 41 | REQ_WRITE, /** Write Type : Create/Write as file name and contens */ |
nsrwsurasak | 1:5e6c5fbd48d6 | 42 | REQ_DELETE /** Delete Type : Delete file as file name */ |
nsrwsurasak | 1:5e6c5fbd48d6 | 43 | } FileRequest_CMD_Type; |
nsrwsurasak | 0:bc10ea82aec3 | 44 | |
nsrwsurasak | 1:5e6c5fbd48d6 | 45 | /* ############### Declare functions extern ################## */ |
nsrwsurasak | 1:5e6c5fbd48d6 | 46 | extern Serial serial_device; |
nsrwsurasak | 1:5e6c5fbd48d6 | 47 | extern FileRequest_CMD_Type reqFileCmdType; |
nsrwsurasak | 1:5e6c5fbd48d6 | 48 | extern char FileName[MSG2FILENAME]; |
nsrwsurasak | 1:5e6c5fbd48d6 | 49 | extern char Content_RxBuf[CONTENT_BUF_SIZE + 1]; |
nsrwsurasak | 2:38567b4310a4 | 50 | extern bool MsgContentManagement; |
nsrwsurasak | 1:5e6c5fbd48d6 | 51 | |
nsrwsurasak | 1:5e6c5fbd48d6 | 52 | /* ############### Function Prototype ################## */ |
nsrwsurasak | 1:5e6c5fbd48d6 | 53 | /** |
nsrwsurasak | 1:5e6c5fbd48d6 | 54 | * @note The detail as RMS_UART.cpp |
nsrwsurasak | 1:5e6c5fbd48d6 | 55 | */ |
nsrwsurasak | 1:5e6c5fbd48d6 | 56 | void Init_SerialDevice(); |
nsrwsurasak | 0:bc10ea82aec3 | 57 | void RxMsgInterruptCallback(); |
nsrwsurasak | 0:bc10ea82aec3 | 58 | void DoTheMsgCmd(); |
nsrwsurasak | 0:bc10ea82aec3 | 59 | void DoTheContent(); |
nsrwsurasak | 0:bc10ea82aec3 | 60 | void GetListFileCmd(); |
nsrwsurasak | 0:bc10ea82aec3 | 61 | void CheckReadEditCmd(); |
nsrwsurasak | 0:bc10ea82aec3 | 62 | void GetFileName(); |
nsrwsurasak | 0:bc10ea82aec3 | 63 | void SendContentToFile(); |
nsrwsurasak | 0:bc10ea82aec3 | 64 | void GetCmdError(); |
nsrwsurasak | 0:bc10ea82aec3 | 65 | void ClearCmdIndexAndBuf(); |
nsrwsurasak | 0:bc10ea82aec3 | 66 | void ClearContentIndexAndBuf(); |
nsrwsurasak | 1:5e6c5fbd48d6 | 67 | void CheckContentMsg(); |
nsrwsurasak | 2:38567b4310a4 | 68 | void ClearFileNameBuf(); |
nsrwsurasak | 1:5e6c5fbd48d6 | 69 | void CheckCmdType(); |
nsrwsurasak | 1:5e6c5fbd48d6 | 70 | void ClearFileNameBuf(); |
nsrwsurasak | 4:cd5fb2575b50 | 71 | void GetHelpCmd(); |
nsrwsurasak | 0:bc10ea82aec3 | 72 | |
nsrwsurasak | 1:5e6c5fbd48d6 | 73 | #endif /* End of RMS_UART_H */ |