瀏覽代碼

esp8266 Data Send 기능 추가

YJ 6 年之前
父節點
當前提交
053dda389c
共有 38 個文件被更改,包括 4310 次插入4060 次删除
  1. 1 0
      .gitignore
  2. 二進制
      Debug/STM32F103_WifiAttenCtrlTest.binary
  3. 二進制
      Debug/STM32F103_WifiAttenCtrlTest.elf
  4. 544 528
      Debug/STM32F103_WifiAttenCtrlTest.hex
  5. 3176 3033
      Debug/STM32F103_WifiAttenCtrlTest.list
  6. 485 445
      Debug/STM32F103_WifiAttenCtrlTest.map
  7. 二進制
      Debug/Src/esp8266.o
  8. 2 1
      Debug/Src/esp8266.su
  9. 二進制
      Debug/Src/main.o
  10. 2 2
      Debug/Src/main.su
  11. 二進制
      Debug/Src/stm32f1xx_hal_msp.o
  12. 二進制
      Debug/Src/uart.o
  13. 6 6
      Debug/Src/uart.su
  14. 1 0
      Inc/esp8266.h
  15. 1 0
      Inc/main.h
  16. 1 1
      Inc/uart.h
  17. 10 10
      STM32F103_WifiAttenCtrlTest.ioc
  18. 46 4
      Src/esp8266.c
  19. 23 21
      Src/main.c
  20. 12 9
      Src/uart.c
  21. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/STM32F103_WifiAttenCtrlTest.sip_sym
  22. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Drivers_STM32F1xx_HAL_Driver_Inc_stm32f1xx_hal_adc.h.sisc
  23. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Drivers_STM32F1xx_HAL_Driver_Inc_stm32f1xx_hal_adc_ex.h.sisc
  24. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Drivers_STM32F1xx_HAL_Driver_Src_stm32f1xx_hal_adc.c.sisc
  25. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Drivers_STM32F1xx_HAL_Driver_Src_stm32f1xx_hal_adc_ex.c.sisc
  26. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Inc_esp8266.h.sisc
  27. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Inc_flash.h.sisc
  28. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Inc_main.h.sisc
  29. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Inc_stm32f1xx_hal_conf.h.sisc
  30. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Inc_stm32f1xx_it.h.sisc
  31. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Inc_uart.h.sisc
  32. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Src_CRC16.c.sisc
  33. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Src_esp8266.c.sisc
  34. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Src_main.c.sisc
  35. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Src_stm32f1xx_hal_msp.c.sisc
  36. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Src_stm32f1xx_it.c.sisc
  37. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Src_system_stm32f1xx.c.sisc
  38. 二進制
      insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Src_uart.c.sisc

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
1
+/Debug/

二進制
Debug/STM32F103_WifiAttenCtrlTest.binary


二進制
Debug/STM32F103_WifiAttenCtrlTest.elf


File diff suppressed because it is too large
+ 544 - 528
Debug/STM32F103_WifiAttenCtrlTest.hex


File diff suppressed because it is too large
+ 3176 - 3033
Debug/STM32F103_WifiAttenCtrlTest.list


File diff suppressed because it is too large
+ 485 - 445
Debug/STM32F103_WifiAttenCtrlTest.map


二進制
Debug/Src/esp8266.o


+ 2 - 1
Debug/Src/esp8266.su

@@ -1 +1,2 @@
1
-esp8266.c:12:9:ESP8266_Strindex	0	static
1
+esp8266.c:12:6:ESP8266_Initialize	8	static
2
+esp8266.c:57:9:ESP8266_Strindex	8	static

二進制
Debug/Src/main.o


+ 2 - 2
Debug/Src/main.su

@@ -1,5 +1,5 @@
1
 main.c:83:6:HAL_TIM_PeriodElapsedCallback	0	static
1
 main.c:83:6:HAL_TIM_PeriodElapsedCallback	0	static
2
 main.c:92:5:_write	8	static
2
 main.c:92:5:_write	8	static
3
-main.c:179:6:SystemClock_Config	96	static
3
+main.c:183:6:SystemClock_Config	96	static
4
 main.c:104:5:main	56	static
