当前位置: 首页>>代码示例>>C++>>正文


C++ xEventGroupSetBits函数代码示例

本文整理汇总了C++中xEventGroupSetBits函数的典型用法代码示例。如果您正苦于以下问题:C++ xEventGroupSetBits函数的具体用法?C++ xEventGroupSetBits怎么用?C++ xEventGroupSetBits使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了xEventGroupSetBits函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: event_handler

static esp_err_t event_handler(void *ctx, system_event_t *event)
{
    switch(event->event_id) {
    case SYSTEM_EVENT_STA_START:
        esp_wifi_connect();
        break;
    case SYSTEM_EVENT_STA_DISCONNECTED:
        esp_wifi_connect();
        xEventGroupClearBits(tcp_event_group, WIFI_CONNECTED_BIT);
        break;
    case SYSTEM_EVENT_STA_CONNECTED:
        break;
    case SYSTEM_EVENT_STA_GOT_IP:
    	ESP_LOGI(TAG, "got ip:%s\n",
		ip4addr_ntoa(&event->event_info.got_ip.ip_info.ip));
    	xEventGroupSetBits(tcp_event_group, WIFI_CONNECTED_BIT);
        break;
    case SYSTEM_EVENT_AP_STACONNECTED:
    	ESP_LOGI(TAG, "station:"MACSTR" join,AID=%d\n",
		MAC2STR(event->event_info.sta_connected.mac),
		event->event_info.sta_connected.aid);
    	xEventGroupSetBits(tcp_event_group, WIFI_CONNECTED_BIT);
    	break;
    case SYSTEM_EVENT_AP_STADISCONNECTED:
    	ESP_LOGI(TAG, "station:"MACSTR"leave,AID=%d\n",
		MAC2STR(event->event_info.sta_disconnected.mac),
		event->event_info.sta_disconnected.aid);
    	xEventGroupClearBits(tcp_event_group, WIFI_CONNECTED_BIT);
    	break;
    default:
        break;
    }
    return ESP_OK;
}
开发者ID:Exchizz,项目名称:esp-idf,代码行数:34,代码来源:tcp_perf.c

示例2: SensorReading

void SensorReading(void *pvParams)
{
	uint8 buff[7];
	uint8 bfd[15];
	// Initialize timer, 1Hz period
	TickType_t readFrequency = 1000;
	TickType_t wakeUpTime = xTaskGetTickCount();

	// Sensor variables
	double Bfield[3];
	int tmp;

	while(1)
	{
		// Read magnetic field
		xEventGroupSetBits(torqueSignalEG, 1<<1);
		vTaskDelay(50);

		taskENTER_CRITICAL();

		/*buff[1] = i2cRegisterRead(4, 20);
		buff[2] = i2cRegisterRead(4, 21);
		buff[3] = i2cRegisterRead(4, 22);
		buff[4] = i2cRegisterRead(4, 23);
		buff[5] = i2cRegisterRead(4, 24);
		buff[6] = i2cRegisterRead(4, 25);*/

		taskEXIT_CRITICAL();

		Bfield[0] = ((double)((buff[1]<<8) + buff[2] - 32768))*((double)1.52587890625E-9);//0.00005/32768
		Bfield[1] = ((double)((buff[3]<<8) + buff[4] - 32768))*((double)1.52587890625E-9);
		Bfield[2] = ((double)((buff[5]<<8) + buff[6] - 32768))*((double)1.52587890625E-9);

		/*sprintf(bfd, "%.7f,", Bfield[0]);
		sciSend(scilinREG, 10, bfd);
		sprintf(bfd, "%.7f,", Bfield[1]);
		sciSend(scilinREG, 10, bfd);
		sprintf(bfd, "%.7f", Bfield[2]);
		sciSend(scilinREG, 10, bfd);
		bfd[0] = '\n';
		sciSend(scilinREG, 1, bfd);*/

		vTaskDelay(50);
		xEventGroupSetBits(torqueSignalEG, 1<<2);

		// Dispatch read values
		xQueueOverwrite(SensorDataQ, Bfield);

		vTaskDelayUntil(&wakeUpTime, readFrequency);
	}
}
开发者ID:jnemanja,项目名称:Aalto2_FreeRTOS,代码行数:51,代码来源:SensorReading.c

示例3: event_handler

esp_err_t event_handler(void *ctx, system_event_t *event)
{
	if (event->event_id == SYSTEM_EVENT_SCAN_DONE) {
		xEventGroupSetBits(wifi_event_group, SCAN_DONE_BIT);
	}
	return ESP_OK;
}
开发者ID:Nicholas3388,项目名称:LuaNode,代码行数:7,代码来源:app_main.c

示例4: ButtonHandler

