main.c 938 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2018-11-06 SummerGift first version
  9. * 2023-12-03 Meco Man support nano version
  10. */
  11. #include <board.h>
  12. #include <rtthread.h>
  13. #include <drv_gpio.h>
  14. #ifndef RT_USING_NANO
  15. #include <rtdevice.h>
  16. #endif /* RT_USING_NANO */
  17. /* defined the LED1 pin: PB0 */
  18. #define LED1_PIN GET_PIN(B, 0)
  19. /* defined the LED2 pin: PB7 */
  20. #define LED2_PIN GET_PIN(B, 7)
  21. /* defined the LED3 pin: PB14 */
  22. #define LED3_PIN GET_PIN(B, 14)
  23. /* defined the USER KEY pin: PC13 */
  24. #define KEY_PIN GET_PIN(C, 13)
  25. int main(void)
  26. {
  27. /* set LED1 pin mode to output */
  28. rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
  29. while (1)
  30. {
  31. rt_pin_write(LED1_PIN, PIN_HIGH);
  32. rt_thread_mdelay(500);
  33. rt_pin_write(LED1_PIN, PIN_LOW);
  34. rt_thread_mdelay(500);
  35. }
  36. }