err = rt_event_recv(&evt,EVT_RUN,RT_EVENT_FLAG_OR|RT_EVENT_FLAG_CLEAR,RT_WAITING_FOREVER,&...
rt_kprintf("thread1: OR recv event 0x%x\n", e); } rt_kprintf("thread1: delay 1s to prepare the second event\n"); rt_thread_mdelay(1000); /* 第二次接收事件,事件3和事件5均发生时才可以触发线程1,接收完后清除事件标志 */ if (rt_event_recv(&event, (EVENT_FLAG3 | EVENT_FLAG...
if(rt_event_recv(&event,(EVENT_FLAG3|EVENT_FLAG5),RT_EVENT_FLAG_AND|RT_EVENT_FLAG_CLEAR,RT_WAITING_FOREVER,&e)==RT_EOK){// TO DO SOMETHING} EVENT_FLAG3和EVENT_FLAG5可以是一个thread设置: voidthread_1_entry(){rt_event_send(&event,EVENT_FLAG3|EVENT_FLAG5);} 也可以是两个thread分...
rt_mutex_release rt_event_recv rt_mb_send_wait rt_mb_recv rt_mq_send_wait rt_mq_recv 线程操作类 登录后复制rt_thread_detach rt_thread_delete rt_thread_yield rt_thread_delay rt_thread_delay_until rt_thread_mdelay rt_thread_suspend rt_thread_resume 其它 登录后复制rt_tick_get rt_enter_c...
* @param recved the received event, if you don't care, RT_NULL can be set. * * @return the error code */ rt_err_t rt_event_recv(rt_event_t event, rt_uint32_t set, rt_uint8_t option, rt_int32_t timeout, rt_uint32_t *recved) ...
rt_err_t rt_event_recv(rt_event_t event, rt_uint32_t set, rt_uint8_t option, rt_int32_t timeout, rt_uint32_t *recved) 1. 2. 3. 4. 5. 调用这个函数时,系统首先根据set参数和接收选项option来判断它要接收的事件是否发生了。
3.初始化事件:rt_sem_init(rt_event_t event, const char *name, rt_uint8_t flag); 4.脱离事件:rt_sem_detach(rt_sem_t sem); 5.发送事件:rt_err_t rt_event_send(rt_event_t event, rt_uint32_t set); 6.接收事件:rt_err_t rt_event_recv(rt_event_t event,rt_uint32_t set,rt_ui...
rt_event_recv(ev, clear, RT_EVENT_AND_CLEAR, set, RT_W本人TING_FOREVER); ``` 3. 等待事件集标志位 使用rt_event_recv函数可以等待事件集的指定标志位,示例代码如下: ```c rt_uint32_t w本人t = 0x01; // 要等待的标志位 rt_event_recv(ev, w本人t, RT_EVENT_AND, set, RT_W本人TING...
rt_err_t rt_event_recv(rt_event_tevent,//事件对象的句柄rt_uint32_tset,//接收线程感兴趣的事件rt_uint8_t option,//接收选项rt_int32_t timeout,//指定超时时间rt_uint32_t*recved);//指向收到的事件内核使用32位的无符号整型数来标识事件,它的每一位代表一个事件,因此一个事件对象可同时等待接收...
11 /* wait for wakeup event */ 12 if (rt_event_recv(wakeup_event, 13 WAKEUP_EVENT_BUTTON, 14 RT_EVENT_FLAG_AND | RT_EVENT_FLAG_CLEAR, 15 RT_WAITING_FOREVER, RT_NULL) == RT_EOK) 16 { 17 led_app(); 18 } 19 } 20}