#include "event_groups.h"
void StartTask02(void *argument)
{
/* USER CODE BEGIN StartTask02 */
/* Infinite loop */
/*事件组位置位*************************************************************/
xEventGroupSetBits(myEvent01Handle, 0x01<<0);// 0001 1
xEventGroupSetBits(myEvent01Handle, 0x01<<1);// 0011 3
for(;;)
{
/*获得标志位清零1************************************************************/
EventBits_t curBit0 = xEventGroupClearBits(myEvent01Handle,0x01<<0);//0011
EventBits_t curBit1 = xEventGroupClearBits(myEvent01Handle,0x01<<1);//0010
if(curBit0&0x01<<0)
{
printf("curBit0:%d\r\n",curBit0&0x01<<0);//1
}
if(curBit1&0x01<<1)
{
printf("curBit1:%d\r\n",curBit1&0x01<<1);//2
}
/*获得标志位清零2************************************************************/
if(xEventGroupClearBits(myEvent01Handle,0x01<<0)&0x01<<0)
{
printf("curBit0:%d\r\n",xEventGroupClearBits(myEvent01Handle,0x01<<0)&0x01<<0);
}
if(xEventGroupClearBits(myEvent01Handle,0x01<<1)&0x01<<1)
{
printf("curBit1:%d\r\n",xEventGroupClearBits(myEvent01Handle,0x01<<1)&0x01<<1);
}
/*获得标志位不清零*************************************************************/
if(xEventGroupGetBits(myEvent01Handle)&0x01<<0)
{
printf("curBit0:%d\r\n",xEventGroupGetBits(myEvent01Handle)&0x01<<0);//0
}
if(xEventGroupGetBits(myEvent01Handle)&0x01<<1)
{
printf("curBit1:%d\r\n",xEventGroupGetBits(myEvent01Handle)&0x01<<1);//0
}
vTaskDelay(1);
}
/* USER CODE END StartTask02 */
}
xEventGroupWaitBits(SerialEventHandle, \
0x01<<0, \
pdFALSE, \ //pdF退出时不清零
pdTRUE, \ //pdT与
portMAX_DELAY);