main.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2017-2019, MindMotion AE Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2019-03-13 henryhuang first version
  9. */
  10. #include <rtthread.h>
  11. #include <rtdevice.h>
  12. #include "HAL_device.h"
  13. /********************************************************************************************************
  14. * led_init(void)
  15. ********************************************************************************************************/
  16. void led_init(void)
  17. {
  18. GPIO_InitTypeDef GPIO_InitStructure;
  19. RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
  20. GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
  21. GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  22. GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  23. GPIO_Init(GPIOA, &GPIO_InitStructure);
  24. }
  25. int main(void)
  26. {
  27. int count = 1;
  28. led_init();
  29. while (count++)
  30. {
  31. GPIO_SetBits(GPIOA, GPIO_Pin_15);
  32. rt_thread_mdelay(500);
  33. GPIO_ResetBits(GPIOA, GPIO_Pin_15);
  34. rt_thread_mdelay(500);
  35. }
  36. return RT_EOK;
  37. }