代码拉取完成,页面将自动刷新
#include <stdio.h>
#include "xos.h"
void led_init(void)
{
int a = 0;
printf("[%s] %d: a=%d\r\n", __func__, __LINE__, a);
}
device_initcall(led_init);
void led_task_cb(void* arg, uint32_t event)
{
int a = 0;
// printf("[%s] %d: a=%d\r\n", __func__, __LINE__, a);
}
void timer_task_cb(void* arg, uint32_t event)
{
int a = 0;
printf("[%s] %d: a=%d\r\n", __func__, __LINE__, a);
}
void key_task_cb(void* arg, uint32_t event)
{
int a = 0;
// printf("[%s] %d: a=%d\r\n", __func__, __LINE__, a);
}
void xos_demo(void)
{
// 普通任务创建
static task_t task_led = {
.func = led_task_cb,
.mode = TASK_LOOP,
};
xos_task_add(&task_led);
xos_task_start(&task_led);
printf("[%s] %d: task_led=%x\r\n", __func__, __LINE__, &task_led);
// 定时任务创建
static task_t task_timer = {
.func = timer_task_cb,
.mode = TASK_REPEAT,
.period = 500,
};
xos_task_add(&task_timer);
xos_task_start(&task_timer);
printf("[%s] %d: task_timer=%x\r\n", __func__, __LINE__, &task_timer);
// key定时任务创建
static task_t task_key = {
.func = key_task_cb,
.mode = TASK_REPEAT,
.period = 5,
};
xos_task_add(&task_key);
xos_task_start(&task_key);
printf("[%s] %d: task_key=%x\r\n", __func__, __LINE__, &task_key);
printf("[%s] %d: \r\n", __func__, __LINE__);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。