任务通知

任务通知
configUSE_TASK_NOTIFICATIONS=1//开启
ulNotifiedValue
任务通知只有一个任务
接收任务会进入阻塞,发送任务不会因发送失败而进入阻塞
发送任务通知
xTaskNotify()//ulValue
xTaskNotifyGive()//xTaskToNotify The handle of the task being notified
xTaskNotifyAndQuery()//pulPreviousNotificationValue被修改前的值

ulTaskNotifyTake()//获取任务通知
xClearCountOnExit=pdFALSE,通知值减1
xClearCountOnExit!=pdFALSE通知值为0
xTicksToWait;在阻塞态的最大时间,任务通知值大于0
xTaskNotifyWait()//获取
ulBitsToClearOnEntry:任务检查是否通知被挂起,在调用任务的通知值,bits会清除,
设置为ULONG_MAX,置通知值为0
设置为0,通知值不变
ulBitsToClearOnExit:
当函数退出时
设置为ULONG_MAX,置通知值为0
设置为0,通知值不变
pulNotificationValue:
xTicksToWait//阻塞时间

typedef enum
{
	eNoAction = 0,				/* Notify the task without updating its notify value. */
	eSetBits,					/* Set bits in the task's notification value. */
	eIncrement,					/* Increment the task's notification value. */
	eSetValueWithOverwrite,		/* Set the task's notification value to a specific value even if the previous value has not yet been read by the task. */
	eSetValueWithoutOverwrite	/* Set the task's notification value if the previous value has been read by the task. */
} eNotifyAction;

#define taskNOT_WAITING_NOTIFICATION	( ( uint8_t ) 0 )
#define taskWAITING_NOTIFICATION		( ( uint8_t ) 1 )
#define taskNOTIFICATION_RECEIVED		( ( uint8_t ) 2 )

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章