您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ vParTestSetLED函数代码示例

51自学网 2021-06-03 09:30:42
  C++
这篇教程C++ vParTestSetLED函数代码示例写得很实用,希望能帮到您。

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

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

示例1: vApplicationProcessFormInput

void vApplicationProcessFormInput( portCHAR *pcInputString, portBASE_TYPE xInputLength ){char *c, *pcText;static portCHAR cMessageForDisplay[ 32 ];extern xQueueHandle xLCDQueue;xLCDMessage xLCDMessage;	/* Process the form input sent by the IO page of the served HTML. */	c = strstr( pcInputString, "?" );    if( c )    {		/* Turn LED's on or off in accordance with the check box status. */		if( strstr( c, "LED0=1" ) != NULL )		{			vParTestSetLED( 5, 0 );		}		else		{			vParTestSetLED( 5, 1 );		}						if( strstr( c, "LED1=1" ) != NULL )		{			vParTestSetLED( 6, 0 );		}		else		{			vParTestSetLED( 6, 1 );		}				if( strstr( c, "LED2=1" ) != NULL )		{			vParTestSetLED( 7, 0 );		}		else		{			vParTestSetLED( 7, 1 );		}		/* Find the start of the text to be displayed on the LCD. */        pcText = strstr( c, "LCD=" );        pcText += strlen( "LCD=" );        /* Terminate the file name for further processing within uIP. */        *c = 0x00;        /* Terminate the LCD string. */        c = strstr( pcText, " " );        if( c != NULL )        {            *c = 0x00;        }        /* Add required spaces. */        while( ( c = strstr( pcText, "+" ) ) != NULL )        {            *c = ' ';        }            /* Write the message to the LCD. */		strcpy( cMessageForDisplay, pcText );		xLCDMessage.xColumn = 0;		xLCDMessage.pcMessage = cMessageForDisplay;        xQueueSend( xLCDQueue, &xLCDMessage, portMAX_DELAY );    }}
开发者ID:Dzenik,项目名称:FreeRTOS_TEST,代码行数:67,


示例2: portTASK_FUNCTION

static portTASK_FUNCTION( vComRxTask, pvParameters ){signed char cExpectedByte, cByteRxed;portBASE_TYPE xResyncRequired = pdFALSE, xErrorOccurred = pdFALSE;	/* Just to stop compiler warnings. */	( void ) pvParameters;	for( ;; )	{		/* We expect to receive the characters from comFIRST_BYTE to		comLAST_BYTE in an incrementing order.  Loop to receive each byte. */		for( cExpectedByte = comFIRST_BYTE; cExpectedByte <= comLAST_BYTE; cExpectedByte++ )		{			/* Block on the queue that contains received bytes until a byte is			available. */			if( xSerialGetChar( xPort, &cByteRxed, comRX_BLOCK_TIME ) )			{				/* Was this the byte we were expecting?  If so, toggle the LED,				otherwise we are out on sync and should break out of the loop				until the expected character sequence is about to restart. */				if( cByteRxed == cExpectedByte )				{					vParTestToggleLED( uxBaseLED + comRX_LED_OFFSET );				}				else				{					xResyncRequired = pdTRUE;					break; /*lint !e960 Non-switch break allowed. */				}			}		}		/* Turn the LED off while we are not doing anything. */		vParTestSetLED( uxBaseLED + comRX_LED_OFFSET, pdFALSE );		/* Did we break out of the loop because the characters were received in		an unexpected order?  If so wait here until the character sequence is		about to restart. */		if( xResyncRequired == pdTRUE )		{			while( cByteRxed != comLAST_BYTE )			{				/* Block until the next char is available. */				xSerialGetChar( xPort, &cByteRxed, comRX_BLOCK_TIME );			}			/* Note that an error occurred which caused us to have to resync.			We use this to stop incrementing the loop counter so			sAreComTestTasksStillRunning() will return false - indicating an			error. */			xErrorOccurred++;			/* We have now resynced with the Tx task and can continue. */			xResyncRequired = pdFALSE;		}		else		{			if( xErrorOccurred < comTOTAL_PERMISSIBLE_ERRORS )			{				/* Increment the count of successful loops.  As error				occurring (i.e. an unexpected character being received) will				prevent this counter being incremented for the rest of the				execution.   Don't worry about mutual exclusion on this				variable - it doesn't really matter as we just want it				to change. */				uxRxLoops++;			}		}	}} /*lint !e715 !e818 pvParameters is required for a task function even if it is not referenced. */
开发者ID:LinuxJohannes,项目名称:FreeRTOS,代码行数:71,


