1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- /********************** 头文件 *************************/
- #include "main.h"
- /********************** 变量区 *************************/
- /********************** 函数声明区 *************************/
- /********************** 系统函数区 *************************/
- void clocks_start( void )
- {
- NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
- NRF_CLOCK->TASKS_HFCLKSTART = 1;
- while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);
- }
- void FPS_process(void)
- {
- #if DEBUG_FPS
- static uint32_t tim=0;
- static uint32_t fps=0;
- static uint32_t fps_max=0;
-
- fps = TIME_GetTicks()-fps;
- if(fps_max<fps) fps_max = fps;
- fps = TIME_GetTicks();
-
- if(TIME_GetTicks()-tim>=1000){ tim = TIME_GetTicks();
- SEGGER_RTT_printf(0,"fps=%d\rms\n",fps_max);
- fps_max = 0;
- }
- #endif
- }
- /********************** 主函数 *************************/
- int main(void)
- {
- clocks_start();
- #if DEBUG_EN
- ret_code_t err_code;
- err_code = NRF_LOG_INIT(NULL);
- APP_ERROR_CHECK(err_code);
- NRF_LOG_DEFAULT_BACKENDS_INIT();
- #endif
-
- USR_Init(); //用户初始化
- TIME_Init(); //滴答
-
- while (true)
- {
- USR_process(); //用户进程
- FPS_process();
- }
-
- }
|