main.c 829 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2006-2018, 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. */
  10. #include <rtthread.h>
  11. #include <rtdevice.h>
  12. #include <board.h>
  13. /* defined the LED1 pin: PB0 */
  14. #define LED1_PIN GET_PIN(B, 0)
  15. /* defined the LED2 pin: PB7 */
  16. #define LED2_PIN GET_PIN(B, 7)
  17. /* defined the LED3 pin: PB14 */
  18. #define LED3_PIN GET_PIN(B, 14)
  19. /* defined the USER KEY pin: PC13 */
  20. #define KEY_PIN GET_PIN(C, 13)
  21. int main(void)
  22. {
  23. int count = 1;
  24. /* set LED1 pin mode to output */
  25. rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
  26. while (count++)
  27. {
  28. rt_pin_write(LED1_PIN, PIN_HIGH);
  29. rt_thread_mdelay(500);
  30. rt_pin_write(LED1_PIN, PIN_LOW);
  31. }
  32. return RT_EOK;
  33. }