main.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) 2006-2023, 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 "dfs_fs.h"
  16. #include "drv_pin.h"
  17. /* defined the LED pin: GPIO1_IO4 */
  18. /* GPIO1_4 is Blue LED */
  19. #define LEDB_PIN GET_PINS(1, 4)
  20. int main(void)
  21. {
  22. #if defined(__CC_ARM)
  23. rt_kprintf("using armcc, version: %d\n", __ARMCC_VERSION);
  24. #elif defined(__clang__)
  25. rt_kprintf("using armclang, version: %d\n", __ARMCC_VERSION);
  26. #elif defined(__ICCARM__)
  27. rt_kprintf("using iccarm, version: %d\n", __VER__);
  28. #elif defined(__GNUC__)
  29. rt_kprintf("using gcc, version: %d.%d\n", __GNUC__, __GNUC_MINOR__);
  30. #endif
  31. rt_pin_mode(LEDB_PIN, PIN_MODE_OUTPUT); /* Set GPIO as Output */
  32. #ifdef RT_USING_SDIO
  33. rt_thread_mdelay(2000);
  34. if (dfs_mount("sd", "/", "elm", 0, NULL) == 0)
  35. {
  36. rt_kprintf("sd mounted to /\n");
  37. }
  38. else
  39. {
  40. rt_kprintf("sd mount to / failed\n");
  41. }
  42. #endif
  43. while (1)
  44. {
  45. rt_pin_write(LEDB_PIN, PIN_HIGH); /* Set GPIO output 1 */
  46. rt_thread_mdelay(500); /* Delay 500mS */
  47. rt_pin_write(LEDB_PIN, PIN_LOW); /* Set GPIO output 0 */
  48. rt_thread_mdelay(500); /* Delay 500mS */
  49. }
  50. }
  51. // end file