main.c 756 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021-03-17 supperthomas first version
  9. */
  10. #include "drivers/dev_pin.h"
  11. #include <rtthread.h>
  12. #include <rtdevice.h>
  13. #include <board.h>
  14. /* defined the LED0 pin: PO1 */
  15. #define LED_RED_PIN GET_PIN(O, 1)
  16. #define LED_BLUE_PIN GET_PIN(O, 5)
  17. int main(void)
  18. {
  19. rt_pin_mode(LED_RED_PIN, PIN_MODE_OUTPUT);
  20. rt_pin_mode(LED_BLUE_PIN, PIN_MODE_OUTPUT);
  21. rt_pin_write(LED_BLUE_PIN, PIN_HIGH);
  22. while(1)
  23. {
  24. rt_thread_mdelay(500);
  25. rt_pin_write(LED_RED_PIN, PIN_HIGH);
  26. rt_thread_mdelay(500);
  27. rt_pin_write(LED_RED_PIN, PIN_LOW);
  28. }
  29. return RT_EOK;
  30. }