void ButtonHandler(){
	uint32_t mask=GPIOIntStatus(GPIO_PORTF_BASE,false);

	uint8_t value=0;

	if(mask & GPIO_PIN_4){
		//Boton izquierdo
		value= GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_4);
		if(value==0){
			//boton pulsado
			// Activa el Timer4A (empezara a funcionar)
			TimerEnable(TIMER4_BASE, TIMER_A);
			pulsacionLarga=true;

		}else{
			TimerDisable(TIMER4_BASE,TIMER_A);

			if(pulsacionLarga){
				xEventGroupSetBits(xEventGroup, PilotoAutomaticoBit);
				if((xTaskCreate(PilAuto, (signed portCHAR *)"Piloto Auto", LED1TASKSTACKSIZE,NULL,tskIDLE_PRIORITY + 1, &PilautTaskHandle) != pdTRUE))
				{
					while(1);
				}
			}
		}

	}

	if(mask & GPIO_PIN_0){
		//boton derecho
		xEventGroupClearBits( xEventGroup, PilotoAutomaticoBit );
	}

	GPIOIntClear(GPIO_PORTF_BASE,GPIO_PIN_0|GPIO_PIN_4);
}
开发者ID:joseayebenes,项目名称:TivaFly,代码行数:35,代码来源:main.c

示例5: commandClearFlash

int commandClearFlash(uint8_t *buffer)
{
	uint8_t state = getProcessStatus();
	if( (state == 1) || (state == 3) )
		*buffer = 0x0E;
	else
	{
		EventBits_t flags = xEventGroupGetBits(xEventGroup);
		if( flags & FLAG_FLASH_CLEARING )
		{
			*buffer++ = 0x0d; //устройство занято
			*buffer = 0x04; //устройство зянято стиранием памяти
			return 7;
		}
		else
		{
			memset((void*)flashMap, 0xff, sizeof(flashMap));
			memset((void*)headerList, 0xff, sizeof(headerList));
			countProc = 0;
			spiChipErase();
			xEventGroupSetBits(xEventGroup, FLAG_FLASH_CLEARING);
			//стартуем таймер на 22 сек, после которого state сменим с 4 на 2.
			xTimerStart(timerClearFlash, 500);
		}
	}
	return 6;
}
开发者ID:juvf,项目名称:terem5,代码行数:27,代码来源:commandsRfd.cpp

示例6: prvExerciseEventGroupAPI

static void prvExerciseEventGroupAPI( void )
{
EventGroupHandle_t xEventGroup;
EventBits_t xBits;
const EventBits_t xBitsToWaitFor = ( EventBits_t ) 0xff, xBitToClear = ( EventBits_t ) 0x01;

	/* Exercise some event group functions. */
	xEventGroup = xEventGroupCreate();
	configASSERT( xEventGroup );

	/* No bits should be set. */
	xBits = xEventGroupWaitBits( xEventGroup, xBitsToWaitFor, pdTRUE, pdFALSE, mainDONT_BLOCK );
	configASSERT( xBits == ( EventBits_t ) 0 );

	/* Set bits and read back to ensure the bits were set. */
	xEventGroupSetBits( xEventGroup, xBitsToWaitFor );
	xBits = xEventGroupGetBits( xEventGroup );
	configASSERT( xBits == xBitsToWaitFor );

	/* Clear a bit and read back again using a different API function. */
	xEventGroupClearBits( xEventGroup, xBitToClear );
	xBits = xEventGroupSync( xEventGroup, 0x00, xBitsToWaitFor, mainDONT_BLOCK );
	configASSERT( xBits == ( xBitsToWaitFor & ~xBitToClear ) );

	/* Finished with the event group. */
	vEventGroupDelete( xEventGroup );
}
开发者ID:sean93park,项目名称:freertos,代码行数:27,代码来源:main.c

示例7: xEventGroupSetBits

dispatch_queue::~dispatch_queue()
{
	BaseType_t status;

	// Signal to dispatch threads that it's time to wrap up
	quit_ = true;

	// We will join each thread to confirm exiting
	for (size_t i = 0; i < threads_.size(); ++i) {
		eTaskState state;

		do {
			// Signal wake - check exit flag
			xEventGroupSetBits(notify_flags_, DISPATCH_WAKE_EVT);

			// Wait until a thread signals exit. Timeout is acceptable.
			xEventGroupWaitBits(notify_flags_, DISPATCH_EXIT_EVT, pdTRUE, pdFALSE, 10);

			// If it was not thread_[i], that is ok, but we will loop around
			// until threads_[i] has exited
			state = eTaskGetState(threads_[i].thread);
		} while (state != eDeleted);

		threads_[i].name.clear();
	}

	// Cleanup event flags and mutex
	vEventGroupDelete(notify_flags_);

	vSemaphoreDelete(mutex_);
}
开发者ID:typelogic,项目名称:embedded-resources,代码行数:31,代码来源:dispatch_freertos.cpp

