main.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /******************************************************************************
  2. * Copyright (C) 2021, Xiaohua Semiconductor Co., Ltd. All rights reserved.
  3. *
  4. * This software component is licensed by XHSC under BSD 3-Clause license
  5. * (the "License"); You may not use this file except in compliance with the
  6. * License. You may obtain a copy of the License at:
  7. * opensource.org/licenses/BSD-3-Clause
  8. *
  9. ******************************************************************************/
  10. /******************************************************************************
  11. ** @file main.c
  12. **
  13. ** @brief Source file for MAIN functions
  14. **
  15. ** @author MADS Team
  16. **
  17. ******************************************************************************/
  18. /******************************************************************************
  19. * Include files
  20. ******************************************************************************/
  21. #include <stdlib.h>
  22. #include "flash.h"
  23. #include "multi_button.h"
  24. #include "lpuart.h"
  25. #include "uart.h"
  26. #include "board_spi.h"
  27. #include "board_gpio.h"
  28. #include "board_timer.h"
  29. #include "board_uart.h"
  30. #include "board_syclk.h"
  31. #include "key_app.h"
  32. #include "rf_app.h"
  33. #include "board_config.h"
  34. extern void board_rf_pan3120_init(void);
  35. extern void board_rf_pan3120_task(void);
  36. /**
  37. ******************************************************************************
  38. ** \brief Main function of project
  39. **
  40. ** \return uint32_t return value, if needed
  41. **
  42. ******************************************************************************/
  43. int32_t main(void)
  44. {
  45. board_sysclkInit();//时钟初始化配置
  46. board_Rch4MHzTo24MHz();//主频切换为24Mz
  47. SysTick_Config(SystemCoreClock/1000);//滴答时钟配置为1ms
  48. board_GpioInit();//gpio初始化
  49. board_spi_int();//spi初始化
  50. board_lpuart_config();//串口初始化
  51. board_Timer1Cfg(60000);// Timer1配置周期为 60000*(1/24)*2 = 5000us=5ms
  52. multibutton_init();//按键功能
  53. board_rf_pan3120_init();//PAN3120初始
  54. while(1)
  55. {
  56. board_rf_pan3120_task();
  57. }
  58. }
  59. /******************************************************************************
  60. * EOF (not truncated)
  61. ******************************************************************************/