示例3: vSerialTxCoRoutine

void vSerialTxCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex ){portTickType xDelayPeriod;static unsigned long *pulRandomBytes = commsFIRST_PROGRAM_BYTES;	/* Co-routine MUST start with a call to crSTART. */	crSTART( xHandle );	for(;;)    {			/* Was the previously transmitted string received correctly? */		if( uxCommsErrorStatus != pdPASS )		{			/* An error was encountered so set the error LED. */			vParTestSetLED( commsFAIL_LED, pdTRUE );		}		/* The next character to Tx is the first in the string. */		cNextChar = commsFIRST_TX_CHAR;		UARTIntDisable( UART0_BASE, UART_INT_TX );		{			/* Send the first character. */			if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) )			{				HWREG( UART0_BASE + UART_O_DR ) = cNextChar;			}			/* Move the variable to the char to Tx on so the ISR transmits			the next character in the string once this one has completed. */			cNextChar++;		}		UARTIntEnable(UART0_BASE, UART_INT_TX);		/* Toggle the LED to show a new string is being transmitted. */        vParTestToggleLED( commsTX_LED );		/* Delay before we start the string off again.  A pseudo-random delay		is used as this will provide a better test. */		xDelayPeriod = xTaskGetTickCount() + ( *pulRandomBytes );		pulRandomBytes++;		if( pulRandomBytes > commsTOTAL_PROGRAM_MEMORY )		{			pulRandomBytes = commsFIRST_PROGRAM_BYTES;		}		/* Make sure we don't wait too long... */		xDelayPeriod &= commsMAX_TX_DELAY;		/* ...but we do want to wait. */		if( xDelayPeriod < commsMIN_TX_DELAY )		{			xDelayPeriod = commsMIN_TX_DELAY;		}		/* Block for the random(ish) time. */		crDELAY( xHandle, xDelayPeriod );    }	/* Co-routine MUST end with a call to crEND. */	crEND();}
开发者ID:denal05,项目名称:STM32L152-EVAL,代码行数:63,


示例4: vSetErrorLED

void vSetErrorLED( void ){	vParTestSetLED( mainFAIL_LED, pdTRUE );}
开发者ID:glocklueng,项目名称:proditronicproject,代码行数:4,


示例5: vParTestToggleLED

void vParTestToggleLED( unsigned portBASE_TYPE uxLED ){	vParTestSetLED( uxLED, !xLEDState );}
开发者ID:Eclo,项目名称:FreeRTOS,代码行数:4,


示例6: prvCheckTimerCallback

