Skip to content

Commit a2517e4

Browse files
committed
fixed the serious bug caused by the main function calling the key processing function and the system running error
corrected the description of README.md file
1 parent 29a0dde commit a2517e4

File tree

2 files changed

+5
-29
lines changed

2 files changed

+5
-29
lines changed

bsp/stm32/stm32f413-st-nucleo/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
- MCU:STM32F413ZH,主频 100MHz,1536KB FLASH ,320KB RAM
2626
- 常用外设
27-
- LED:8个,user LED [SB2跳帽需连接](黄色,PB0,LD1;蓝色,PB7,LD2;红色,PB14,LD3), USB communication (LD4), over current (LD5), power LED (黄色,LD6), USB FAULT (LD7), VBUS (LD8)。
27+
- LED:8个,user LED (JP5跳帽需连接)(黄色,PB0,LD1;蓝色,PB7,LD2;红色,PB14,LD3), USB communication (LD4), over current (LD5), power LED (黄色,LD6), USB FAULT (LD7), VBUS (LD8)。
2828
- 按键:2个,B1(USER,PC13),B2(RESET)
2929
- 常用接口:USB 支持 3 种不同接口:虚拟 COM 端口、大容量存储和调试端口等。
3030
- 调试接口,板载 ST-LINK/V2-1 调试器。
@@ -86,7 +86,7 @@
8686
8787
#### 运行结果
8888

89-
下载程序成功之后,系统会自动运行,在SB2跳帽连接时,当按下用户按键USER KEY时,观察开发板上 LD1、LD2、LD2 的运行效果,三个LED会顺序周期性交替闪烁
89+
下载程序成功之后,系统会自动运行,在JP5跳帽连接时,观察开发板上LD1的运行效果,黄色LED会周期性闪烁
9090

9191
连接开发板对应串口到 PC , 在终端工具里打开相应的串口(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息:
9292

bsp/stm32/stm32f413-st-nucleo/applications/main.c

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,36 +26,12 @@ int main(void)
2626
int count = 1;
2727
/* set LED1 pin mode to output */
2828
rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
29-
/* set LED2 pin mode to output */
30-
rt_pin_mode(LED2_PIN, PIN_MODE_OUTPUT);
31-
/* set LED3 pin mode to output */
32-
rt_pin_mode(LED3_PIN, PIN_MODE_OUTPUT);
33-
/* set USER KEY pin mode to input */
34-
rt_pin_mode(KEY_PIN, PIN_MODE_INPUT_PULLDOWN);
3529

3630
while (count++)
3731
{
38-
if(rt_pin_read(KEY_PIN))
39-
{
40-
rt_pin_write(LED1_PIN, PIN_HIGH);
41-
rt_pin_write(LED2_PIN, PIN_LOW);
42-
rt_pin_write(LED3_PIN, PIN_LOW);
43-
rt_thread_mdelay(500);
44-
rt_pin_write(LED1_PIN, PIN_LOW);
45-
rt_pin_write(LED2_PIN, PIN_HIGH);
46-
rt_pin_write(LED3_PIN, PIN_LOW);
47-
rt_thread_mdelay(500);
48-
rt_pin_write(LED1_PIN, PIN_LOW);
49-
rt_pin_write(LED2_PIN, PIN_LOW);
50-
rt_pin_write(LED3_PIN, PIN_HIGH);
51-
rt_thread_mdelay(500);
52-
}
53-
else
54-
{
55-
rt_pin_write(LED1_PIN, PIN_LOW);
56-
rt_pin_write(LED2_PIN, PIN_LOW);
57-
rt_pin_write(LED3_PIN, PIN_LOW);
58-
}
32+
rt_pin_write(LED1_PIN, PIN_HIGH);
33+
rt_thread_mdelay(500);
34+
rt_pin_write(LED1_PIN, PIN_LOW);
5935
}
6036

6137
return RT_EOK;

0 commit comments

Comments
 (0)