add AT system
Showing
7 changed files
with
113 additions
and
6 deletions
... | @@ -28,9 +28,7 @@ | ... | @@ -28,9 +28,7 @@ |
28 | <tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.1032586580" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler"> | 28 | <tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.1032586580" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler"> |
29 | <option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.558548144" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.value.g3" valueType="enumerated"/> | 29 | <option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.558548144" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.value.g3" valueType="enumerated"/> |
30 | <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.includepaths.2084640704" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.includepaths" valueType="includePath"> | 30 | <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.includepaths.2084640704" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.includepaths" valueType="includePath"> |
31 | <listOptionValue builtIn="false" value=""F:\IoT\STM32\workspace\STM32Test\Core\Src\LED""/> | ||
32 | <listOptionValue builtIn="false" value="../Core/Inc/Hardware"/> | 31 | <listOptionValue builtIn="false" value="../Core/Inc/Hardware"/> |
33 | <listOptionValue builtIn="false" value="../Core/Inc/LED"/> | ||
34 | </option> | 32 | </option> |
35 | <inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input.119923394" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input"/> | 33 | <inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input.119923394" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input"/> |
36 | </tool> | 34 | </tool> |
... | @@ -117,7 +115,6 @@ | ... | @@ -117,7 +115,6 @@ |
117 | <tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.59085921" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler"> | 115 | <tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.59085921" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler"> |
118 | <option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.1981320207" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.value.g0" valueType="enumerated"/> | 116 | <option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.1981320207" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.value.g0" valueType="enumerated"/> |
119 | <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.includepaths.1229672740" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.includepaths" valueType="includePath"> | 117 | <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.includepaths.1229672740" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.includepaths" valueType="includePath"> |
120 | <listOptionValue builtIn="false" value=""F:\IoT\STM32\workspace\STM32Test\Core\Src\LED""/> | ||
121 | <listOptionValue builtIn="false" value="../Core/Inc/Hardware"/> | 118 | <listOptionValue builtIn="false" value="../Core/Inc/Hardware"/> |
122 | <listOptionValue builtIn="false" value="../Core/Inc/LED"/> | 119 | <listOptionValue builtIn="false" value="../Core/Inc/LED"/> |
123 | </option> | 120 | </option> |
... | @@ -193,5 +190,12 @@ | ... | @@ -193,5 +190,12 @@ |
193 | </scannerConfigBuildInfo> | 190 | </scannerConfigBuildInfo> |
194 | </storageModule> | 191 | </storageModule> |
195 | <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/> | 192 | <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/> |
196 | <storageModule moduleId="refreshScope"/> | 193 | <storageModule moduleId="refreshScope" versionNumber="2"> |
194 | <configuration configurationName="Debug"> | ||
195 | <resource resourceType="PROJECT" workspacePath="/STM32Test"/> | ||
196 | </configuration> | ||
197 | <configuration configurationName="Release"> | ||
198 | <resource resourceType="PROJECT" workspacePath="/STM32Test"/> | ||
199 | </configuration> | ||
200 | </storageModule> | ||
197 | </cproject> | 201 | </cproject> | ... | ... |
.settings/org.eclipse.cdt.codan.core.prefs
0 → 100644
This diff is collapsed.
Click to expand it.
Core/Inc/ATSystem.h
0 → 100644
1 | /* | ||
2 | * ATSystem.h | ||
3 | * | ||
4 | * Created on: Nov 1, 2019 | ||
5 | * Author: Hope | ||
6 | */ | ||
7 | |||
8 | #ifndef INC_ATSYSTEM_H_ | ||
9 | #define INC_ATSYSTEM_H_ | ||
10 | |||
11 | /* Includes ------------------------------------------------------------------*/ | ||
12 | #include "usart.h" | ||
13 | |||
14 | /***************************** | ||
15 | * Private Define | ||
16 | */ | ||
17 | #define TRUE 1 | ||
18 | #define FALSE 0 | ||
19 | |||
20 | /***************************************** | ||
21 | config | ||
22 | ****************************************/ | ||
23 | /********************* | ||
24 | * compile options | ||
25 | */ | ||
26 | #define AT_FCS_VERIFY FALSE | ||
27 | #define AT_DEBUG_INF_SHOW FALSE | ||
28 | #define AT_CMD_PATTERN_CHECK TRUE | ||
29 | #define AT_UART_BACKSPACE FALSE | ||
30 | #define AT_SHOW_STATE_CHANGE FALSE | ||
31 | |||
32 | /******************************************************** | ||
33 | * define UART message sent | ||
34 | *******************************************************/ | ||
35 | #define AT_RESP(str, len) HAL_UART_Transmit(&huart2, (uint8_t*)str, len, 1000) | ||
36 | #define AT_OK() AT_RESP("\r\nOK\r\n", sizeof("\r\nOK\r\n")-1) | ||
37 | #define AT_NEXT_LINE() AT_RESP("\r\n", 2) | ||
38 | #define AT_NEW_LINE() AT_RESP("\r\n", 2) | ||
39 | #define AT_ERROR(x) AT_UARTWriteErrMsg(x) | ||
40 | |||
41 | #if AT_DEBUG_INF_SHOW | ||
42 | #define AT_DEBUG(str, len) AT_RESP(str, len) | ||
43 | #else | ||
44 | #define AT_DEBUG(str, len) | ||
45 | #endif | ||
46 | |||
47 | #if AT_CMD_PATTERN_CHECK | ||
48 | #define AT_PARSE_CMD_PATTERN_ERROR(x,y) \ | ||
49 | {uint8_t err; \ | ||
50 | err = AT_Pattern_Check(x,y); \ | ||
51 | if (err != 0) { AT_ERROR(err); return;} } | ||
52 | #else | ||
53 | #define AT_PARSE_CMD_PATTERN_ERROR(x,y) | ||
54 | #endif | ||
55 | |||
56 | #if AT_CMD_PATTERN_CHECK | ||
57 | #define AT_PARSE_SINGLE_CMD_PATTERN_ERROR(x,y) \ | ||
58 | { if (x[0] != y->symbol) {AT_ERROR(AT_INVALID_PARA); return;}} | ||
59 | #else | ||
60 | #define AT_PARSE_CMD_PATTERN_ERROR(x,y) | ||
61 | #endif | ||
62 | |||
63 | /********************************************************************* | ||
64 | * DATA STRUCTURE | ||
65 | */ | ||
66 | typedef struct { | ||
67 | uint8_t symbol; | ||
68 | uint8_t unitLen; | ||
69 | uint8_t* unit; | ||
70 | } AT_CmdUnit; | ||
71 | |||
72 | typedef void (*AT_CmdFn_t)(uint8_t cmd_ptr, uint8_t* msg_ptr); | ||
73 | typedef struct { | ||
74 | char* AT_Cmd_str; | ||
75 | AT_CmdFn_t AT_CmdFn; | ||
76 | char* ATCmdDescription; | ||
77 | } AT_Cmd_t; | ||
78 | |||
79 | /********************* | ||
80 | * error message | ||
81 | */ | ||
82 | #define AT_NO_ERROR 0x00 // Everything OK - Success | ||
83 | #define AT_FATAL_ERROR 0x01 // Fatal Error | ||
84 | #define AT_UNKNOWN_CMD 0x02 // Unknown command | ||
85 | #define AT_LACK_CMD 0x03 // lack command | ||
86 | #define AT_INVALID_PARA 0x04 // Invalid parameter | ||
87 | #define AT_LACK_OPERATOR 0x05 | ||
88 | #define AT_LACK_PARA 0x06 | ||
89 | |||
90 | /********************* | ||
91 | * command constants | ||
92 | */ | ||
93 | #define AT_CMD_HELP_DESC_OFFSET 17 | ||
94 | |||
95 | /********************************************************************* | ||
96 | * GLOBAL VARIABLES | ||
97 | */ | ||
98 | extern void AT_Process(uint8_t ch); | ||
99 | extern void AT_UARTWriteErrMsg(uint8_t errCode); | ||
100 | |||
101 | #endif /* INC_ATSYSTEM_H_ */ |
... | @@ -39,7 +39,6 @@ extern UART_HandleTypeDef huart2; | ... | @@ -39,7 +39,6 @@ extern UART_HandleTypeDef huart2; |
39 | 39 | ||
40 | extern uint8_t USART1_RingBuff[USART1_BUF_LEN]; // 接收缓冲 | 40 | extern uint8_t USART1_RingBuff[USART1_BUF_LEN]; // 接收缓冲 |
41 | 41 | ||
42 | #define AT_RESP(str, len) HAL_UART_Transmit(&huart2, (uint8_t*)str, len, 1000) | ||
43 | #define DEBUG_PRINT(str, len) HAL_UART_Transmit(&huart1, (uint8_t*)str, len, 1000) | 42 | #define DEBUG_PRINT(str, len) HAL_UART_Transmit(&huart1, (uint8_t*)str, len, 1000) |
44 | /* USER CODE END Private defines */ | 43 | /* USER CODE END Private defines */ |
45 | 44 | ... | ... |
Core/Src/ATSystem.c
0 → 100644
This diff is collapsed.
Click to expand it.
... | @@ -30,6 +30,7 @@ | ... | @@ -30,6 +30,7 @@ |
30 | #include "beep.h" | 30 | #include "beep.h" |
31 | #include "key.h" | 31 | #include "key.h" |
32 | #include "usart.h" | 32 | #include "usart.h" |
33 | #include "ATSystem.h" | ||
33 | /* USER CODE END Includes */ | 34 | /* USER CODE END Includes */ |
34 | 35 | ||
35 | /* Private typedef -----------------------------------------------------------*/ | 36 | /* Private typedef -----------------------------------------------------------*/ |
... | @@ -269,6 +270,7 @@ void StartUartTask(void *argument) | ... | @@ -269,6 +270,7 @@ void StartUartTask(void *argument) |
269 | { | 270 | { |
270 | RINGBUF_READ(&temp, 1); | 271 | RINGBUF_READ(&temp, 1); |
271 | mprintf("%c", temp); | 272 | mprintf("%c", temp); |
273 | AT_Process(temp); | ||
272 | } | 274 | } |
273 | 275 | ||
274 | times++; | 276 | times++; | ... | ... |
-
Please register or sign in to post a comment