示例8: sc_callback

static void sc_callback(smartconfig_status_t status, void *pdata)
{
    switch (status) {
        case SC_STATUS_WAIT:
            ESP_LOGI(TAG, "SC_STATUS_WAIT");
            break;
        case SC_STATUS_FIND_CHANNEL:
            ESP_LOGI(TAG, "SC_STATUS_FINDING_CHANNEL");
            break;
        case SC_STATUS_GETTING_SSID_PSWD:
            ESP_LOGI(TAG, "SC_STATUS_GETTING_SSID_PSWD");
            break;
        case SC_STATUS_LINK:
            ESP_LOGI(TAG, "SC_STATUS_LINK");
            wifi_config_t *wifi_config = pdata;
            ESP_LOGI(TAG, "SSID:%s", wifi_config->sta.ssid);
            ESP_LOGI(TAG, "PASSWORD:%s", wifi_config->sta.password);
            ESP_ERROR_CHECK( esp_wifi_disconnect() );
            ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, wifi_config) );
            ESP_ERROR_CHECK( esp_wifi_connect() );
            break;
        case SC_STATUS_LINK_OVER:
            ESP_LOGI(TAG, "SC_STATUS_LINK_OVER");
            if (pdata != NULL) {
                uint8_t phone_ip[4] = { 0 };
                memcpy(phone_ip, (uint8_t* )pdata, 4);
                ESP_LOGI(TAG, "Phone ip: %d.%d.%d.%d\n", phone_ip[0], phone_ip[1], phone_ip[2], phone_ip[3]);
            }
            xEventGroupSetBits(wifi_event_group, ESPTOUCH_DONE_BIT);
            break;
        default:
            break;
    }
}
开发者ID:danathughes,项目名称:esp-idf,代码行数:34,代码来源:smartconfig_main.c

示例9: MPU_xEventGroupSetBits

EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet )
{
EventBits_t xReturn;
BaseType_t xRunningPrivileged = xPortRaisePrivilege();

	xReturn = xEventGroupSetBits( xEventGroup, uxBitsToSet );
	vPortResetPrivilege( xRunningPrivileged );

	return xReturn;
}
开发者ID:sean93park,项目名称:freertos,代码行数:10,代码来源:mpu_wrappers.c

示例10: prvSanityCheckCreatedEventGroup

static void prvSanityCheckCreatedEventGroup( EventGroupHandle_t xEventGroup )
{
EventBits_t xEventBits;
const EventBits_t xFirstTestBits = ( EventBits_t ) 0xaa, xSecondTestBits = ( EventBits_t ) 0x55;

	/* The event group should not have any bits set yet. */
	xEventBits = xEventGroupGetBits( xEventGroup );

	if( xEventBits != ( EventBits_t ) 0 )
	{
		xErrorOccurred = pdTRUE;
	}

	/* Some some bits, then read them back to check they are as expected. */
	xEventGroupSetBits( xEventGroup, xFirstTestBits );

	xEventBits = xEventGroupGetBits( xEventGroup );

	if( xEventBits != xFirstTestBits )
	{
		xErrorOccurred = pdTRUE;
	}

	xEventGroupSetBits( xEventGroup, xSecondTestBits );

	xEventBits = xEventGroupGetBits( xEventGroup );

	if( xEventBits != ( xFirstTestBits | xSecondTestBits ) )
	{
		xErrorOccurred = pdTRUE;
	}

	/* Finally try clearing some bits too and check that operation proceeds as
	expected. */
	xEventGroupClearBits( xEventGroup, xFirstTestBits );

	xEventBits = xEventGroupGetBits( xEventGroup );

	if( xEventBits != xSecondTestBits )
	{
		xErrorOccurred = pdTRUE;
	}
}
开发者ID:radiolok,项目名称:RelayComputer2,代码行数:43,代码来源:StaticAllocation.c

示例11: flag_event_post

int flag_event_post(flag_event_t *event){
	/* Make sure that interrupt flag is set */
#if defined(OS_FREERTOS)
	xEventGroupSetBits(
			*event,
			(((uint8_t)1)<< 0));
#elif defined(OS_UCOS)
	OS_ERR err;
	OSFlagPost(event, 1, OS_OPT_POST_FLAG_SET, &err);
#endif
	return 0;
}
开发者ID:binhfile,项目名称:stm32,代码行数:12,代码来源:flag_event.c

示例12: xSemaphoreTakeRecursive

