main.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. * 2021-6-1 Wayne First version
  10. *
  11. ******************************************************************************/
  12. #include <rtthread.h>
  13. #include <rtdevice.h>
  14. #include "drv_common.h"
  15. #if defined(RT_USING_PIN)
  16. #include "drv_gpio.h"
  17. /* defined the LED_0 pin: PJ14 */
  18. #define LED_0 NU_GET_PININDEX(NU_PJ, 14)
  19. int main(int argc, char **argv)
  20. {
  21. int counter = 10000;
  22. /* set LED_0 pin mode to output */
  23. rt_pin_mode(LED_0, PIN_MODE_OUTPUT);
  24. while (counter--)
  25. {
  26. rt_pin_write(LED_0, PIN_HIGH);
  27. rt_thread_mdelay(100);
  28. rt_pin_write(LED_0, PIN_LOW);
  29. rt_thread_mdelay(100);
  30. }
  31. return 0;
  32. }
  33. #else
  34. int main(int argc, char **argv)
  35. {
  36. rt_kprintf("cpu-%d %d\r\n", rt_hw_cpu_id(), nu_cpu_dcache_line_size());
  37. return 0;
  38. }
  39. #endif