瀏覽代碼

Uart 수정 버전

june9152 6 年之前
父節點
當前提交
372bbc2105
共有 20 個文件被更改,包括 4562 次插入4727 次删除
  1. 二進制
      Debug/STM32F103_RGB_Controller.bin
  2. 二進制
      Debug/STM32F103_RGB_Controller.binary
  3. 二進制
      Debug/STM32F103_RGB_Controller.elf
  4. 3861 3931
      Debug/STM32F103_RGB_Controller.list
  5. 565 597
      Debug/STM32F103_RGB_Controller.map
  6. 二進制
      Debug/Src/GPIO_SPI.o
  7. 二進制
      Debug/Src/RGB_Controller.o
  8. 二進制
      Debug/Src/RGB_Lora.o
  9. 二進制
      Debug/Src/SX1276.o
  10. 二進制
      Debug/Src/Uart.o
  11. 0 9
      Debug/Src/Uart.su
  12. 二進制
      Debug/Src/main.o
  13. 18 11
      Debug/Src/main.su
  14. 二進制
      Debug/Src/stm32f1xx_hal_msp.o
  15. 二進制
      Debug/Src/stm32f1xx_it.o
  16. 0 31
      Inc/Uart.h
  17. 2 16
      Inc/main.h
  18. 3 0
      Src/RGB_Controller.c
  19. 0 112
      Src/Uart.c
  20. 113 20
      Src/main.c

二進制
Debug/STM32F103_RGB_Controller.bin


二進制
Debug/STM32F103_RGB_Controller.binary


二進制
Debug/STM32F103_RGB_Controller.elf


文件差異過大導致無法顯示
+ 3861 - 3931
Debug/STM32F103_RGB_Controller.list


文件差異過大導致無法顯示
+ 565 - 597
Debug/STM32F103_RGB_Controller.map


二進制
Debug/Src/GPIO_SPI.o


二進制
Debug/Src/RGB_Controller.o


二進制
Debug/Src/RGB_Lora.o


二進制
Debug/Src/SX1276.o


二進制
Debug/Src/Uart.o


+ 0 - 9
Debug/Src/Uart.su

@@ -1,9 +0,0 @@
1
-Uart.c:31:6:HAL_UART_RxCpltCallback	8	static
2
-Uart.c:47:6:QueueCheck	24	static
3
-Uart.c:57:6:UartDataBufferCheck	8	static
4
-Uart.c:61:6:UartDataRecvSet	0	static
5
-Uart.c:64:9:UartDataRecvGet	0	static
6
-Uart.c:69:6:Uart2_Data_Send	0	static
7
-Uart.c:72:6:Uart1_Data_Send	0	static
8
-Uart.c:76:5:_write	8	static
9
-Uart.c:81:6:Uart_dataCheck	24	static

二進制
Debug/Src/main.o


+ 18 - 11
Debug/Src/main.su

@@ -1,11 +1,18 @@
1
-main.c:109:6:HAL_TIM_PeriodElapsedCallback	0	static
2
-main.c:120:6:RGB_SensorIDAutoSet	0	static
3
-main.c:123:9:RGB_SensorIDAutoGet	0	static
4
-main.c:128:6:RGB_Sensor_PowerOnOff	8	static
5
-main.c:282:6:test_read	24	static
6
-main.c:301:6:Flash_RGB_Data_Write	16	static
7
-main.c:314:6:Flash_write	24	static
8
-main.c:367:6:Flash_InitRead	12	static
9
-main.c:558:6:SystemClock_Config	72	static
10
-main.c:404:5:main	112	static
11
-main.c:832:6:Error_Handler	0	static
1
+main.c:117:6:HAL_UART_RxCpltCallback	8	static
2
+main.c:157:6:HAL_TIM_PeriodElapsedCallback	0	static
3
+main.c:167:6:UartDataRecvSet	0	static
4
+main.c:170:9:UartDataRecvGet	0	static
5
+main.c:173:6:RGB_SensorIDAutoSet	0	static
6
+main.c:176:9:RGB_SensorIDAutoGet	0	static
7
+main.c:180:6:Uart2_Data_Send	0	static
8
+main.c:183:6:Uart1_Data_Send	0	static
9
+main.c:187:5:_write	8	static
10
+main.c:192:6:Uart_dataCheck	24	static
11
+main.c:221:6:RGB_Sensor_PowerOnOff	8	static
12
+main.c:375:6:test_read	24	static
13
+main.c:394:6:Flash_RGB_Data_Write	16	static
14
+main.c:407:6:Flash_write	24	static
15
+main.c:460:6:Flash_InitRead	12	static
16
+main.c:652:6:SystemClock_Config	72	static
17
+main.c:497:5:main	112	static
18
+main.c:926:6:Error_Handler	0	static

