ESP8266_RTOS_SDK  v1.4.0
esp_ssc.h
1 /*
2  * ESPRSSIF MIT License
3  *
4  * Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
5  *
6  * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
7  * it is free of charge, to any person obtaining a copy of this software and associated
8  * documentation files (the "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the Software is furnished
11  * to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all copies or
14  * substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  *
23  */
24 
25 #ifndef __ESP_SSC_H__
26 #define __ESP_SSC_H__
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #define CMD_T_ASYNC 0x01
33 #define CMD_T_SYNC 0x02
34 
35 typedef struct cmd_s {
36  char *cmd_str;
37  uint8 flag;
38  uint8 id;
39  void (* cmd_func)(void);
40  void (* cmd_callback)(void *arg);
41 } ssc_cmd_t;
42 
43 #define MAX_LINE_N 127
44 
45 typedef enum {
46  SSC_BR_9600 = 9600,
47  SSC_BR_19200 = 19200,
48  SSC_BR_38400 = 38400,
49  SSC_BR_57600 = 57600,
50  SSC_BR_74880 = 74880,
51  SSC_BR_115200 = 115200,
52  SSC_BR_230400 = 230400,
53  SSC_BR_460800 = 460800,
54  SSC_BR_921600 = 921600
55 } SscBaudRate;
56 
76 void ssc_attach(SscBaudRate bandrate);
77 
85 int ssc_param_len(void);
86 
94 char *ssc_param_str(void);
95 
104 int ssc_parse_param(char *pLine, char *argv[]);
105 
115 void ssc_register(ssc_cmd_t *cmdset, uint8 cmdnum, void (* help)(void));
116 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif /* __ESP_SSC_H__ */
int ssc_parse_param(char *pLine, char *argv[])
Parse the simple serial command (ssc).
int ssc_param_len(void)
Get the length of the simple serial command.
char * ssc_param_str(void)
Get the simple serial command string.
void ssc_register(ssc_cmd_t *cmdset, uint8 cmdnum, void(*help)(void))
Register the user-defined simple serial command (ssc) set.
Definition: esp_ssc.h:35
void ssc_attach(SscBaudRate bandrate)
Initial the ssc function.