main.c 876 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**************************************************************************//**
  2. *
  3. * @copyright (C) 2019 Nuvoton Technology Corp. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0
  6. *
  7. * Change Logs:
  8. * Date Author Notes
  9. * 2020-1-16 Wayne First version
  10. *
  11. ******************************************************************************/
  12. #include <rtconfig.h>
  13. #include <rtdevice.h>
  14. #include <drv_gpio.h>
  15. /* defined the LEDR pin: PH0 */
  16. #define LEDR NU_GET_PININDEX(NU_PH, 0)
  17. int main(int argc, char **argv)
  18. {
  19. #if defined(RT_USING_PIN)
  20. int counter = 0;
  21. /* set LEDR1 pin mode to output */
  22. rt_pin_mode(LEDR, PIN_MODE_OUTPUT);
  23. while (counter++ < 10)
  24. {
  25. rt_pin_write(LEDR, PIN_HIGH);
  26. rt_thread_mdelay(500);
  27. rt_pin_write(LEDR, PIN_LOW);
  28. rt_thread_mdelay(500);
  29. }
  30. #endif
  31. return 0;
  32. }