main.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (C) 2020, Huada Semiconductor Co., Ltd.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2020-10-30 CDT first version
  9. */
  10. /*******************************************************************************
  11. * Include files
  12. ******************************************************************************/
  13. #include "hc32_ddl.h"
  14. #include "board.h"
  15. #include <rtthread.h>
  16. #include <rtdevice.h>
  17. /*******************************************************************************
  18. * Local type definitions ('typedef')
  19. ******************************************************************************/
  20. /*******************************************************************************
  21. * Local pre-processor symbols/macros ('#define')
  22. ******************************************************************************/
  23. /* defined the LED pin: PC9 */
  24. #define LED_PIN (41)
  25. #define DELAY_MS (RT_TICK_PER_SECOND) /* 1s */
  26. /*******************************************************************************
  27. * Global variable definitions (declared in header file with 'extern')
  28. ******************************************************************************/
  29. /*******************************************************************************
  30. * Local function prototypes ('static')
  31. ******************************************************************************/
  32. /*******************************************************************************
  33. * Local variable definitions ('static')
  34. ******************************************************************************/
  35. /*******************************************************************************
  36. * Function implementation - global ('extern') and local ('static')
  37. ******************************************************************************/
  38. /**
  39. *******************************************************************************
  40. ** \brief Main function of GPIO output
  41. **
  42. ** \param None
  43. **
  44. ** \retval int32_t Return value, if needed
  45. **
  46. ******************************************************************************/
  47. int32_t main(void)
  48. {
  49. rt_kprintf("Os is Start!!! \n");
  50. while(1)
  51. {
  52. rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT);
  53. rt_pin_write(LED_PIN, PIN_HIGH);
  54. rt_thread_delay(DELAY_MS);
  55. rt_pin_write(LED_PIN, PIN_LOW);
  56. rt_thread_delay(DELAY_MS);
  57. };
  58. }
  59. /*******************************************************************************
  60. * EOF (not truncated)
  61. ******************************************************************************/