4
 main.c:104:5:main	56	static
5
-main.c:612:6:Error_Handler	0	static
5
+main.c:614:6:Error_Handler	0	static

二進制
Debug/Src/stm32f1xx_hal_msp.o


二進制
Debug/Src/uart.o


+ 6 - 6
Debug/Src/uart.su

@@ -1,6 +1,6 @@
1
-uart.c:12:6:InitUartQueue	0	static
2
-uart.c:46:6:GetDataFromUartQueue	16	static
3
-uart.c:23:6:HAL_UART_RxCpltCallback	8	static
4
-uart.c:36:6:PutDataToUartQueue	16	static
5
-uart.c:61:6:Uart1_Data_Send	0	static
6
-uart.c:64:6:Uart2_Data_Send	0	static
1
+uart.c:12:6:InitUartQueue	8	static
2
+uart.c:47:6:GetDataFromUartQueue	8	static
3
+uart.c:24:6:HAL_UART_RxCpltCallback	16	static
4
+uart.c:37:6:PutDataToUartQueue	16	static
5
+uart.c:64:6:Uart1_Data_Send	0	static
6
+uart.c:67:6:Uart2_Data_Send	0	static

+ 1 - 0
Inc/esp8266.h

@@ -11,4 +11,5 @@
11
 #include "main.h"
11
 #include "main.h"
12
 
12
 
13
 uint8_t ESP8266_Strindex(uint8_t* str);
13
 uint8_t ESP8266_Strindex(uint8_t* str);
14
+void ESP8266_Initialize(void);
14
 #endif /* ESP8266_H_ */
15
 #endif /* ESP8266_H_ */

+ 1 - 0
Inc/main.h

