summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2022-09-19 23:43:20 -0400
committerMan, Jianting (Meco) <[email protected]>2022-09-20 10:33:12 -0400
commit560166477ea85b0845713aa86be156084fefdbb2 (patch)
tree65c6b12d6e1dd4b37ab087228aa21c5073e3f735
parentf71a287a68f33ce086c8cd0db6bfd85a3f53d632 (diff)
[stm32f401 nucleo] update main.c revert blinking LED
-rw-r--r--bsp/stm32/stm32f401-st-nucleo/applications/main.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/bsp/stm32/stm32f401-st-nucleo/applications/main.c b/bsp/stm32/stm32f401-st-nucleo/applications/main.c
index ec1936eb15..36a52e02a8 100644
--- a/bsp/stm32/stm32f401-st-nucleo/applications/main.c
+++ b/bsp/stm32/stm32f401-st-nucleo/applications/main.c
@@ -6,16 +6,25 @@
* Change Logs:
* Date Author Notes
* 2018-11-06 SummerGift first version
- * 2022-04-19 Meco Man solve LED interferes with SPI
*/
#include <rtthread.h>
+#include <rtdevice.h>
+#include <board.h>
+
+/* defined the LD2 (user LED) pin: PB1 */
+#define LED2_PIN GET_PIN(A, 5)
int main(void)
{
+ /* set LED0 pin mode to output */
+ rt_pin_mode(LED2_PIN, PIN_MODE_OUTPUT);
+
while (1)
{
- rt_kprintf("Hello RT-Thread!\n");
- rt_thread_mdelay(1000);
+ rt_pin_write(LED2_PIN, PIN_HIGH);
+ rt_thread_mdelay(500);
+ rt_pin_write(LED2_PIN, PIN_LOW);
+ rt_thread_mdelay(500);
}
}