二進制
Debug/Src/stm32f1xx_hal_msp.o


二進制
Debug/Src/stm32f1xx_it.o


+ 0 - 31
Inc/Uart.h

@@ -1,31 +0,0 @@
1
-#include "main.h"
2
-
3
-
4
-extern void UartDataRecvSet(uint8_t val);
5
-extern uint8_t UartDataRecvGet(void);
6
-extern void Uart3_Data_Send(uint8_t* data,uint8_t size);
7
-extern void Uart2_Data_Send(uint8_t* data,uint8_t size);
8
-extern void Uart1_Data_Send(uint8_t* data,uint8_t size);
9
-extern int _write (int file, uint8_t *ptr, uint16_t len);
10
-extern void Uart_dataCheck(uint8_t Usart_Num ,uint8_t* cnt);
11
-extern void UartDataBufferCheck(void);
12
-extern void QueueCheck(uint8_t Usart_Num,uint8_t* header,uint8_t* tail);
13
-
14
-#define USART_CNT 2
15
-#define buf_size 100
16
-#define USART1_CNT 0
17
-#define USART2_CNT 1
18
-
19
-extern uint8_t buf[USART_CNT][buf_size];
20
-extern uint8_t count_in1 , count_out1;
21
-extern uint8_t count_in2 , count_out2;
22
-
23
-extern uint8_t rx1_data[1];
24
-extern uint8_t rx2_data[1];
25
-
26
-extern UART_HandleTypeDef huart1;
27
-extern UART_HandleTypeDef huart2;
28
-extern UART_HandleTypeDef huart3;
29
-
30
-extern volatile uint32_t UartTimerCnt;
31
-

+ 2 - 16
Inc/main.h

