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
This commit is contained in:
XYX12306 2020-06-08 00:02:33 +08:00
parent 29a0dde714
commit a2517e4cb5
2 changed files with 5 additions and 29 deletions

View File

@ -24,7 +24,7 @@
- MCUSTM32F413ZH主频 100MHz1536KB FLASH 320KB RAM
- 常用外设
- LED8个user LED [SB2跳帽需连接](黄色PB0LD1蓝色PB7LD2红色PB14LD3), USB communication (LD4), over current (LD5), power LED (黄色LD6), USB FAULT (LD7), VBUS (LD8)。
- LED8个user LED (JP5跳帽需连接)(黄色PB0LD1蓝色PB7LD2红色PB14LD3), USB communication (LD4), over current (LD5), power LED (黄色LD6), USB FAULT (LD7), VBUS (LD8)。
- 按键2个B1USERPC13B2RESET
- 常用接口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 的输出信息:

View File

@ -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;