static void prvCheckTimerCallback( xTimerHandle xTimer ){static long lChangeToRedLEDsAlready = pdFALSE;static unsigned long ulLastRegTest1Counter = 0, ulLastRegTest2Counter = 0;unsigned long ulErrorFound = pdFALSE;/* LEDs are defaulted to use the Green LEDs.  The Red LEDs are used if an erroris found. */static unsigned long ulLED1 = 8, ulLED2 = 11;const unsigned long ulRedLED1 = 6, ulRedLED2 = 9;	/* Check all the demo tasks (other than the flash tasks) to ensure	they are all still running, and that none have detected an error. */	if( xAreIntegerMathsTaskStillRunning() != pdTRUE )	{		ulErrorFound = pdTRUE;	}	if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )	{		ulErrorFound = pdTRUE;	}	if( xAreBlockingQueuesStillRunning() != pdTRUE )	{		ulErrorFound = pdTRUE;	}	if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )	{		ulErrorFound = pdTRUE;	}	if ( xAreGenericQueueTasksStillRunning() != pdTRUE )	{		ulErrorFound = pdTRUE;	}	if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )	{		ulErrorFound = pdTRUE;	}	if( xIsCreateTaskStillRunning() != pdTRUE )	{		ulErrorFound = pdTRUE;	}	if( xArePollingQueuesStillRunning() != pdTRUE )	{		ulErrorFound = pdTRUE;	}	if( xAreSemaphoreTasksStillRunning() != pdTRUE )	{		ulErrorFound = pdTRUE;	}	if( xAreMathsTaskStillRunning() != pdTRUE )	{		ulErrorFound = pdTRUE;	}	if( xAreComTestTasksStillRunning() != pdTRUE )	{		ulErrorFound = pdTRUE;	}	/* Check the reg test tasks are still cycling.  They will stop	incrementing their loop counters if they encounter an error. */	if( ulRegTest1Counter == ulLastRegTest1Counter )	{		ulErrorFound = pdTRUE;	}	if( ulRegTest2Counter == ulLastRegTest2Counter )	{		ulErrorFound = pdTRUE;	}	ulLastRegTest1Counter = ulRegTest1Counter;	ulLastRegTest2Counter = ulRegTest2Counter;	/* Toggle the check LEDs to give an indication of the system status.  If	the green LEDs are toggling, then no errors have been detected.  If the red	LEDs are toggling, then an error has been reported in at least one task. */	vParTestToggleLED( ulLED1 );	vParTestToggleLED( ulLED2 );		/* Have any errors been latch in ulErrorFound?  If so, ensure the gree LEDs	are off, then switch to using the red LEDs. */	if( ulErrorFound != pdFALSE )	{		if( lChangeToRedLEDsAlready == pdFALSE )		{			lChangeToRedLEDsAlready = pdTRUE;						/* An error has been found.  Switch to use the red LEDs. */			vParTestSetLED( ulLED1, pdFALSE );			vParTestSetLED( ulLED2, pdFALSE );//.........这里部分代码省略.........
开发者ID:InSoonPark,项目名称:FreeRTOS,代码行数:101,


示例7: prvLEDTimerCallback

static void prvLEDTimerCallback( TimerHandle_t xTimer ){	/* The timer has expired - so no button pushes have occurred in the last	five seconds - turn the LED off. */	vParTestSetLED( mainTIMER_CONTROLLED_LED, pdFALSE );}
开发者ID:granthuu,项目名称:fsm_software,代码行数:6,


示例8: portTASK_FUNCTION

portTASK_FUNCTION( vBasicTFTPServer, pvParameters ){    int lSocket;    int lDataLen, lRecvLen;    socklen_t lFromLen;    struct sockaddr_in sLocalAddr, sFromAddr;    portCHAR cData[SEGSIZE+sizeof(struct tftphdr)];    struct tftphdr *sHdr = (struct tftphdr *)cData;    // Set up port    // Network order in info; host order in server:    for (;;) {        // Create socket        lSocket = socket(AF_INET, SOCK_DGRAM, 0);        if (lSocket < 0) {            return;        }        memset((char *)&sLocalAddr, 0, sizeof(sLocalAddr));        sLocalAddr.sin_family = AF_INET;        sLocalAddr.sin_len = sizeof(sLocalAddr);        sLocalAddr.sin_addr.s_addr = htonl(INADDR_ANY);        sLocalAddr.sin_port = htons(TFTP_PORT);        if (bind(lSocket, (struct sockaddr *)&sLocalAddr, sizeof(sLocalAddr)) < 0) {            // Problem setting up my end            close(lSocket);            return;        }        lRecvLen = sizeof(cData);        lFromLen = sizeof(sFromAddr);        lDataLen = recvfrom(lSocket, sHdr, lRecvLen, 0,                            (struct sockaddr *)&sFromAddr, &lFromLen);        vParTestSetLED( TFTP_LED , pdTRUE );        close(lSocket); // so that other servers can bind to the TFTP socket        if ( lDataLen < 0) {        } else {            switch (ntohs(sHdr->th_opcode)) {            case WRQ:                tftpd_write_file(sHdr, &sFromAddr, lFromLen);                vParTestSetLED( TFTP_LED , pdFALSE );                break;            case RRQ:                tftpd_read_file(sHdr, &sFromAddr, lFromLen);                vParTestSetLED( TFTP_LED , pdFALSE );                break;            case ACK:            case DATA:            case ERROR:                vParTestSetLED( TFTP_LED , pdFALSE );                // Ignore                break;            default:                for(;;)                {                    vParTestToggleLED( TFTP_LED );                    vTaskDelay(200);                }            }        }    }}
开发者ID:Arseny-N,项目名称:dylan,代码行数:66,


示例9: tftpd_write_file

//// Receive a file from the client//static voidtftpd_write_file(struct tftphdr *hdr,                 struct sockaddr_in *from_addr, int from_len){    struct tftphdr *reply = (struct tftphdr *)data_out;    struct tftphdr *response = (struct tftphdr *)data_in;    int fd, len, ok, tries, closed, data_len, s;    unsigned short block;    struct timeval timeout;    fd_set fds;    int total_timeouts = 0;    struct sockaddr_in client_addr, local_addr;    socklen_t client_len;    s = socket(AF_INET, SOCK_DGRAM, 0);    if (s < 0) {        return;    }    memset((char *)&local_addr, 0, sizeof(local_addr));    local_addr.sin_family = AF_INET;    local_addr.sin_len = sizeof(local_addr);    local_addr.sin_addr.s_addr = htonl(INADDR_ANY);    local_addr.sin_port = htons(INADDR_ANY);    if (bind(s, (struct sockaddr *)&local_addr, sizeof(local_addr)) < 0) {        // Problem setting up my end        close(s);        return;    }    if ((fd = tftpd_open_data_file((int)hdr->th_stuff, O_WRONLY)) < 0) {        tftpd_send_error(s,reply,TFTP_ENOTFOUND,from_addr, from_len);        close(s);        return;    }    ok = pdTRUE;    closed = pdFALSE;    block = 0;    while (ok) {        // Send ACK telling client he can send data        reply->th_opcode = htons(ACK);        reply->th_block = htons(block++); // postincrement        for (tries = 0;  tries < TFTP_RETRIES_MAX;  tries++) {            sendto(s, reply, 4, 0, (struct sockaddr *)from_addr, from_len);repeat_select:            timeout.tv_sec = TFTP_TIMEOUT_PERIOD;            timeout.tv_usec = 0;            FD_ZERO(&fds);            FD_SET(s, &fds);            vParTestToggleLED( TFTP_LED );            if (lwip_select(s+1, &fds, 0, 0, &timeout) <= 0) {                if (++total_timeouts > TFTP_TIMEOUT_MAX) {                    tftpd_send_error(s,reply,TFTP_EBADOP,from_addr, from_len);                    ok = pdFALSE;                    break;                }                continue; // retry the send, using up one retry.            }            vParTestToggleLED( TFTP_LED );            // Some data has arrived            data_len = sizeof(data_in);            client_len = sizeof(client_addr);            if ((data_len = recvfrom(s, data_in, data_len, 0,                                     (struct sockaddr *)&client_addr, &client_len)) < 0) {                // What happened?  No data here!                continue; // retry the send, using up one retry.            }            if (ntohs(response->th_opcode) == DATA &&                    ntohs(response->th_block) < block) {                // Then it is repeat DATA with an old block; listen again,                // but do not repeat sending the current ack, and do not                // use up a retry count.  (we do re-send the ack if                // subsequently we time out)                goto repeat_select;            }            if (ntohs(response->th_opcode) == DATA &&                    ntohs(response->th_block) == block) {                // Good data - write to file                len = tftpd_write_data_file(fd, response->th_data, data_len-4);                if (len < (data_len-4)) {                    // File is "full"                    tftpd_send_error(s,reply,TFTP_ENOSPACE,                                     from_addr, from_len);                    ok = pdFALSE;  // Give up                    break; // out of the retries loop                }                if (data_len < (SEGSIZE+4)) {                    // End of file                    closed = pdTRUE;                    ok = pdFALSE;                    vParTestSetLED( 0 , 0 );                    if (tftpd_close_data_file(fd) == -1) {//.........这里部分代码省略.........
开发者ID:Arseny-N,项目名称:dylan,代码行数:101,


示例10: portTASK_FUNCTION

//! Basic SMTP client task definitionportTASK_FUNCTION( vBasicSMTPClient, pvParameters ){  struct sockaddr_in stServeurSockAddr;  portLONG lRetval;  portLONG lSocket = -1;  // configure push button 0 to produce IT on falling edge  gpio_enable_pin_interrupt(GPIO_PUSH_BUTTON_0 , GPIO_FALLING_EDGE);  // Disable all interrupts  vPortEnterCritical();  // register push button 0 handler on level 3  INTC_register_interrupt( (__int_handler)&vpushb_ISR, AVR32_GPIO_IRQ_0 + (GPIO_PUSH_BUTTON_0/8), AVR32_INTC_INT3);  // Enable all interrupts  vPortExitCritical();  for (;;)  {    // wait for a signal to send a mail    while (bSendMail != pdTRUE)   vTaskDelay(200);    // Disable all interrupts    vPortEnterCritical();    // clear the flag    bSendMail = pdFALSE;    // Enable all interrupts    vPortExitCritical();    // clear the LED    vParTestSetLED( 3 , pdFALSE );    // Set up port    memset(&stServeurSockAddr, 0, sizeof(stServeurSockAddr));    stServeurSockAddr.sin_len = sizeof(stServeurSockAddr);    stServeurSockAddr.sin_addr.s_addr = inet_addr(cServer);    stServeurSockAddr.sin_port = htons(SMTP_PORT);    stServeurSockAddr.sin_family = AF_INET;    // socket as a stream    if ( (lSocket = socket(AF_INET, SOCK_STREAM, 0)) < 0)    {      // socket failed, blink a LED and stay here      for (;;) {        vParTestToggleLED( 4 );        vTaskDelay( 200 );      }    }    // connect to the server    if(connect(lSocket,(struct sockaddr *)&stServeurSockAddr, sizeof(stServeurSockAddr)) < 0)    {      // connect failed, blink a LED and stay here      for (;;) {        vParTestToggleLED( 6 );        vTaskDelay( 200 );      }    }    else    {//Server: 220 SMTP Ready      // wait for SMTP Server answer      do      {        lRetval = recv(lSocket, cTempBuffer, sizeof(cTempBuffer), 0);      }while (lRetval <= 0);      if (strncmp(cTempBuffer, SMTP_EHLO_STRING, sizeof(cTempBuffer)) >= 0)      {//Client: EHLO smtp.domain.com        // send ehlo        send(lSocket, "HELO ", 5, 0);        send(lSocket, cServer, strlen(cServer), 0);        send(lSocket, "/r/n", 2, 0);//Server: 250        // wait for SMTP Server answer        do        {          lRetval = recv(lSocket, cTempBuffer, sizeof(cTempBuffer), 0);        }while (lRetval <= 0);        if (strncmp(cTempBuffer, SMTP_OK_STRING, sizeof(cTempBuffer)) >= 0)        {//Client: MAIL FROM:<[email
C++ vPortEnterCritical函数代码示例
C++ vEnableDisableButtons函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。