summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXYX12306 <[email protected]>2020-06-08 00:02:33 +0800
committerXYX12306 <[email protected]>2020-06-08 00:02:33 +0800
commita2517e4cb5f8c0ea4237221cde69ccfa2e476e80 (patch)
tree35a68a1cdd473f6e8e7914f8754e809ff995bf7d
parent29a0dde7142dc4f612ab3a3c83c44f868f934269 (diff)
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
-rw-r--r--bsp/stm32/stm32f413-st-nucleo/README.md4
-rw-r--r--bsp/stm32/stm32f413-st-nucleo/applications/main.c30
2 files changed, 5 insertions, 29 deletions
diff --git a/bsp/stm32/stm32f413-st-nucleo/README.md b/bsp/stm32/stm32f413-st-nucleo/README.md
index c10c01a879..5461ff7ba9 100644
--- a/bsp/stm32/stm32f413-st-nucleo/README.md
+++ b/bsp/stm32/stm32f413-st-nucleo/README.md
@@ -24,7 +24,7 @@
- MCU:STM32F413ZH,主频 100MHz,1536KB FLASH ,320KB RAM
- 常用外设
- - 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)。
+ - 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)。
- 按键:2个,B1(USER,PC13),B2(RESET)
- 常用接口:USB 支持 3 种不同接口:虚拟 COM 端口、大容量存储和调试端口等。
- 调试接口,板载 ST-LINK/V2-1 调试器。
@@ -86,7 +86,7 @@
#### 运行结果
-下载程序成功之后,系统会自动运行,在SB2跳帽连接时,当按下用户按键USER KEY时,观察开发板上 LD1、LD2、LD2 的运行效果,三个LED会顺序周期性交替闪烁。
+下载程序成功之后,系统会自动运行,在JP5跳帽连接时,观察开发板上LD1的运行效果,黄色LED会周期性闪烁。
连接开发板对应串口到 PC , 在终端工具里打开相应的串口(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息:
diff --git a/bsp/stm32/stm32f413-st-nucleo/applications/main.c b/bsp/stm32/stm32f413-st-nucleo/applications/main.c
index 089d629f1a..47f94085cb 100644
--- a/bsp/stm32/stm32f413-st-nucleo/applications/main.c
+++ b/bsp/stm32/stm32f413-st-nucleo/applications/main.c
@@ -26,36 +26,12 @@ int main(void)
int count = 1;
/* set LED1 pin mode to output */
rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
- /* set LED2 pin mode to output */
- rt_pin_mode(LED2_PIN, PIN_MODE_OUTPUT);
- /* set LED3 pin mode to output */
- rt_pin_mode(LED3_PIN, PIN_MODE_OUTPUT);
- /* set USER KEY pin mode to input */
- rt_pin_mode(KEY_PIN, PIN_MODE_INPUT_PULLDOWN);
while (count++)
{
- if(rt_pin_read(KEY_PIN))
- {
- rt_pin_write(LED1_PIN, PIN_HIGH);
- rt_pin_write(LED2_PIN, PIN_LOW);
- rt_pin_write(LED3_PIN, PIN_LOW);
- rt_thread_mdelay(500);
- rt_pin_write(LED1_PIN, PIN_LOW);
- rt_pin_write(LED2_PIN, PIN_HIGH);
- rt_pin_write(LED3_PIN, PIN_LOW);
- rt_thread_mdelay(500);
- rt_pin_write(LED1_PIN, PIN_LOW);
- rt_pin_write(LED2_PIN, PIN_LOW);
- rt_pin_write(LED3_PIN, PIN_HIGH);
- rt_thread_mdelay(500);
- }
- else
- {
- rt_pin_write(LED1_PIN, PIN_LOW);
- rt_pin_write(LED2_PIN, PIN_LOW);
- rt_pin_write(LED3_PIN, PIN_LOW);
- }
+ rt_pin_write(LED1_PIN, PIN_HIGH);
+ rt_thread_mdelay(500);
+ rt_pin_write(LED1_PIN, PIN_LOW);
}
return RT_EOK;