main.c 975 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-02-22 airm2m first version
  9. */
  10. #include <rtthread.h>
  11. #include <rtdevice.h>
  12. #include <board.h>
  13. /* defined the LED0 pin: PB2 */
  14. #define LED0_PIN GET_PIN(B, 2)
  15. int main(void)
  16. {
  17. RCC_ClocksTypeDef clocks;
  18. RCC_GetClocksFreq(&clocks);
  19. rt_kprintf("SYSCLK: %dMhz, \nHCLK: %dMhz, \nPCLK1: %dMhz, \nPCLK2: %dMhz, \nADCCLK: %dMhz\n",
  20. clocks.SYSCLK_Frequency / 1000000, clocks.HCLK_Frequency / 1000000,
  21. clocks.PCLK1_Frequency / 1000000, clocks.PCLK2_Frequency / 1000000, clocks.ADCCLK_Frequency / 1000000);
  22. /* set LED0 pin mode to output */
  23. rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
  24. while (1)
  25. {
  26. rt_pin_write(LED0_PIN, PIN_HIGH);
  27. rt_thread_mdelay(500);
  28. rt_pin_write(LED0_PIN, PIN_LOW);
  29. rt_thread_mdelay(500);
  30. }
  31. }