@@ -34,6 +34,7 @@ extern "C" {
34
 /* USER CODE BEGIN Includes */
34
 /* USER CODE BEGIN Includes */
35
 #include <stdio.h>
35
 #include <stdio.h>
36
 #include <stdbool.h>
36
 #include <stdbool.h>
37
+#include <string.h>
37
 #include "uart.h"
38
 #include "uart.h"
38
 #include "CRC16.h"
39
 #include "CRC16.h"
39
 #include "flash.h"
40
 #include "flash.h"

+ 1 - 1
Inc/uart.h

@@ -29,7 +29,7 @@ extern UART_HandleTypeDef huart3;
29
 extern UARTQUEUE TerminalQueue;
29
 extern UARTQUEUE TerminalQueue;
30
 extern UARTQUEUE WifiQueue;
30
 extern UARTQUEUE WifiQueue;
31
 void PutDataToUartQueue(UART_HandleTypeDef *huart, uint8_t data);
31
 void PutDataToUartQueue(UART_HandleTypeDef *huart, uint8_t data);
32
-void InitUartQueue(pUARTQUEUE pQueue);
32
+void InitUartQueue(UART_HandleTypeDef *huart,pUARTQUEUE pQueue);
33
 void GetDataFromUartQueue(UART_HandleTypeDef *huart);
33
 void GetDataFromUartQueue(UART_HandleTypeDef *huart);
34
 bool Get_UartRcv(void);
34
 bool Get_UartRcv(void);
35
 void Set_UartRcv(bool);
35
 void Set_UartRcv(bool);

+ 10 - 10
STM32F103_WifiAttenCtrlTest.ioc

@@ -108,13 +108,13 @@ Mcu.UserConstants=
108
 Mcu.UserName=STM32F103RCTx
108
 Mcu.UserName=STM32F103RCTx
109
 MxCube.Version=5.3.0
109
 MxCube.Version=5.3.0
110
 MxDb.Version=DB.5.0.30
110
 MxDb.Version=DB.5.0.30
111
-NVIC.ADC1_2_IRQn=true\:0\:0\:false\:true\:true\:4\:true\:true
112
-NVIC.ADC3_IRQn=true\:0\:0\:false\:true\:true\:1\:true\:true
111
+NVIC.ADC1_2_IRQn=true\:0\:0\:false\:true\:true\:8\:true\:true
112
+NVIC.ADC3_IRQn=true\:0\:0\:false\:true\:true\:5\:true\:true
113
 NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
113
 NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
114
-NVIC.DMA1_Channel4_IRQn=true\:0\:0\:false\:true\:true\:9\:false\:true
115
-NVIC.DMA1_Channel5_IRQn=true\:0\:0\:false\:true\:true\:8\:false\:true
116
-NVIC.DMA1_Channel6_IRQn=true\:0\:0\:false\:true\:true\:7\:false\:true
117
-NVIC.DMA1_Channel7_IRQn=true\:0\:0\:false\:false\:true\:false\:true
114
+NVIC.DMA1_Channel4_IRQn=true\:0\:0\:false\:true\:true\:3\:false\:true
115
+NVIC.DMA1_Channel5_IRQn=true\:0\:0\:false\:true\:true\:2\:false\:true
116
+NVIC.DMA1_Channel6_IRQn=true\:0\:0\:false\:true\:true\:1\:false\:true
117
+NVIC.DMA1_Channel7_IRQn=true\:0\:0\:false\:true\:true\:4\:false\:true
118
 NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false
118
 NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false
119
 NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
119
 NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
120
 NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false
120
 NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false
@@ -123,10 +123,10 @@ NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false
123
 NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
123
 NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
124
 NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false
124
 NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false
125
 NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true
125
 NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true
126
-NVIC.TIM6_IRQn=true\:0\:0\:false\:true\:true\:3\:true\:true
127
-NVIC.UART4_IRQn=true\:0\:0\:false\:true\:true\:2\:true\:true
128
-NVIC.USART1_IRQn=true\:0\:0\:false\:true\:true\:5\:true\:true
129
-NVIC.USART2_IRQn=true\:0\:0\:false\:true\:true\:6\:true\:true
126
+NVIC.TIM6_IRQn=true\:0\:0\:false\:true\:true\:7\:true\:true
127
+NVIC.UART4_IRQn=true\:0\:0\:false\:true\:true\:6\:true\:true
128
+NVIC.USART1_IRQn=true\:0\:0\:false\:true\:true\:9\:true\:true
129
+NVIC.USART2_IRQn=true\:0\:0\:false\:true\:true\:10\:true\:true
130
 NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
130
 NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
131
 PA1.GPIOParameters=GPIO_Label
131
 PA1.GPIOParameters=GPIO_Label
132
 PA1.GPIO_Label=LED_UL_G_B
132
 PA1.GPIO_Label=LED_UL_G_B

+ 46 - 4
Src/esp8266.c

@@ -9,9 +9,51 @@
9
 #include "esp8266.h"
9
 #include "esp8266.h"
10
 
10
 
11
 
11
 
12
-uint8_t ESP8266_Strindex(uint8_t* str){
13
-    uint8_t val = 0;
14
-    val = sizeof(str) - 1;
12
+void ESP8266_Initialize(void){
13
+	  volatile static bool init = false;
14
+	  volatile static uint8_t seq = 0;
15
+	  if(init == false ||  seq < 4){
16
+		  init = true;
17
+	  }else{
18
+	  /* * * * *DATA SEND COMMADN * * * * * */
19
+#if 0 // PYJ.2019.08.06_BEGIN -- 
20
+          Uart2_Data_Send("AT+CIPSEND=0,1\r\n",ESP8266_Strindex("AT+CIPSEND=0,1\r\n"));
21
+          HAL_Delay(5); 
22
+          Uart2_Data_Send("1\r\n",ESP8266_Strindex("1\r\n"));    	  
23
+#endif // PYJ.2019.08.06_END -- 
24
+//          Uart2_Data_Send("AT+CIPSEND=1,1\r\n",ESP8266_Strindex("AT+CIPSEND=1,1\r\n"));
25
+//          HAL_Delay(5); 
26
+//          Uart2_Data_Send("1\r\n",ESP8266_Strindex("1\r\n"));              
27
+        return;
28
+	  }
29
+	  switch(seq){
30
+	  case 0:
31
+          Uart2_Data_Send("AT+CWMODE=3\r\n",ESP8266_Strindex("AT+CWMODE=3\r\n"));
32
+		  seq++;
33
+		  break;
34
+	  case 1:
35
+          Uart2_Data_Send("AT+CIPMUX=1\r\n",ESP8266_Strindex("AT+CIPMUX=1\r\n"));
36
+		  seq++;
37
+		  break;
38
+	  case 2:
39
+          Uart2_Data_Send("AT+CWSAP=\"BLUE_TEST\",\"\",5,0\r\n",ESP8266_Strindex("AT+CWSAP=\"BLUE_TEST\",\"\",5,0\r\n"));
40
+		  seq++;
41
+		  break;
42
+	  case 3:
43
+          Uart2_Data_Send("AT+CIPSERVER=1,4000\r\n",ESP8266_Strindex("AT+CIPSERVER=1,4000\r\n"));
44
+          HAL_Delay(5);
45
+          Uart2_Data_Send("AT+CIFSR\r\n",ESP8266_Strindex("AT+CIFSR\r\n"));
46
+      
47
+          
48
+
49
+		  printf("ESP Setting Complete \r\n");
50
+		  seq++;
51
+		  break;
52
+	  default:
53
+		  break;
54
+	  }
15
 
55
 
16
-    return val;
56
+}
57
+uint8_t ESP8266_Strindex(uint8_t* str){
58
+    return strlen(str);
17
 }
59
 }

+ 23 - 21
Src/main.c

@@ -59,7 +59,7 @@ DMA_HandleTypeDef hdma_usart2_tx;
59
 /* USER CODE BEGIN PV */
59
 /* USER CODE BEGIN PV */
60
 volatile uint32_t UartTimerCnt = 0;
60
 volatile uint32_t UartTimerCnt = 0;
61
 volatile uint32_t LedTimerCnt = 0;
61
 volatile uint32_t LedTimerCnt = 0;
62
-volatile uint32_t FirmwareTimerCnt = 0;
62
+volatile uint32_t InitTimerCnt = 0;
63
 /* USER CODE END PV */
63
 /* USER CODE END PV */
64
 
64
 
65
 /* Private function prototypes -----------------------------------------------*/
65
 /* Private function prototypes -----------------------------------------------*/
@@ -86,7 +86,7 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
86
     if(htim->Instance == TIM6){
86
     if(htim->Instance == TIM6){
87
         UartTimerCnt++;
87
         UartTimerCnt++;
88
         LedTimerCnt++;
88
         LedTimerCnt++;
89
-        FirmwareTimerCnt++;
89
+        InitTimerCnt++;
90
     }
90
     }
91
 }
