📄 idle.c.svn-base
字号:
/* * File : idle.c * This file is part of RT-Thread RTOS * COPYRIGHT (C) 2006, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.fayfayspace.org/license/LICENSE. * * Change Logs: * Date Author Notes * 2006-03-23 Bernard the first version */#include <rtthread.h>/** * @addtogroup Kernel */static struct rt_thread idle;static void (*rt_thread_idle_hook)();static rt_uint8 rt_thread_stack[256];static void rt_thread_idle_entry(void* parameter){ while (1) { /* if there is an idle thread hook */ if (rt_thread_idle_hook != RT_NULL) { rt_thread_idle_hook(); } /* nothing */ ; }}/*@{*//** * @brief init idle thread * * this function will initialize idle thread, then start it. * * @note this function must be invoked when system init. */void rt_thread_idle_init(){ /* init thread */ rt_thread_init(&idle, "tidle", rt_thread_idle_entry, RT_NULL, &rt_thread_stack[0], sizeof(rt_thread_stack), RT_THREAD_PRIORITY_MAX - 1, 64); /* startup */ rt_thread_startup(&idle);}/** * @brief set idle hook * * this function will set a hook function to idle thread loop. * * @param hook the specified hook function * * @note the hook function must be simple and never be blocked or suspend. */void rt_thread_idle_sethook(void (*hook)()){ rt_thread_idle_hook = hook;}/*@}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -