application.c

来自「RT-Thread是发展中的下一代微内核嵌入式实时操作系统」· C语言 代码 · 共 43 行

C
43
字号
/*
 * File      : app.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-10-25     Bernard      the first version
 */
#include <rtthread.h>

static unsigned char thread_stack[1024];
struct rt_thread thread;
void thread_entry(void* parameter)
{
	rt_uint32 index = 0;
	
	while (1)
	{
		rt_thread_delay(100);
		
		rt_kprintf("Index = %d\n", index ++);
	}
}

/* application start function */
int rt_application_init()
{
	rt_thread_init(&thread,
		"thread",
		thread_entry, RT_NULL,
		&thread_stack[0], sizeof(thread_stack),
		200, 100);
	
	rt_thread_startup(&thread);
	
	return 0;	/* empty */
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?