91
 }
92
 int _write (int file, uint8_t *ptr, uint16_t len)
92
 int _write (int file, uint8_t *ptr, uint16_t len)
@@ -142,17 +142,17 @@ int main(void)
142
   setbuf(stdout, NULL);
142
   setbuf(stdout, NULL);
143
   printf("Uart Start \r\n");
143
   printf("Uart Start \r\n");
144
   printf("Crc generate %x \r\n",CRC16_Generate(tempdata,11));
144
   printf("Crc generate %x \r\n",CRC16_Generate(tempdata,11));
145
-  InitUartQueue(&TerminalQueue);
146
-  InitUartQueue(&WifiQueue);
147
-  HAL_UART_Transmit_DMA(&huart2, "AT+CWMODE=3\r\n", ESP8266_Strindex("AT+CWMODE=3\r\n"));
145
+  InitUartQueue(&hTerminal,&TerminalQueue);
146
+  InitUartQueue(&hWifi,&WifiQueue);
147
+  /*HAL_UART_Transmit_DMA(&huart2, "AT+CWMODE=3\r\n", ESP8266_Strindex("AT+CWMODE=3\r\n"));
148
   HAL_Delay(5);
148
   HAL_Delay(5);
149
   HAL_UART_Transmit_DMA(&huart2, "AT+CIPMUX=1\r\n", ESP8266_Strindex("AT+CIPMUX=1\r\n"));
149
   HAL_UART_Transmit_DMA(&huart2, "AT+CIPMUX=1\r\n", ESP8266_Strindex("AT+CIPMUX=1\r\n"));
150
   HAL_Delay(5);
150
   HAL_Delay(5);
151
   HAL_UART_Transmit_DMA(&huart2, "AT+CWSAP=\"YJ_TEST\",\"\",5,0\r\n", ESP8266_Strindex("AT+CWSAP=\"YJ_TEST\",\"\",5,0\r\n"));
151
   HAL_UART_Transmit_DMA(&huart2, "AT+CWSAP=\"YJ_TEST\",\"\",5,0\r\n", ESP8266_Strindex("AT+CWSAP=\"YJ_TEST\",\"\",5,0\r\n"));
152
   HAL_Delay(5);
152
   HAL_Delay(5);
153
-  HAL_UART_Transmit_DMA(&huart2, "AT+CIPSERVER=1,4000\r\n", ESP8266_Strindex("AT+CIPSERVER=1,4000\r\n"));
153
+  HAL_UART_Transmit_DMA(&huart2, "AT+CIPSERVER=1,4000\r\n", ESP8266_Strindex("AT+CIPSERVER=1,4000\r\n"));*/
154
+
154
 
