MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / pm_run_main

Function pm_run_main

bsp/hc32/tests/test_pm.c:354–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352
353#if defined(HC32F4A0) || defined(HC32F460) || defined(HC32F448) || defined(HC32F4A8)
354static void pm_run_main(void *parameter)
355{
356 static rt_uint8_t run_index = 0;
357 char *speed[] = {"low", "high"};
358 const rt_uint8_t run_mode[] = {PM_RUN_MODE_LOW_SPEED, PM_RUN_MODE_HIGH_SPEED};
359
360 GPIO_SetFunc(MCO_PORT, MCO_PIN, MCO_GPIO_FUNC);
361 /* Configure clock output system clock */
362 CLK_MCOConfig(CLK_MCO1, CLK_MCO_SRC_HCLK, CLK_MCO_DIV8);
363 /* MCO1 output enable */
364 CLK_MCOCmd(CLK_MCO1, ENABLE);
365
366 while (1)
367 {
368 rt_pm_run_enter(run_mode[run_index]);
369
370 rt_thread_mdelay(100);
371
372 rt_kprintf("system clock switch to %s speed\n\n", speed[run_index]);
373 if (++run_index >= ARRAY_SZ(run_mode))
374 {
375 run_index = 0;
376 }
377
378 rt_thread_mdelay(3000);
379 }
380}
381#endif
382
383static void _keycnt_cmd_init_after_power_on(void)

Callers

nothing calls this directly

Calls 3

rt_pm_run_enterFunction · 0.85
rt_thread_mdelayFunction · 0.85
rt_kprintfFunction · 0.85

Tested by

no test coverage detected