这篇教程C++ xQueueSendToBack函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中xQueueSendToBack函数的典型用法代码示例。如果您正苦于以下问题:C++ xQueueSendToBack函数的具体用法?C++ xQueueSendToBack怎么用?C++ xQueueSendToBack使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了xQueueSendToBack函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: usb_tty_print/* * Carrega o buffer de saida com uma string localizada na ram */void usb_tty_print(char *s){ unsigned int i = 0; unsigned int len = 0; char *sb = (char *)s; USB_BUFFER buf; /* verifica se o queue esta funcionando */ if(usb_buffer_queue == 0) return; while(*sb++ != '/0') len++; while(1){ if(len > USB_BUFFER_SIZE){ buf.co = USB_BUFFER_SIZE; len-=USB_BUFFER_SIZE; for(i = 0; i < USB_BUFFER_SIZE; i++){ buf.out[i] = *s++; } xQueueSendToBack(usb_buffer_queue, &buf, 20/portTICK_RATE_MS); } else { if(len > 0){ buf.co = len; for(i = 0; i < len; i++){ buf.out[i] = *s++; } xQueueSendToBack(usb_buffer_queue, &buf, 20/portTICK_RATE_MS); } break; } }}
开发者ID:acacio1986,项目名称:V2,代码行数:30,
示例2: qprintfvoid qprintf(xQueueHandle tx_queue, const char *format, ...){ va_list ap; va_start(ap, format); int curr_ch = 0; char out_ch[2] = {'/0', '/0'}; char newLine[3] = {'/n' , '/r', '/0'}; char percentage[] = "%"; char *str; char str_num[10]; int out_int; /* Block for 1ms. */ const portTickType xDelay = 0.1; // portTICK_RATE_MS; while( format[curr_ch] != '/0' ){ vTaskDelay( xDelay ); if(format[curr_ch] == '%'){ if(format[curr_ch + 1] == 's'){ str = va_arg(ap, char *); while (!xQueueSendToBack(tx_queue, str, portMAX_DELAY)); //parameter(...,The address of a string which is put in the queue,...) }else if(format[curr_ch + 1] == 'd'){ itoa(va_arg(ap, int), str_num); while (!xQueueSendToBack(tx_queue, str_num, portMAX_DELAY)); }else if(format[curr_ch + 1] == 'c'){ out_ch[0] = (char)va_arg(ap, int); while (!xQueueSendToBack(tx_queue, out_ch, portMAX_DELAY)); }else if(format[curr_ch + 1] == 'x'){
开发者ID:PJayChen,项目名称:freertos,代码行数:28,
示例3: write/* * Funcao write utilizado na retrasmissao do STDOUT, usado no printf * referencia: * http://support2.microchip.com/KBSearch/KB_StdProb.aspx?ID=SQ6UJ9A009MTU * https://www.microchip.com/forums/m601123-print.aspx * * Objetivo: Compatibilidade com outras bibliotecas, frameworks com o minimo de alteracao */int __atribute_libc write(int handle, void *buffer, unsigned int len){ int i = 0; USB_BUFFER printf_buffer; /* verifica se o queue esta funcionando */ if(usb_buffer_queue == 0) return 0; switch(handle){ case 0: // STDOUT case 1: // STDIN case 2: // STDERR if(len > USB_BUFFER_SIZE){ while(len > USB_BUFFER_SIZE){ for(i = 0; i < USB_BUFFER_SIZE; i++){ printf_buffer.out[i] = *(char *)buffer; } len -= USB_BUFFER_SIZE; printf_buffer.co = USB_BUFFER_SIZE; xQueueSendToBack(usb_buffer_queue, &printf_buffer, 20/portTICK_RATE_MS); } goto printf_parte2; } else {printf_parte2: if(len > 0){ for(i = 0; i < len; i++){ printf_buffer.out[i] = *(char *)buffer; } printf_buffer.co = len; xQueueSendToBack(usb_buffer_queue, &printf_buffer, 20/portTICK_RATE_MS); } } break; } return(len);}
开发者ID:acacio1986,项目名称:V2,代码行数:40,
示例4: helpCommandvoid helpCommand(xQueueHandle *outputQueue, char *line){ char str[81]; int str_i, help_i, found_end; xCommandListItem * item = &xRegisteredCommands; // Set last char as NUL str[80] = '/0'; // Print all command names while (item != NULL) { if (strlen(item->command->help) < 81) { if(xQueueSendToBack(*outputQueue, (void *) item->command->help, (portTickType) 100) != pdPASS) { sciDebug("ERROR %s:%d/n/r", __FUNCTION__, __LINE__); } } else { help_i = 0; found_end = 0; // Help text longer than 81 chars, split it up while (found_end == 0) { // Get next partition of the string for (str_i = 0; str_i < 80; str_i++) { str[str_i] = item->command->help[help_i++]; if (str[str_i] == '/0') { found_end = 1; break; } } // Print partition if(xQueueSendToBack(*outputQueue, (void *) str, (portTickType) 100) != pdPASS) { sciDebug("ERROR %s:%d/n/r", __FUNCTION__, __LINE__); } } } item = item->next; } // Send End-of-Text sprintf(str, "/3"); if(xQueueSendToBack(*outputQueue, (void *) str, (portTickType) 100) != pdPASS) { sciDebug("ERROR %s:%d/n/r", __FUNCTION__, __LINE__); }}
开发者ID:mrnguyen211190,项目名称:freertos-cli,代码行数:58,
示例5: guiTop_ApplyUartSettingsvoid guiTop_ApplyUartSettings(reqUartSettings_t *s){ uart_receiver_msg_t uart_msg; uart_msg.type = UART_APPLY_NEW_SETTINGS; uart_msg.enable = s->enable; uart_msg.parity = s->parity; uart_msg.brate = s->brate; if (s->uart_num == 1) xQueueSendToBack(xQueueUART1RX, &uart_msg, portMAX_DELAY); else xQueueSendToBack(xQueueUART2RX, &uart_msg, portMAX_DELAY);}
开发者ID:Avegawanderer,项目名称:mdr32f9q-ps200w,代码行数:12,
示例6: SMTPParamsClear/** * Clears SMTP parameter * /return None */void SMTPParamsClear(){ BOOL opok = FALSE; if(mainGSM.HWReady != TRUE) return; // Function cycles until it is not executed while (!opok) { while (xSemaphoreTake(xSemFrontEnd,0) != pdTRUE); // xSemFrontEnd TAKE // Check mainOpStatus.ExecStat if (mainOpStatus.ExecStat != OP_EXECUTION) { mainOpStatus.ExecStat = OP_EXECUTION; mainOpStatus.Function = 5; mainOpStatus.ErrorCode = 0; xQueueSendToBack(xQueue,&mainOpStatus.Function,0); // Send COMMAND request to the stack xSemaphoreGive(xSemFrontEnd); // xSemFrontEnd GIVE, the stack can answer to the command opok = TRUE; } else { xSemaphoreGive(xSemFrontEnd); taskYIELD(); } }}
开发者ID:OpenPicus,项目名称:lib_fota_gprs_pro,代码行数:36,
示例7: vCheckTimerCallbackstatic void vCheckTimerCallback( xTimerHandle xTimer ){static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0;/* Define the status message that is sent to the LCD task. By default thestatus is PASS. */static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS }; /* This is the callback function used by the 'check' timer, as described at the top of this file. */ /* The parameter is not used. */ ( void ) xTimer; /* See if the standard demo tasks are executing as expected, changing the message that is sent to the LCD task from PASS to an error code if any tasks set reports an error. */ if( xAreComTestTasksStillRunning() != pdPASS ) { xStatusMessage.ulMessageValue = mainERROR_COM_TEST; } if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) { xStatusMessage.ulMessageValue = mainERROR_DYNAMIC_TASKS; } if( xAreGenericQueueTasksStillRunning() != pdPASS ) { xStatusMessage.ulMessageValue = mainERROR_GEN_QUEUE_TEST; } if( xAreCountingSemaphoreTasksStillRunning() != pdPASS ) { xStatusMessage.ulMessageValue = mainERROR_COUNT_SEM_TEST; } if( xAreTimerDemoTasksStillRunning( ( portTickType ) mainCHECK_TIMER_PERIOD ) != pdPASS ) { xStatusMessage.ulMessageValue = mainERROR_TIMER_TEST; } /* Check the reg test tasks are still cycling. They will stop incrementing their loop counters if they encounter an error. */ if( usRegTest1Counter == usLastRegTest1Counter ) { xStatusMessage.ulMessageValue = mainERROR_REG_TEST; } if( usRegTest2Counter == usLastRegTest2Counter ) { xStatusMessage.ulMessageValue = mainERROR_REG_TEST; } usLastRegTest1Counter = usRegTest1Counter; usLastRegTest2Counter = usRegTest2Counter; /* This is called from a timer callback so must not block! */ xQueueSendToBack( xLCDQueue, &xStatusMessage, mainDONT_BLOCK );}
开发者ID:Bjoe,项目名称:msp340x-msp340-5438-stk-ccs,代码行数:60,
示例8: prvPrintTaskstatic void prvPrintTask(void* pvParameters){ int iIndexToString; // Two instances of this task are created. The task parameter is used to // pass an index into an array of strings into the task. Cast this to the // required type. iIndexToString = (int)pvParameters; for (;;) { // Print out the string, not directly but instead by passing a pointer // to the string to the gatekeeper task via a queue. The queue is created // before the scheduler is started so will already exist by this time // task executes for the first time. A block time is not specified // because there should always be space in the queue. xQueueSendToBack(xPrintQueue, &pcStringsToPrint[iIndexToString], 0); // Wait a pseudo random time. Note that rand() is not necessarily // reentrant, but in this case it does not really matter as the code // does not care what value is returned. In a more secure application // a version of rand() that is known to be reentrant should be used - // or calls to rand() should be protected using a critical section. vTaskDelay(rand() & 0x1FF); }}
开发者ID:hokim72,项目名称:XIL_EDK,代码行数:26,
示例9: uart_to_spi_write/** * UART to SPI protocol handler */void uart_to_spi_write(uart_packet_t *packet){ for (INT32U i=0; i<packet->datalength; i++) { xQueueSendToBack(uart_to_spi_queue, &packet->data[i], portMAX_DELAY); }}
开发者ID:SDU-ROBTEK-ALLSTARS,项目名称:PanTilt-Project,代码行数:10,
示例10: UDPWrite/** * UDPWrite - Writes on the UDP socket * /param sockwr UDP socket number * /param str2wr String to write * /param lstr String lenght * /return The number of write characters to the specified UDP socket. */WORD UDPWrite(BYTE sockwr, BYTE* str2wr , int lstr){ while (xSemaphoreTake(xSemFrontEnd,0) != pdTRUE); // xSemFrontEnd TAKE xErr = 0; if (xFrontEndStat == 0) { ToSend = 36; xFrontEndStatRet = 2; callbackUdpSocket = sockwr; udpByte = str2wr; udpInt = lstr; xQueueSendToBack(xQueue,&ToSend,0); // Send UDPWrite command to the stack xFrontEndStat = 1; xSemaphoreGive(xSemFrontEnd); // xSemFrontEnd GIVE } else { xErr = 36; xSemaphoreGive(xSemFrontEnd); taskYIELD(); return FALSE; } while (xFrontEndStat != 2); // Waits for stack answer while (xSemaphoreTake(xSemFrontEnd,0) != pdTRUE); // xSemFrontEnd TAKE WORD resconn; resconn = udpWord; xFrontEndStat = 0; xSemaphoreGive(xSemFrontEnd); // xSemFrontEnd GIVE taskYIELD(); return resconn;}
开发者ID:ElectronicsWIT,项目名称:AirFishBowl,代码行数:39,
示例11: vBlockingQueueProducerstatic void vBlockingQueueProducer( void *pvParameters ){unsigned short usValue = 0;xBlockingQueueParameters *pxQueueParameters;const char * const pcTaskStartMsg = "Blocking queue producer started./r/n";const char * const pcTaskErrorMsg = "Could not post on blocking queue/r/n";short sErrorEverOccurred = pdFALSE; pxQueueParameters = ( xBlockingQueueParameters * ) pvParameters; /* Queue a message for printing to say the task has started. */ vPrintDisplayMessage( &pcTaskStartMsg ); for( ;; ) { if( xQueueSendToBack( pxQueueParameters->xQueue, ( void * ) &usValue, pxQueueParameters->xBlockTime ) != pdPASS ) { vPrintDisplayMessage( &pcTaskErrorMsg ); sErrorEverOccurred = pdTRUE; } else { /* We have successfully posted a message, so increment the variable used to check we are still running. */ if( sErrorEverOccurred == pdFALSE ) { ( *pxQueueParameters->psCheckVariable )++; } /* Increment the variable we are going to post next time round. The consumer will expect the numbers to follow in numerical order. */ ++usValue; } }}
开发者ID:ShaohuiZhu,项目名称:Haier-1,代码行数:35,
示例12: ForwardAudioMessagevoid ForwardAudioMessage ( const char * sCommand, const char * sFileName ){ struct AAudioMessage xAudioMessage, *pxAudioMessage = & xAudioMessage; strncpy ( xAudioMessage.Command, sCommand, 8 - 1 ); strncpy ( xAudioMessage.Parameter, sFileName, 128 - 1 ); xQueueSendToBack ( xAudioQueue, ( void * ) &pxAudioMessage, ( portTickType ) 0 );};
开发者ID:hosentraeger,项目名称:STM32F4D-Coocox-Lightboxx,代码行数:7,
示例13: TCPisConn/** * TCPisConn - Verifies the connection of a remote TCP device with the socket. It can be useful to catch an incoming new connection to a TCP server. * /param sockconn - The handle of the socket to control (the handle returned by the command TCPServerOpen). * /return TRUE - The remote connection is established. * /return FALSE - The remote connection is not established. */BOOL TCPisConn(TCP_SOCKET sockconn){ BOOL opok = FALSE; while (!opok) { while (xSemaphoreTake(xSemFrontEnd,0) != pdTRUE); // xSemFrontEnd TAKE if (xFrontEndStat == 0) { ToSend = 24; xFrontEndStatRet = 2; xSocket = sockconn; xQueueSendToBack(xQueue,&ToSend,0); // Send TCPIsConnected command to the stack xFrontEndStat = 1; xSemaphoreGive(xSemFrontEnd); // xSemFrontEnd GIVE opok = TRUE; } else { xSemaphoreGive(xSemFrontEnd); taskYIELD(); // If WiFi module if turned OFF, function doesn't do anything if (xFrontEndStat == -1) return FALSE; } } while (xFrontEndStat != 2); // Waits for stack answer while (xSemaphoreTake(xSemFrontEnd,0) != pdTRUE); // xSemFrontEnd TAKE BOOL resconn; resconn = xBool; xFrontEndStat = 0; xSemaphoreGive(xSemFrontEnd); // xSemFrontEnd GIVE taskYIELD(); return resconn;}
开发者ID:adarkhorse,项目名称:iiitd-flyport-development,代码行数:41,
示例14: runShellCommandvoid runShellCommand(xQueueHandle *outputQueue, char * line){ xCommandListItem * item = &xRegisteredCommands; char * strNotFound = "Command not found, use /"help/" to list available commands./n/r/3"; int len; while (item != NULL) { len = strlen(item->command->name); // Either line contains only the command or followed by space if (strncmp(line, item->command->name, len) == 0 && (len == strlen(line) || line[len] == ' ')) { (*item->command->func)(outputQueue, line); break; } item = item->next; } if (item == NULL) { // Command was not found if(xQueueSendToBack(*outputQueue, (void *) strNotFound, (portTickType) 100) != pdPASS) { sciDebug("ERROR %s:%d/n/r", __FUNCTION__, __LINE__); } }}
开发者ID:mrnguyen211190,项目名称:freertos-cli,代码行数:27,
示例15: readTask/* This task uses the high level GPIO API (esp_gpio.h) to blink an LED. * */void ICACHE_FLASH_ATTRreadTask(void *pvParameters){ struct userdata *user = (struct userdata *)pvParameters; int a; float temperature; float R; while(1) { // read from sensor output voltage a = LM35; R = (float)(1023-a)*10000/a; // convert to Celsius temperature temperature = 1 / (log(R/10000)/B+1/298.15) - 273.15; // precision temperature = temperature * 100; // send to queue xQueueSendToBack( user->xQueue, (void *) &temperature, portMAX_DELAY ); // Resume the suspended task ourselves. if( user->xHandle != NULL ) { vTaskResume( user->xHandle ); } wait(0.8); }}
开发者ID:chinlin0924,项目名称:rtos-wot,代码行数:34,
示例16: QActive_postFIFOvoid QActive_postFIFO(QActive *me, QEvent const *e) { portBASE_TYPE err; QF_INT_LOCK_KEY_#ifdef YYY QF_INT_LOCK_(); if (e->dynamic_ != (uint8_t)0) { ++((QEvent *)e)->dynamic_; } QF_INT_UNLOCK_();#endif // err = xQueueSendToBack(me->eQueue, &e, (portTickType)0);#define XXX#ifdef XXX if (ulCriticalNesting == (unsigned portLONG)0) { /* task level? */ QF_INT_LOCK_(); if (e->dynamic_ != (uint8_t)0) { ++((QEvent *)e)->dynamic_; } QF_INT_UNLOCK_(); err = xQueueSendToBack(me->eQueue, &e, (portTickType)0); } else { /* must be ISR level */ portBASE_TYPE xHigherPriorityTaskWoken; err = xQueueSendToBackFromISR(me->eQueue, &e,&xHigherPriorityTaskWoken); }#endif Q_ASSERT(err == pdPASS);}
开发者ID:roland-wilhelm,项目名称:iot,代码行数:29,
示例17: parseCommsCmd/** * @brief Communications command parse function * @param None * @retval Command ACK or ERR */command parseCommsCmd(void){ command cmdIn=CMD_ERR; uint8_t error=0; //try to parse command while buffer is not empty /////// do{ cmdIn = giveNextCmd(); switch(cmdIn){ case CMD_GET_CONFIG: xQueueSendToBack(messageQueue, "4SendCommsConfig", portMAX_DELAY); break; case CMD_END:break; default: error = COMMS_INVALID_FEATURE; cmdIn = CMD_ERR; break; }/////// }while(cmdIn != CMD_END && cmdIn != CMD_ERR && error==0); if(error>0){ cmdIn=error; }else{ cmdIn=CMD_END; }return cmdIn;}
开发者ID:jirik09,项目名称:Instrulab,代码行数:30,
示例18: errorREPORT// For low-severity errors only.// Note: This function does not halt regular operation, nor is the error fixed at this time.// The only reason this function would return -1 is if sending a message to the FDIR task failed.// 1 should really be returned.// The error should be placed in data[151-148]// The task ID should be placed in data[147]// Additional error code (if applicable) should be placed in data[146]// Any other desired may be placed in the lower bytes (not currently implemented)int errorREPORT(uint8_t task, uint8_t code, uint32_t error, uint32_t* data){ uint8_t i; TickType_t wait_time = 5 * 60 * 1000; for(i = 0; i < 147; i++) { high_error_array[i] = *(data + i); // Load the data into the high_error_array. } high_error_array[151] = (uint8_t)((error & 0xFF000000) >> 24); high_error_array[150] = (uint8_t)((error & 0x00FF0000) >> 16); high_error_array[149] = (uint8_t)((error & 0x0000FF00) > 8); high_error_array[148] = (uint8_t)(error & 0x000000FF); high_error_array[147] = task; high_error_array[146] = code; if (xSemaphoreTake(Lowsev_Mutex, wait_time) == pdTRUE) // Attempt to acquire Mutex, block for max 5 minutes. { if( xQueueSendToBack(low_sev_to_fdir_fifo, high_error_array, wait_time) != pdTRUE) { xSemaphoreGive(Lowsev_Mutex); return -1; } xSemaphoreGive(Lowsev_Mutex); return 1; } else return -1;}
开发者ID:tech4me,项目名称:CDH-OBC_PhaseII,代码行数:35,
示例19: TCPRxLen/** * TCPRxLen - Verifies how many bytes can be read from the specified TCP socket. * /param socklen - The handle of the socket to control (the handle returned by the command TCPClientOpen or TCPServerOpen). * /return The number of bytes available to be read. */WORD TCPRxLen(TCP_SOCKET socklen){ BOOL opok = FALSE; while (!opok) { while (xSemaphoreTake(xSemFrontEnd,0) != pdTRUE); // xSemFrontEnd TAKE if (xFrontEndStat == 0) { ToSend=25; xFrontEndStatRet = 2; xSocket = socklen; xQueueSendToBack(xQueue,&ToSend,0); // Send TCPRxLen request to the stack xFrontEndStat = 1; xSemaphoreGive(xSemFrontEnd); // xSemFrontEnd GIVE opok = TRUE; } else { xSemaphoreGive(xSemFrontEnd); taskYIELD(); // If WiFi module if turned OFF, function doesn't do anything if (xFrontEndStat == -1) return 0; } } while (xFrontEndStat != 2); // Waits for stack answer while (xSemaphoreTake(xSemFrontEnd,0) != pdTRUE); // xSemFrontEnd TAKE WORD reslen; reslen = xWord; xFrontEndStat = 0; xSemaphoreGive(xSemFrontEnd); // xSemFrontEnd GIVE //taskYIELD(); return reslen;}
开发者ID:adarkhorse,项目名称:iiitd-flyport-development,代码行数:40,
示例20: TCPpRead/*** TCPpRead - Reads the specified number of characters from a TCP socket and puts them into the specified char array. <B>NOTE:</B> This function does flush the buffer!* /param socktoread - The handle of the socket to read (the handle returned by the command TCPClientOpen or TCPServerOpen).* /param readch - The char array to fill with the read characters.* /param rlen - The number of characters to read. * /param start - The starting point to read.* /warning The length of the array must be AT LEAST = rlen+1, because at the end of the operation the array it's automatically NULL terminated (is added the '/0' character).* /return None.*/void TCPpRead(TCP_SOCKET socktoread , char readch[] , int rlen, int start){ BOOL opok = FALSE; while (!opok) { while (xSemaphoreTake(xSemFrontEnd,0) != pdTRUE); // xSemFrontEnd TAKE xErr = 0; if (xFrontEndStat == 0) { ToSend=17; xFrontEndStatRet = 2; xSocket = socktoread; xInt = rlen; xInt2 = start; xByte = (BYTE*)readch; xQueueSendToBack(xQueue,&ToSend,0); // Send cTCPRead command to the stack xFrontEndStat = 1; xSemaphoreGive(xSemFrontEnd); // xSemFrontEnd GIVE while (xFrontEndStat != 2); // Waits for stack answer while (xSemaphoreTake(xSemFrontEnd,0) != pdTRUE); // xSemFrontEnd TAKE xFrontEndStat = 0; xSemaphoreGive(xSemFrontEnd); opok = TRUE; taskYIELD(); } else { xSemaphoreGive(xSemFrontEnd); taskYIELD(); // If WiFi module if turned OFF, function doesn't do anything if (xFrontEndStat == -1) return; } } }
开发者ID:adarkhorse,项目名称:iiitd-flyport-development,代码行数:44,
示例21: prvRfidTaskstatic void prvRfidTask(void * parameters){ RfidMessage rfidMessage; MFRC522_PCD_Init(); for (;;) { // Look for new cards, and select one if present if (MFRC522_PICC_IsNewCardPresent() && MFRC522_PICC_ReadCardSerial()) { uint32_t i; rfidMessage.size = uid.size; for(i = 0; i < 10; i++) { rfidMessage.uidByte[i] = uid.uidByte[i]; } xQueueSendToBack(rfidEventQueue, &rfidMessage, 10); for (i = 0; i < uid.size; i++) { UARTprintf("%x", uid.uidByte[i]); } UARTprintf("/n"); MFRC522_PICC_HaltA(); } delay(50); }}
开发者ID:mukris,项目名称:rfid,代码行数:31,
示例22: TCPRxFlush/** * TCPRxFlush - Empty specified TCP socket RX Buffer. * /param sockflush - The handle of the socket to empty (the handle returned by the command TCPClientOpen or TCPServerOpen). * /return none. */void TCPRxFlush(TCP_SOCKET sockflush){ BOOL opok = FALSE; while (!opok) { while (xSemaphoreTake(xSemFrontEnd,0) != pdTRUE); // xSemFrontEnd TAKE xErr = 0; if (xFrontEndStat == 0) { xFrontEndStatRet = 2; ToSend=16; xSocket = sockflush; xQueueSendToBack(xQueue,&ToSend,0); // Send COMMAND to the stack xFrontEndStat = 1; xSemaphoreGive(xSemFrontEnd); // xSemFrontEnd GIVE, the stack can answer to the command while (xFrontEndStat != 2); // Waits for stack answer while (xSemaphoreTake(xSemFrontEnd,0) != pdTRUE); // xSemFrontEnd TAKE xFrontEndStat = 0; xSemaphoreGive(xSemFrontEnd); opok = TRUE; taskYIELD(); } else { xSemaphoreGive(xSemFrontEnd); // xSemFrontEnd GIVE taskYIELD(); // If WiFi module if turned OFF, function doesn't do anything if (xFrontEndStat == -1) return; } }}
开发者ID:adarkhorse,项目名称:iiitd-flyport-development,代码行数:38,
示例23: vDebugString// This function copies the the given string into the OS queue. If the queue// is full then the rest of the string is ignored.// ToDo: Ignoring a full queue is not good.// ============================================================================void vDebugString(char *s) { portBASE_TYPE xStatus; while (*s) { xStatus = xQueueSendToBack(xDebugQueue, s++, 0); if (xStatus == errQUEUE_FULL) break; }}
开发者ID:JamesHyunKim,项目名称:STM32F4-Discovery_FW_V1.1.0_Makefiles,代码行数:11,
示例24: Uart3Writeint Uart3Write(char *pWriteData, const int nDataLen){ int i = 0; char *pData = pWriteData; if (!uart3_device.IsDeviceOpen) { return -1; } if( pdTRUE != xSemaphoreTake( xWriteOpLock, ( TickType_t ) 5 )) { return -2; } for (i=0; i < nDataLen; i++) { if(pdPASS != xQueueSendToBack(uart3_tx_queue, (void *)pData++, (TickType_t)3)) { // Failed to post the message, even after 10 ticks. break; } } xSemaphoreGive( xWriteOpLock ); USART_ITConfig(USART3, USART_IT_TXE, ENABLE); return i;}
开发者ID:webom2008,项目名称:AIO.TestFixture,代码行数:27,
示例25: cph_tcp_receive// synchronous cph_tcp_receive message// this function returns whatever data is received from the port// and copies into the data buffer passed intcp_result cph_tcp_receive(socket_connection_t *cnx, uint8_t *data){ // TODO: SEMAPHORE TAKE GIVE TASK NOTIFY tcp_result result; comm_request_t request; request.type = REQUEST_RECEIVE; connection_settimeout(cnx, DEFAULT_TCIP_RECEIVETIMEOUT); if(xQueueSendToBack( xCommQueueRequest, &request, (TickType_t)0) == pdTRUE) { result = SYS_TCP_OK; } else { result = SYS_ERR_TCP_FAIL_REQUESTENQUEUE; } if(xSemaphoreTake(tcp_receive_signal, portMAX_DELAY)) { if(cnx->socket->bytes_received > 0) { printf("cph_tcp_receive: bytes %d/r/n", cnx->socket->bytes_received); memcpy(data, cnx->socket->rx_buffer, cnx->socket->bytes_received); } } return result;}
开发者ID:johncobb,项目名称:echobase_sam4e16c,代码行数:31,
示例26: UDPGenericClose/// @cond debug//*****************************************************************************************// Only internal use// 37 - UDPGenericClose and callback function: close an open UDP socket//*****************************************************************************************BYTE UDPGenericClose(BYTE sock){ while (xSemaphoreTake(xSemFrontEnd,0) != pdTRUE); // xSemFrontEnd TAKE xErr = 0; if (xFrontEndStat == 0) { xFrontEndStatRet = 2; ToSend=37; callbackUdpSocket = sock; xQueueSendToBack(xQueue,&ToSend,0); // Send COMMAND to the stack xFrontEndStat = 1; xSemaphoreGive(xSemFrontEnd); // xSemFrontEnd GIVE while (xFrontEndStat != 2); // Waits for stack answer while (xSemaphoreTake(xSemFrontEnd,0) != pdTRUE); // xSemFrontEnd TAKE xFrontEndStat = 0; xSemaphoreGive(xSemFrontEnd); taskYIELD(); } else { xErr = 37; xSemaphoreGive(xSemFrontEnd); taskYIELD(); } return 0;}
开发者ID:ElectronicsWIT,项目名称:AirFishBowl,代码行数:31,
示例27: vIntegerGeneratorstatic void vIntegerGenerator( void *pvParameters ){portTickType xLastExecutionTime;unsigned portLONG ulValueToSend = 0;int i; /* Initialize the variable used by the call to vTaskDelayUntil(). */ xLastExecutionTime = xTaskGetTickCount(); for( ;; ) { /* This is a periodic task. Block until it is time to run again. The task will execute every 200ms. */ vTaskDelayUntil( &xLastExecutionTime, 200 / portTICK_RATE_MS ); /* Send an incrementing number to the queue five times. These will be read from the queue by the interrupt service routine. A block time is not specified. */ for( i = 0; i < 5; i++ ) { xQueueSendToBack( xIntegerQueue, &ulValueToSend, 0 ); ulValueToSend++; } /* Force an interrupt so the interrupt service routine can read the values from the queue. */ vPrintString( "Generator task - About to generate an interrupt./n" ); mainTRIGGER_INTERRUPT(); vPrintString( "Generator task - Interrupt generated./n/n" ); }}
开发者ID:Lzyuan,项目名称:STE-LPC1768-,代码行数:31,
示例28: UDPGenericOpen/// @cond debug//*****************************************************************************************// Only internal use:// 35 - UDPGenericOpen and callback function: opens a generic UDP socket//*****************************************************************************************BYTE UDPGenericOpen(char localport[], NODE_INFO* remhost, char remoteport[] ){ BYTE retsock; while (xSemaphoreTake(xSemFrontEnd,0) != pdTRUE); // xSemFrontEnd TAKE xErr = 0; if (xFrontEndStat == 0) { xFrontEndStatRet = 2; ToSend=35; xUDPLocalPort = atoi(localport); xUDPRemotePort = atoi(remoteport); udpIPAddress = remhost; xQueueSendToBack(xQueue,&ToSend,0); // Send COMMAND to the stack xFrontEndStat = 1; xSemaphoreGive(xSemFrontEnd); // xSemFrontEnd GIVE } else { xErr = 35; //ToSend; xSemaphoreGive(xSemFrontEnd); taskYIELD(); return 0;//Socket creation error } while (xFrontEndStat != 2); // Waits for stack answer while (xSemaphoreTake(xSemFrontEnd,0) != pdTRUE); // xSemFrontEnd TAKE retsock = callbackUdpSocket; xFrontEndStat = 0; xSemaphoreGive(xSemFrontEnd); // xSemFrontEnd GIVE taskYIELD(); return retsock;}
开发者ID:ElectronicsWIT,项目名称:AirFishBowl,代码行数:36,
示例29: cph_tcp_resumetcp_result cph_tcp_resume(socket_connection_t *cnx){ // TODO: SEMAPHORE TAKE GIVE TASK NOTIFY tcp_result result; comm_request_t request; request.type = REQUEST_CONNECT; if(xQueueSendToBack( xCommQueueRequest, &request, (TickType_t)0) == pdTRUE) { while(true) { if(cnx->socket->socket_error > 0) { result = SYS_ERR_TCP_FAIL; break; } if(cnx->socket->socket_status == SCK_OPENED) { result = SYS_TCP_OK; break; } } } if(xSemaphoreTake(tcp_suspend_signal, portMAX_DELAY)) { //printf("tcp_connect: connected./r/n"); } return SYS_TCP_OK;}
开发者ID:johncobb,项目名称:echobase_sam4e16c,代码行数:30,
注:本文中的xQueueSendToBack函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ xSecondTimerHandler函数代码示例 C++ xQueueSendFromISR函数代码示例 |