155
 
155
-  printf("ESP Setting Complete \r\n");
156
   /* USER CODE END 2 */
156
   /* USER CODE END 2 */
157
 
157
 
158
   /* Infinite loop */
158
   /* Infinite loop */
@@ -162,6 +162,10 @@ int main(void)
162
 	  if(LedTimerCnt > 100){
162
 	  if(LedTimerCnt > 100){
163
 		  HAL_GPIO_TogglePin(LED_UL_G_B_GPIO_Port,LED_UL_G_B_Pin);
163
 		  HAL_GPIO_TogglePin(LED_UL_G_B_GPIO_Port,LED_UL_G_B_Pin);
164
 		  LedTimerCnt = 0;
164
 		  LedTimerCnt = 0;
165
+	  }
166
+	  if(InitTimerCnt >1000){
167
+		  ESP8266_Initialize();
168
+		  InitTimerCnt = 0;
165
 	  }
169
 	  }
166
 	   while (TerminalQueue.data > 0) GetDataFromUartQueue(&hTerminal);
170
 	   while (TerminalQueue.data > 0) GetDataFromUartQueue(&hTerminal);
167
 	   while (WifiQueue.data > 0) GetDataFromUartQueue(&hWifi);
171
 	   while (WifiQueue.data > 0) GetDataFromUartQueue(&hWifi);
@@ -221,6 +225,18 @@ void SystemClock_Config(void)
221
   */
225
   */
222
 static void MX_NVIC_Init(void)
226
 static void MX_NVIC_Init(void)
223
 {
227
 {
228
+  /* DMA1_Channel6_IRQn interrupt configuration */
229
+  HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 0, 0);
230
+  HAL_NVIC_EnableIRQ(DMA1_Channel6_IRQn);
231
+  /* DMA1_Channel5_IRQn interrupt configuration */
232
+  HAL_NVIC_SetPriority(DMA1_Channel5_IRQn, 0, 0);
233
+  HAL_NVIC_EnableIRQ(DMA1_Channel5_IRQn);
234
+  /* DMA1_Channel4_IRQn interrupt configuration */
235
+  HAL_NVIC_SetPriority(DMA1_Channel4_IRQn, 0, 0);
236
+  HAL_NVIC_EnableIRQ(DMA1_Channel4_IRQn);
237
+  /* DMA1_Channel7_IRQn interrupt configuration */
238
+  HAL_NVIC_SetPriority(DMA1_Channel7_IRQn, 0, 0);
239
+  HAL_NVIC_EnableIRQ(DMA1_Channel7_IRQn);
224
   /* ADC3_IRQn interrupt configuration */
240
   /* ADC3_IRQn interrupt configuration */
225
   HAL_NVIC_SetPriority(ADC3_IRQn, 0, 0);
241
   HAL_NVIC_SetPriority(ADC3_IRQn, 0, 0);
226
   HAL_NVIC_EnableIRQ(ADC3_IRQn);
242
   HAL_NVIC_EnableIRQ(ADC3_IRQn);
@@ -239,15 +255,6 @@ static void MX_NVIC_Init(void)
239
   /* USART2_IRQn interrupt configuration */
255
   /* USART2_IRQn interrupt configuration */
240
   HAL_NVIC_SetPriority(USART2_IRQn, 0, 0);
256
   HAL_NVIC_SetPriority(USART2_IRQn, 0, 0);
241
   HAL_NVIC_EnableIRQ(USART2_IRQn);
257
   HAL_NVIC_EnableIRQ(USART2_IRQn);
242
-  /* DMA1_Channel6_IRQn interrupt configuration */
243
-  HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 0, 0);
244
-  HAL_NVIC_EnableIRQ(DMA1_Channel6_IRQn);
245
-  /* DMA1_Channel5_IRQn interrupt configuration */
246
-  HAL_NVIC_SetPriority(DMA1_Channel5_IRQn, 0, 0);
247
-  HAL_NVIC_EnableIRQ(DMA1_Channel5_IRQn);
248
-  /* DMA1_Channel4_IRQn interrupt configuration */
249
-  HAL_NVIC_SetPriority(DMA1_Channel4_IRQn, 0, 0);
250
-  HAL_NVIC_EnableIRQ(DMA1_Channel4_IRQn);
251
 }
