main.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (c) 2006-2024, RT-Thread Development Team
  3. * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0
  6. *
  7. * Change Logs:
  8. * Date Author Notes
  9. * 2019-10-24 Magicoe first version
  10. * 2020-01-10 Kevin/Karl Add PS demo
  11. * 2020-09-21 supperthomas fix the main.c
  12. *
  13. */
  14. #include <rtdevice.h>
  15. #include "drv_pin.h"
  16. #define LEDB_PIN ((3*32)+4)
  17. #define BUTTON_PIN ((0*32)+29)
  18. #include "fsl_lpuart.h"
  19. int main(void)
  20. {
  21. #if defined(__CC_ARM)
  22. rt_kprintf("using armcc, version: %d\n", __ARMCC_VERSION);
  23. #elif defined(__clang__)
  24. rt_kprintf("using armclang, version: %d\n", __ARMCC_VERSION);
  25. #elif defined(__ICCARM__)
  26. rt_kprintf("using iccarm, version: %d\n", __VER__);
  27. #elif defined(__GNUC__)
  28. rt_kprintf("using gcc, version: %d.%d\n", __GNUC__, __GNUC_MINOR__);
  29. #endif
  30. rt_pin_mode(LEDB_PIN, PIN_MODE_OUTPUT); /* Set GPIO as Output */
  31. rt_pin_mode(BUTTON_PIN, PIN_MODE_INPUT_PULLUP);
  32. rt_kprintf("MCXN947 HelloWorld\r\n");
  33. #ifdef RT_USING_SDIO
  34. rt_thread_mdelay(2000);
  35. if (dfs_mount("sd", "/", "elm", 0, NULL) == 0)
  36. {
  37. rt_kprintf("sd mounted to /\n");
  38. }
  39. else
  40. {
  41. rt_kprintf("sd mount to / failed\n");
  42. }
  43. #endif
  44. while (1)
  45. {
  46. rt_pin_write(LEDB_PIN, PIN_HIGH); /* Set GPIO output 1 */
  47. rt_thread_mdelay(500); /* Delay 500mS */
  48. rt_pin_write(LEDB_PIN, PIN_LOW); /* Set GPIO output 0 */
  49. rt_thread_mdelay(500); /* Delay 500mS */
  50. }
  51. }
  52. // end file