void dispatch_queue::dispatch(fp_t&& op)
{
	BaseType_t status = xSemaphoreTakeRecursive(mutex_, portMAX_DELAY);
	assert(status == pdTRUE && "Failed to lock mutex!");

	q_.push(std::move(op));

	status = xSemaphoreGiveRecursive(mutex_);
	assert(status == pdTRUE && "Failed to unlock mutex!");

	// Notifies threads that new work has been added to the queue
	xEventGroupSetBits(notify_flags_, DISPATCH_WAKE_EVT);
}
开发者ID:typelogic,项目名称:embedded-resources,代码行数:13,代码来源:dispatch_freertos.cpp

示例13: event_handler

static esp_err_t event_handler(void *ctx, system_event_t *event)
{
    switch(event->event_id) {
    case SYSTEM_EVENT_STA_GOT_IP:
        xEventGroupClearBits(wifi_event_group, DISCONNECTED_BIT);
        xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
        break;
    case SYSTEM_EVENT_STA_DISCONNECTED:
        if (reconnect) {
            ESP_LOGI(TAG, "sta disconnect, reconnect...");
            esp_wifi_connect();
        } else {
            ESP_LOGI(TAG, "sta disconnect");
        }
        xEventGroupClearBits(wifi_event_group, CONNECTED_BIT);
        xEventGroupSetBits(wifi_event_group, DISCONNECTED_BIT);
        break;
    default:
        break;
    }
    return ESP_OK;
}
开发者ID:danathughes,项目名称:esp-idf,代码行数:22,代码来源:cmd_wifi.c

示例14: task1

/**
 * \brief  task1 in FreeRTOS
 * \details Call vTaskDelayUntil() to execute task1 with a fixed period 1 second.
 * \param[in] *par
 */
static void task1(void *par)
{
	uint32_t queue_data = 1;
	TickType_t xLastExecutionTime;
	xLastExecutionTime = xTaskGetTickCount(); /*!< initialize current tick */

	while (1) {
		//// 1-E: Task2 --> Task1
		x.t_t2_t1 = perf_end();
		//// 2-S: Task1 --> Int
		perf_start();
		_arc_aux_write(AUX_IRQ_HINT, SWI_INTNO); /*!< activate soft_interrupt */
		//// 5-E: Int --> Task1
		x.t_int_t1 = perf_end();

		// task delay, to control benchmark run speed
		vTaskDelayUntil( &xLastExecutionTime, TASK_DELAY_MS);
		// Task 1 acquire mutex first
		xSemaphoreTake(mux1_id, portMAX_DELAY);
		// Task 1 acquire semaphore first
		xSemaphoreTake(sem1_id, portMAX_DELAY);

		//// 6-S: Task1 --> Task2
		perf_start();
		vTaskResume(task2_handle);

		//// 8-S: Mutex Release -> Mutex Acquire
		perf_start();
		// Task 1 release mutex, task 2 acquire it
		xSemaphoreGive(mux1_id);

		//// 9-S: Sem Post -> Sem Acquire
		perf_start();
		// Task 1 post sem, task 2 acquire it
		xSemaphoreGive(sem1_id);

		//// 10-S: Event Write -> Event Read
		perf_start();
		// Task 1 write event, task 2 read it
		xEventGroupSetBits(evt1_cb, EVENT_WAIT_BITS);

		//// 11-S: Queue Write -> Queue Read
		perf_start();
		// Task 1 write queue, task 2 read it
		xQueueSend(dtq1_id, (void *)(&queue_data),  portMAX_DELAY);
		queue_data ++;
	}

}
开发者ID:NCTU-ivan,项目名称:embarc_osp,代码行数:54,代码来源:main.c

示例15: exeAioRespDebugPacket

static int exeAioRespDebugPacket(AioDspProtocolPkt *pPacket)
{
    switch(pPacket->DataAndCRC[0])
    {
    case (u8)RESP_DEB_CID_SAMPLE_SW:{
    }break;
    case (u8)RESP_DEB_CID_START_VPP:{
        xEventGroupSetBits( gpRespDebug->xEventGroup, 
                            RESP_DEB_PKT_BIT_START_VPP);
    }break;
    case (u8)RESP_DEB_CID_STOP_VPP:{
        gpRespDebug->RespVppResult = (int)((pPacket->DataAndCRC[1] << 24) \
                                            | (pPacket->DataAndCRC[2] << 16) \
                                            | (pPacket->DataAndCRC[3] << 8) \
                                            | pPacket->DataAndCRC[4]);
        xEventGroupSetBits( gpRespDebug->xEventGroup, 
                            RESP_DEB_PKT_BIT_STOP_VPP);
    }break;
    default:{

    }break;
    } //End of switch
    return 0;
}
开发者ID:webom2008,项目名称:AIO.TestFixture,代码行数:24,代码来源:AioDspProtocol.c


注:本文中的xEventGroupSetBits函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。