258
 }
252
 
259
 
253
 /**
260
 /**
@@ -531,11 +538,6 @@ static void MX_DMA_Init(void)
531
   /* DMA controller clock enable */
538
   /* DMA controller clock enable */
532
   __HAL_RCC_DMA1_CLK_ENABLE();
539
   __HAL_RCC_DMA1_CLK_ENABLE();
533
 
540
 
534
-  /* DMA interrupt init */
535
-  /* DMA1_Channel7_IRQn interrupt configuration */
536
-  HAL_NVIC_SetPriority(DMA1_Channel7_IRQn, 0, 0);
537
-  HAL_NVIC_EnableIRQ(DMA1_Channel7_IRQn);
538
-
539
 }
541
 }
540
 
542
 
541
 /**
543
 /**

+ 12 - 9
Src/uart.c

@@ -9,11 +9,12 @@
9
 
9
 
10
 UARTQUEUE TerminalQueue;
10
 UARTQUEUE TerminalQueue;
11
 UARTQUEUE WifiQueue;
11
 UARTQUEUE WifiQueue;
12
-void InitUartQueue(pUARTQUEUE pQueue)
12
+void InitUartQueue(UART_HandleTypeDef *huart,pUARTQUEUE pQueue)
13
 {
13
 {
14
+    UART_HandleTypeDef *dst = (huart->Instance == USART2 ? &hWifi:&hTerminal);
14
     pQueue->data = pQueue->head = pQueue->tail = 0;
15
     pQueue->data = pQueue->head = pQueue->tail = 0;
15
 
16
 
16
-    if (HAL_UART_Receive_DMA(&hTerminal, TerminalQueue.Buffer, 1) != HAL_OK)
17
+    if (HAL_UART_Receive_DMA(dst, pQueue->Buffer, 1) != HAL_OK)
17
     {
18
     {
18
 //      _Error_Handler(__FILE__, __LINE__);
19
 //      _Error_Handler(__FILE__, __LINE__);
19
     }
20
     }
@@ -22,15 +23,15 @@ void InitUartQueue(pUARTQUEUE pQueue)
22
 }
23
 }
23
 void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
24
 void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
24
 {
25
 {
25
-    pUARTQUEUE pQueue;
26
-    pQueue = (huart->Instance == USART2 ? &WifiQueue:&TerminalQueue);
26
+    pUARTQUEUE pQueue = (huart->Instance == USART2 ? &WifiQueue:&TerminalQueue);
27
+    UART_HandleTypeDef *dst = (huart->Instance == USART2 ? &hWifi:&hTerminal);
27
 
28
 
28
     pQueue->head++;
29
     pQueue->head++;
29
     if (pQueue->head >= QUEUE_BUFFER_LENGTH) pQueue->head = 0;
30
     if (pQueue->head >= QUEUE_BUFFER_LENGTH) pQueue->head = 0;
30
     pQueue->data++;
31
     pQueue->data++;
31
     if (pQueue->data >= QUEUE_BUFFER_LENGTH)
32
     if (pQueue->data >= QUEUE_BUFFER_LENGTH)
32
         GetDataFromUartQueue(huart);
33
         GetDataFromUartQueue(huart);
33
-    HAL_UART_Receive_DMA(&hTerminal, pQueue->Buffer + pQueue->head, 1);
34
+    HAL_UART_Receive_DMA(dst, pQueue->Buffer + pQueue->head, 1);
34
    // Set_UartRcv(true);
35
    // Set_UartRcv(true);
35
 }
36
 }
36
 void PutDataToUartQueue(UART_HandleTypeDef *huart, uint8_t data)
37
 void PutDataToUartQueue(UART_HandleTypeDef *huart, uint8_t data)
@@ -46,12 +47,14 @@ void PutDataToUartQueue(UART_HandleTypeDef *huart, uint8_t data)
46
 void GetDataFromUartQueue(UART_HandleTypeDef *huart)
47
 void GetDataFromUartQueue(UART_HandleTypeDef *huart)
47
 {
48
 {
48
     UART_HandleTypeDef *dst = (huart->Instance == USART2 ? &hWifi:&hTerminal);
49
     UART_HandleTypeDef *dst = (huart->Instance == USART2 ? &hWifi:&hTerminal);
49
-    pUARTQUEUE pQueue = &TerminalQueue;
50
+    pUARTQUEUE pQueue = (huart->Instance == USART2 ? &WifiQueue:&TerminalQueue);
50
 //    printf("Function : %s : ",__func__);
51
 //    printf("Function : %s : ",__func__);
51
-    if (HAL_UART_Transmit_DMA(dst, pQueue->Buffer + pQueue->tail, 1) != HAL_OK)
52
-    {
52
+//    if (HAL_UART_Transmit_DMA(dst, pQueue->Buffer + pQueue->tail, 1) != HAL_OK)
53
+    printf("%c",*(pQueue->Buffer + pQueue->tail));
54
+    //if (HAL_UART_Transmit_DMA(&hTerminal, pQueue->Buffer + pQueue->tail, 1) != HAL_OK)
55
+    //{
53
 //       _Error_Handler(__FILE__, __LINE__);
56
 //       _Error_Handler(__FILE__, __LINE__);
54
-    }
57
+    //}
55
 //    printf("\r\n");
58
 //    printf("\r\n");
56
     pQueue->tail++;
59
     pQueue->tail++;
57
     if (pQueue->tail >= QUEUE_BUFFER_LENGTH) pQueue->tail = 0;
60
     if (pQueue->tail >= QUEUE_BUFFER_LENGTH) pQueue->tail = 0;

二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/STM32F103_WifiAttenCtrlTest.sip_sym


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Drivers_STM32F1xx_HAL_Driver_Inc_stm32f1xx_hal_adc.h.sisc


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Drivers_STM32F1xx_HAL_Driver_Inc_stm32f1xx_hal_adc_ex.h.sisc


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Drivers_STM32F1xx_HAL_Driver_Src_stm32f1xx_hal_adc.c.sisc


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Drivers_STM32F1xx_HAL_Driver_Src_stm32f1xx_hal_adc_ex.c.sisc


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Inc_esp8266.h.sisc


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Inc_flash.h.sisc


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Inc_main.h.sisc


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Inc_stm32f1xx_hal_conf.h.sisc


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Inc_stm32f1xx_it.h.sisc


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Inc_uart.h.sisc


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Src_CRC16.c.sisc


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Src_esp8266.c.sisc


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Src_main.c.sisc


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Src_stm32f1xx_hal_msp.c.sisc


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Src_stm32f1xx_it.c.sisc


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Src_system_stm32f1xx.c.sisc


二進制
insight/STM32F103_WifiAttenCtrlTest.si4project/cache/parse/.._Src_uart.c.sisc