@@ -57,7 +57,6 @@ extern "C" {
57 57
 #include "RGB_Controller.h"
58 58
 #include "core_cm3.h"
59 59
 #include <stdint.h>
60
-#include "Uart.h"
61 60
 #include "SX1276.h"
62 61
 /* USER CODE END Includes */
63 62
 
@@ -92,9 +91,6 @@ extern void Uart3_Data_Send(uint8_t* data,uint8_t size);
92 91
 extern void RGB_SensorIDAutoSet(uint8_t set);
93 92
 extern uint8_t RGB_SensorIDAutoGet(void);
94 93
 extern void Flash_write(uint8_t*);
95
-extern void UartDataRecvSet(uint8_t val);
96
-extern void Uart_dataCheck(uint8_t Usart_Num ,uint8_t* cnt);
97
-extern void Uart1_Data_Send(uint8_t* data,uint8_t size);
98 94
 
99 95
 /* USER CODE END EM */
100 96
 
@@ -117,6 +113,7 @@ typedef enum{
117 113
     RGB_Sensor_Check ,
118 114
     RGB_Sensor_Ack,  
119 115
     RGB_Reset,
116
+    RGB_ID_Allocate_Request,
120 117
 }RGB_CMD_T;
121 118
 #define     RGB_ControllerID_SET_Length 10 
122 119
 #define     RGB_SensorID_SET_Length     10 
@@ -127,17 +124,6 @@ typedef enum{
127 124
 
128 125
 #define     RGB_SensorDataResponse_Length 15
129 126
 #define     RGB_SensorDataResponseData_Length RGB_SensorDataResponse_Length - 3
130
-
131
-
132
-
133
-extern uint8_t buf[USART_CNT][buf_size];
134
-extern uint8_t count_in1 ;//, count_out ;
135
-extern uint8_t count_in2 ;//, count_out ;
136
-extern uint8_t count_in3 , count_out ;
137
-extern uint8_t rx1_data[1];
138
-extern uint8_t rx2_data[1];
139
-extern uint8_t rx3_data[1];
140
-
141 127
 /* USER CODE END EFP */
142 128
 
143 129
 /* Private defines -----------------------------------------------------------*/
@@ -200,7 +186,7 @@ extern uint8_t rx3_data[1];
200 186
 #define LED_CH8_Pin GPIO_PIN_9
201 187
 #define LED_CH8_GPIO_Port GPIOB
202 188
 /* USER CODE BEGIN Private defines */
203
-
189
+#define buf_size 100
204 190
 
205 191
 /* USER CODE END Private defines */
206 192
 

+ 3 - 0
Src/RGB_Controller.c

@@ -135,6 +135,9 @@ void RGB_Controller_Func(uint8_t* data){
135 135
             break;
136 136
         case RGB_Reset:
137 137
             NVIC_SystemReset();
138
+            break;
139
+        case RGB_ID_Allocate_Request:
140
+            
138 141
             break;
139 142
         default:
140 143
         break;

+ 0 - 112
Src/Uart.c

@@ -1,112 +0,0 @@
1
-#include "Uart.h"
2
-
3
-void UartDataRecvSet(uint8_t val);
4
-uint8_t UartDataRecvGet(void);
5
-void Uart2_Data_Send(uint8_t* data,uint8_t size);
6
-void Uart1_Data_Send(uint8_t* data,uint8_t size);
7
-int _write (int file, uint8_t *ptr, uint16_t len);
8
-void Uart_dataCheck(uint8_t Usart_Num ,uint8_t* cnt);
9
-void QueueCheck(uint8_t Usart_Num,uint8_t* header,uint8_t* tail);
10
-void UartDataBufferCheck(void);
11
-
12
-
13
-
14
-
15
-uint8_t UartDataisReved;
16
-uint8_t rx1_data[1];
17
-uint8_t rx2_data[1];
18
-
19
-uint8_t count_in1 = 0, count_out1 = 0;
20
-uint8_t count_in2 = 0, count_out2 = 0;
21
-
22
-uint8_t buf[USART_CNT][buf_size] = {0,};
23
-uint8_t Uart_RxData[USART_CNT][buf_size] = {0,};
24
-uint8_t Uart_Rxcnt = 0;
25
-typedef struct{
26
-    uint8_t Rx_Header;
27
-    uint8_t Rx_Tail;
28
-    uint8_t buf[USART_CNT][buf_size];
29
-}BlueUsart_t;
30
-    
31
-void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
32
-{
33
-    if(huart->Instance == USART1)
34
-    {
35
-        buf[USART1_CNT][count_in1] = rx1_data[0];
36
-        if(++count_in1>=100){ count_in1 = 0; }
37
-        HAL_UART_Receive_IT(&huart1,&rx1_data[0],1);
38
-    }
39
-    if(huart->Instance == USART2) 
40
-    {
41
-        buf[USART2_CNT][count_in2] = rx2_data[0];
42
-        if(++count_in2>=100){ count_in2 = 0; }
43
-        HAL_UART_Receive_IT(&huart2,&rx2_data[0],1);
44
-    }
45
-    
46
-}
47
-void QueueCheck(uint8_t Usart_Num,uint8_t* header,uint8_t* tail){
48
-
49
-     if(*tail != *header){ 
50
-        Uart_RxData[Usart_Num][Uart_Rxcnt++] = buf[Usart_Num][(*tail)++];
51
-        printf("%02x ",Uart_RxData[Usart_Num][Uart_Rxcnt - 1]);
52
-        if(*tail>= 100){ *tail = 0; }
53
-        UartTimerCnt = 0;
54
-        UartDataRecvSet(Usart_Num + 1);
55
-    }
56
-}
57
-void UartDataBufferCheck(void){
58
-    QueueCheck(USART1_CNT,&count_in1,&count_out1);
59
-    QueueCheck(USART2_CNT,&count_in2,&count_out2);
60
-}
61
-void UartDataRecvSet(uint8_t val){
62
-    UartDataisReved = val;
63
-}
64
-uint8_t UartDataRecvGet(void){
65
-    return UartDataisReved;
66
-}
67
-
68
-
69
-void Uart2_Data_Send(uint8_t* data,uint8_t size){
70
-    HAL_UART_Transmit(&huart2, data,size, 10); 
71
-}
72
-void Uart1_Data_Send(uint8_t* data,uint8_t size){
73
-    HAL_UART_Transmit(&huart1, data,size, 10); 
74
-}
75
-
76
-int _write (int file, uint8_t *ptr, uint16_t len) 
77
-{
78
-    HAL_UART_Transmit (&huart1, ptr, len, 10); 
79
-    return len;
80
-}
81
-void Uart_dataCheck(uint8_t Usart_Num ,uint8_t* cnt){
82
-
83
-    etError crccheck = 0;
84
-#if 0
85
-    for(uint8_t i = 0; i < (* cnt); i++){
86
-        printf("%02x ",buf[i]);
87
-    }
88
-        printf("\r\n");
89
-#endif  
90
-
91
-    crccheck = STH30_CheckCrc(&Uart_RxData[Usart_Num][blucell_type],Uart_RxData[Usart_Num][blucell_length],Uart_RxData[Usart_Num][Uart_RxData[Usart_Num][blucell_length] + 1]);
92
-    if(crccheck == CHECKSUM_ERROR){
93
-        for(uint8_t i = 0; i < (*cnt); i++){
94
-            printf("%02x ",Uart_RxData[Usart_Num][i]);
95
-        }
96
-     //   printf("Original CRC : %02x RecvCRC : %02x \r\n",crccheck,Uart_RxData[Usart_Num][Uart_RxData[Usart_Num][blucell_length] + 1]);
97
-    }
98
-    else if(crccheck == NO_ERROR){
99
-        RGB_Controller_Func(&Uart_RxData[Usart_Num][blucell_stx]);\
100
-        UartDataRecvSet(0);
101
-    }
102
-    else{
103
-         printf("What Happen?\r\n");
104
-        /*NOP*/
105
-    }
106
-
107
-    *cnt = 0;
108
-    
109
-    memset(Uart_RxData[Usart_Num],0x00,buf_size);
110
-}
111
-
112
-

+ 113 - 20
Src/main.c

@@ -70,16 +70,23 @@ UART_HandleTypeDef huart1;
70 70
 UART_HandleTypeDef huart2;
71 71
 
72 72
 /* USER CODE BEGIN PV */
73
+uint8_t rx1_data[1];
74
+uint8_t rx2_data[1];
73 75
 
74 76
 
77
+uint8_t ring_buf[buf_size];
78
+uint8_t count_in1 = 0;//, count_out = 0;
79
+uint8_t count_in2 = 0;//, count_out = 0;
80
+uint8_t count_in3 = 0, count_out = 0;
75 81
 
76 82
 
83
+uint8_t UartDataisReved;
77 84
 uint8_t RGB_SensorIDAutoset = 0;
78 85
 
79 86
 volatile uint32_t UartTimerCnt = 0;
80 87
 volatile uint32_t LedTimerCnt = 0;
81 88
 
82
-
89
+uint8_t buf[buf_size] = {0,};
83 90
 
84 91
 uint8_t MyControllerID = 0;
85 92
 uint8_t  SensorID = 0;
@@ -97,7 +104,9 @@ static void MX_NVIC_Init(void);
97 104
 /* USER CODE BEGIN PFP */
98 105
 void RGB_SensorIDAutoSet(uint8_t set);
99 106
 uint8_t RGB_SensorIDAutoGet(void);
100
-
107
+void UartDataRecvSet(uint8_t val);
108
+void Uart_dataCheck(uint8_t* cnt);
109
+void Uart1_Data_Send(uint8_t* data,uint8_t size);
101 110
 /* USER CODE END PFP */
102 111
 
103 112
 /* Private user code ---------------------------------------------------------*/
@@ -105,7 +114,46 @@ uint8_t RGB_SensorIDAutoGet(void);
105 114
 
106 115
 
107 116
 
117
+void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
118
+{
119
+    if(huart->Instance == USART1)//RGB Comunication 
120
+    {
121
+        buf[count_in1] = rx1_data[0];//(uint8_t)USART2->DR;
122
+//        printf("data %02x \r\n",rx1_data[0]);
123
+        if(buf[count_in1++] == 0xEB){
124
+            if(buf[blucell_length] == (count_in1 - 3))
125
+                UartDataRecvSet(1);
126
+            else
127
+                count_in1 = 0;
128
+        }
129
+        HAL_UART_Receive_IT(&huart1,&rx1_data[0],1);
130
+    }
131
+    if(huart->Instance == USART2) // Lora?? ?†µ?‹ ?•˜?Š� ?�¬?Џ
132
+    {
133
+        buf[count_in2] = rx2_data[0];//(uint8_t)USART2->DR;
134
+//        if(buf[count_in++] == 0xEB)UartDataRecvSet(1);
135
+        if(buf[count_in2++] == 0xEB){
136
+            if(buf[blucell_length] == (count_in2 - 3))
137
+                UartDataRecvSet(2);
138
+            else
139
+                count_in1 = 0;
140
+//                printf("UART 2 %d",((count_in2 -1) - 3));
141
+        }
108 142
 
143
+        HAL_UART_Receive_IT(&huart2,&rx2_data[0],1);
144
+    }
145
+#if 0 // PYJ.2019.04.13_BEGIN -- 
146
+    if(huart->Instance == USART3) //GUI ?? ?†µ?‹ ?•˜?Š� Port
147
+    {
148
+        buf[count_in3] = rx3_data[0];//(uint8_t)USART2->DR;
149
+        if(buf[count_in3++] == 0xEB)UartDataRecvSet(3);
150
+        /*ring_buf[count_in] = rx2_data[0];//(uint8_t)USART2->DR;
151
+        if(++count_in>=buf_size) count_in=0;*/
152
+        HAL_UART_Receive_IT(&huart3,&rx3_data[0],1);
153
+    }
154
+#endif // PYJ.2019.04.13_END -- 
155
+    
156
+}
109 157
 void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
110 158
 {
111 159
 
@@ -116,7 +164,12 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
116 164
     }
117 165
 }
118 166
 
119
-
167
+void UartDataRecvSet(uint8_t val){
168
+    UartDataisReved = val;
169
+}
170
+uint8_t UartDataRecvGet(void){
171
+    return UartDataisReved;
172
+}
120 173
 void RGB_SensorIDAutoSet(uint8_t set){
121 174
     RGB_SensorIDAutoset = set;
122 175
 }
@@ -124,7 +177,47 @@ uint8_t RGB_SensorIDAutoGet(void){
124 177
     return RGB_SensorIDAutoset;
125 178
 }
126 179
 
180
+void Uart2_Data_Send(uint8_t* data,uint8_t size){
181
+    HAL_UART_Transmit(&huart2, data,size, 10); 
182
+}
183
+void Uart1_Data_Send(uint8_t* data,uint8_t size){
184
+    HAL_UART_Transmit(&huart1, data,size, 10); 
185
+}
127 186
 
187
+int _write (int file, uint8_t *ptr, uint16_t len) 
188
+{
189
+    HAL_UART_Transmit (&huart1, ptr, len, 10); 
190
+    return len;
191
+}
192
+void Uart_dataCheck(uint8_t* cnt){
193
+
194
+    etError crccheck = 0;
195
+#if 0
196
+    for(uint8_t i = 0; i < (* cnt); i++){
197
+        printf("%02x ",buf[i]);
198
+    }
199
+        printf("\r\n");
200
+#endif  
201
+
202
+    crccheck = STH30_CheckCrc(&buf[blucell_type],buf[blucell_length],buf[buf[blucell_length] + 1]);
203
+    if(crccheck == CHECKSUM_ERROR){
204
+        for(uint8_t i = 0; i < (*cnt); i++){
205
+            printf("%02x ",buf[i]);
206
+        }
207
+        printf("Original CRC : %02x RecvCRC : %02x \r\n",crccheck,buf[buf[blucell_length] + 1]);
208
+    }
209
+    else if(crccheck == NO_ERROR){
210
+        RGB_Controller_Func(&buf[blucell_stx]);
211
+    }
212
+    else{
213
+         printf("What Happen?\r\n");
214
+        /*NOP*/
215
+    }
216
+
217
+    *cnt = 0;
218
+    
219
+    memset(buf,0x00,buf_size);
220
+}
128 221
 void RGB_Sensor_PowerOnOff(uint8_t id){
129 222
     printf("%d Power ON \r\n",id);
130 223
 
@@ -243,10 +336,10 @@ void RGB_Sensor_PowerOnOff(uint8_t id){
243 336
 #define END_ADDR    FLASH_USER + 262144 // 256K
244 337
 //----------------------------------------------------
245 338
 #if 0 // PYJ.2019.03.20_BEGIN -- 
246
-void test_write() // ?“°ê¸°í•¨?ˆ˜
339
+void test_write() // 쓰기함수
247 340
 {
248 341
 
249
-    __HAL_RCC_TIM7_CLK_DISABLE(); // 매ì�¸???�´ë¨¸ë?? ? •ì§??•©?‹ˆ?‹¤
342
+    __HAL_RCC_TIM7_CLK_DISABLE(); // 매�타�머를 정지합니다
250 343
     uint32_t  Address = 0;
251 344
     Address = StartAddr;
252 345
 //    printf("================First============ \r\n");
@@ -257,10 +350,10 @@ void test_write() // ?
257 350
 //        Address += 4;
258 351
 //    }  
259 352
 
260
-//    HAL_FLASH_Unlock(); // lock ??�
353
+//    HAL_FLASH_Unlock(); // lock 풀기
261 354
 //    HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, START_ADDR, (uint32_t)0x12345678); //test
262
-//    HAL_FLASH_Lock(); // lock ?ž ê·¸ê¸°
263
-//    __HAL_RCC_TIM7_CLK_ENABLE(); // 매ì�¸???�´ë¨¸ë?? ?ž¬?‹œ?ž‘?•©?‹ˆ?‹¤
355
+//    HAL_FLASH_Lock(); // lock 잠그기
356
+//    __HAL_RCC_TIM7_CLK_ENABLE(); // 매�타�머를 재시작합니다
264 357
     Address = StartAddr;
265 358
     printf("================Second============ \r\n");
266 359
 
@@ -279,7 +372,7 @@ void test_write() // ?
279 372
 
280 373
 
281 374
 #if 1 // PYJ.2019.03.20_BEGIN -- 
282
-void test_read(void) // ?“°ê¸°í•¨?ˆ˜
375
+void test_read(void) // 쓰기함수
283 376
 {
284 377
     uint32_t Address = 0x08000000;
285 378
     uint8_t aa = 0;
@@ -311,7 +404,7 @@ void Flash_RGB_Data_Write(uint32_t Addr,uint8_t* data){
311 404
     HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD,Addr + 4 ,   (uint16_t)temp_Blue);
312 405
 
313 406
 }
314
-void Flash_write(uint8_t* data) // ?“°ê¸°í•¨?ˆ˜
407
+void Flash_write(uint8_t* data) // 쓰기함수
315 408
 {
316 409
    
317 410
     /*Variable used for Erase procedure*/
@@ -324,8 +417,8 @@ void Flash_write(uint8_t* data) // ?
324 417
 //    EraseInitStruct.NbPages     = (FLASH_USER_END_ADDR - FLASH_USER_START_ADDR) / FLASH_PAGE_SIZE;
325 418
      Address = START_ADDR;
326 419
 
327
-    __HAL_RCC_TIM7_CLK_DISABLE(); // 매ì�¸???�´ë¨¸ë?? ? •ì§??•©?‹ˆ?‹¤
328
-    HAL_FLASH_Unlock(); // lock ??�
420
+    __HAL_RCC_TIM7_CLK_DISABLE(); // 매�타�머를 정지합니다
421
+    HAL_FLASH_Unlock(); // lock 풀기
329 422
 //    if (HAL_FLASHEx_Erase(&EraseInitStruct, &PAGEError) != HAL_OK){
330 423
 //        printf("Erase Failed \r\n");
331 424
 //    }else{
@@ -360,11 +453,11 @@ void Flash_write(uint8_t* data) // ?
360 453
 
361 454
     }
362 455
     Flash_RGB_Data_Write(Address,&data[blucell_stx]);
363
-    HAL_FLASH_Lock(); // lock ?ž ê·¸ê¸°
364
-    __HAL_RCC_TIM7_CLK_ENABLE(); // 매ì�¸???�´ë¨¸ë?? ?ž¬?‹œ?ž‘?•©?‹ˆ?‹¤
456
+    HAL_FLASH_Lock(); // lock 잠그기
457
+    __HAL_RCC_TIM7_CLK_ENABLE(); // 매�타�머를 재시작합니다
365 458
 
366 459
 }
367
-void Flash_InitRead(void) // ?“°ê¸°í•¨?ˆ˜
460
+void Flash_InitRead(void) // 쓰기함수
368 461
 {
369 462
     uint32_t  Address = 0;
370 463
     Address = StartAddr;
@@ -439,7 +532,7 @@ int main(void)
439 532
   HAL_TIM_Base_Start_IT(&htim6);
440 533
   HAL_UART_Receive_IT(&huart1, &rx1_data[0],1);
441 534
   HAL_UART_Receive_IT(&huart2, &rx2_data[0],1);
442
-  setbuf(stdout, NULL); // \n ?�„ ? �?�„ ?–„ë§? 
535
+  setbuf(stdout, NULL); // \n � �� 떄만 
443 536
 #if 1 // PYJ.2019.03.04_BEGIN -- 
444 537
       printf("****************************************\r\n");
445 538
       printf("RGB Project\r\n");
@@ -482,10 +575,10 @@ int main(void)
482 575
     uartdatarecv = UartDataRecvGet(); 
483 576
     if(uartdatarecv != 0){
484 577
         if(uartdatarecv == 1){
485
-            Uart_dataCheck(USART1_CNT,&count_in1);
578
+            Uart_dataCheck(&count_in1);
486 579
         }else if(uartdatarecv == 2){
487
-            Uart_dataCheck(USART2_CNT,&count_in2);
488
-        }
580
+            Uart_dataCheck(&count_in2);
581
+        }  
489 582
         UartDataRecvSet(0);
490 583
     }
491 584
 #else
@@ -529,7 +622,7 @@ int main(void)
529 622
                     SensorID = 0;
530 623
                 }else{
531 624
                     RGB_Sensor_PowerOnOff(IDAutoSetRequest_data[4]);
532
-                    HAL_Delay(5000);
625
+                    HAL_Delay(1500);
533 626
                     RGB_Controller_Func(&IDAutoSetRequest_data[blucell_stx]);
534 627
                     HAL_Delay(500);
535 628
                 }