• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ FreeRTOS_CLIGetParameter函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: prvSendFloorCommand

portBASE_TYPE prvSendFloorCommand(int8_t *pcWriteBuffer,
								  size_t xWriteBufferLen,
								  const int8_t *pcCommandString)
{
	portBASE_TYPE xParameter1StringLength;
	int8_t *pcParameter1;

	pcParameter1 = (uint8_t *) FreeRTOS_CLIGetParameter( pcCommandString, 1 , &xParameter1StringLength);

	switch( atoi(pcParameter1) )
	{
		case 1:
			DnCalls |= 1;
			break;

		case 2:
			UpCalls |= 2;
			DnCalls |= 2;
			break;

		case 3:
			UpCalls |= 4;
			break;
	}

	return pdFALSE;
}
开发者ID:ratelement,项目名称:Elevator,代码行数:27,代码来源:commands.c


示例2: prvTrackingCommand

/***********************************
			TRACKING CMD
 ***********************************/
static portBASE_TYPE prvTrackingCommand(char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString ) {

	long lParam_len;
	const char *cCmd_string;

	//Get parameters from command string
	cCmd_string = FreeRTOS_CLIGetParameter(pcCommandString, 1, &lParam_len);

	// check and turn servo control task on/off
	if (strcmp(cCmd_string, "on") == 0 || strcmp(cCmd_string, "On") == 0 || strcmp(cCmd_string, "ON") == 0) {
		vTaskResume(xPanTiltTask);
		vTaskResume(xDistanceTask);
		debug_printf("Tracking and Distance Estimation On!\n\r");
	}
	else if (strcmp(cCmd_string, "off") == 0 || strcmp(cCmd_string, "Off") == 0 || strcmp(cCmd_string, "OFF") == 0) {
		vTaskSuspend(xPanTiltTask);
		vTaskSuspend(xDistanceTask);
		debug_printf("Tracking and Distance Estimation Off\n\r");
	}
	else {
		debug_printf("Invalid argument. Use only on/On/ON or off/Off/OFF.\n\r");
	}

	xWriteBufferLen = sprintf(pcWriteBuffer, "\n\r");

	return pdFALSE;
}
开发者ID:reyrey1989,项目名称:CSSE3010-2014,代码行数:30,代码来源:main.c


示例3: prvLaserCommand

/***********************************
			LASER CMD
 ***********************************/
static portBASE_TYPE prvLaserCommand(char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString ) {

	long lParam_len;
	const char *cCmd_string;

	//Get parameters from command string
	cCmd_string = FreeRTOS_CLIGetParameter(pcCommandString, 1, &lParam_len);

	// check and turn laser on/off
	if (strcmp(cCmd_string, "on") == 0 || strcmp(cCmd_string, "On") == 0 || strcmp(cCmd_string, "ON") == 0) {
		GPIO_WriteBit(NP2_D1_GPIO_PORT, NP2_D1_PIN, 0x01);
		debug_printf("Laser On!\n\r");
	}
	else if (strcmp(cCmd_string, "off") == 0 || strcmp(cCmd_string, "Off") == 0 || strcmp(cCmd_string, "OFF") == 0) {
		GPIO_WriteBit(NP2_D1_GPIO_PORT, NP2_D1_PIN, 0x00);
		debug_printf("Laser Off\n\r");
	}
	else {
		debug_printf("Invalid argument. Use only on/On/ON or off/Off/OFF.\n\r");
	}

	xWriteBufferLen = sprintf(pcWriteBuffer, "\n\r");

	return pdFALSE;
}
开发者ID:reyrey1989,项目名称:CSSE3010-2014,代码行数:28,代码来源:main.c


示例4: LCD_SleepCommand

/**
 * @brief	Switch LCD backlight LED
 * @param	pcWriteBuffer
 * @param	xWriteBufferLen
 * @param	pcCommandString
 * @return
 */
static BaseType_t LCD_SleepCommand(char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString)
{
	const char *parameterPtr;
	int32_t paramterLen;

	parameterPtr = FreeRTOS_CLIGetParameter(pcCommandString, 1, &paramterLen);

	if (paramterLen == 1)
	{
		if (parameterPtr[0] == '0')
			LCD_Sleep(ENABLE);
		else if (parameterPtr[0] == '1')
			LCD_Sleep(DISABLE);
	}
	else if (paramterLen == 2)
	{
		if (parameterPtr[0] == 'o' && parameterPtr[1] == 'n')
			LCD_Sleep(DISABLE);
	}
	else if (paramterLen == 3)
	{
		if (parameterPtr[0] == 'o' && parameterPtr[1] == 'f'
				&& parameterPtr[2] == 'f')
			LCD_Sleep(ENABLE);
	}

	sprintf(pcWriteBuffer, "\n"); // Clean Message

	return pdFALSE;

}
开发者ID:dinowchang,项目名称:stm32-watering,代码行数:38,代码来源:lcd1602-test.c


示例5: LCD_LocCommand

/**
 * @param	pcWriteBuffer
 * @param	xWriteBufferLen
 * @param	pcCommandString
 * @return
 */
static BaseType_t LCD_LocCommand(char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString)
{
	const char *parameterPtr;
	int32_t paramterLen;
	uint32_t x, y;

	parameterPtr = FreeRTOS_CLIGetParameter(pcCommandString, 1, &paramterLen);
	x = DecToInt((char *) parameterPtr, paramterLen);

	parameterPtr = FreeRTOS_CLIGetParameter(pcCommandString, 2, &paramterLen);
	y = DecToInt((char *) parameterPtr, paramterLen);

	LCD_SetLoc(x, y);

	sprintf(pcWriteBuffer, "\n");

	return pdFALSE;

}
开发者ID:dinowchang,项目名称:stm32-watering,代码行数:25,代码来源:lcd1602-test.c


示例6: prvAccelCommand

portBASE_TYPE prvAccelCommand(int8_t *pcWriteBuffer,
								  size_t xWriteBufferLen,
								  const int8_t *pcCommandString)
{
	portBASE_TYPE xParameter1StringLength;
	int8_t *pcParameter1;

	pcParameter1 = (uint8_t *) FreeRTOS_CLIGetParameter( pcCommandString, 1 , &xParameter1StringLength);

	MaxAccel = atoi(pcParameter1);

	return pdFALSE;
}
开发者ID:ratelement,项目名称:Elevator,代码行数:13,代码来源:commands.c


示例7: prvStartStopTraceCommand

static portBASE_TYPE prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{
const char *pcParameter;
portBASE_TYPE lParameterStringLength;

	/* Remove compile time warnings about unused parameters, and check the
	write buffer is not NULL.  NOTE - for simplicity, this example assumes the
	write buffer length is adequate, so does not check for buffer overflows. */
	( void ) pcCommandString;
	( void ) xWriteBufferLen;
	configASSERT( pcWriteBuffer );

	/* Obtain the parameter string. */
	pcParameter = FreeRTOS_CLIGetParameter
					(
						pcCommandString,		/* The command string itself. */
						1,						/* Return the first parameter. */
						&lParameterStringLength	/* Store the parameter string length. */
					);

	/* Sanity check something was returned. */
	configASSERT( pcParameter );

	/* There are only two valid parameter values. */
	if( strncmp( pcParameter, "start", strlen( "start" ) ) == 0 )
	{
		/* Start or restart the trace. */
		vTraceStop();
		vTraceClear();
		uiTraceStart();

		sprintf( pcWriteBuffer, "Trace recording (re)started.\r\n" );
	}
	else if( strncmp( pcParameter, "stop", strlen( "stop" ) ) == 0 )
	{
		/* End the trace, if one is running. */
		vTraceStop();
		sprintf( pcWriteBuffer, "Stopping trace recording and dumping log to disk.\r\n" );
		prvSaveTraceFile();
	}
	else
	{
		sprintf( pcWriteBuffer, "Valid parameters are 'start' and 'stop'.\r\n" );
	}

	/* There is no more data to return after this single string, so return
	pdFALSE. */
	return pdFALSE;
}
开发者ID:DanielKristofKiss,项目名称:FreeRTOS,代码行数:49,代码来源:CLI-commands.c


示例8: create_task_command

static portBASE_TYPE create_task_command(int8_t *pcWriteBuffer,
		size_t xWriteBufferLen,
		const int8_t *pcCommandString)
{
	int8_t *parameter_string;
	portBASE_TYPE parameter_string_length;
	static const int8_t *success_message = (int8_t *) "Task created\r\n";
	static const int8_t *failure_message = (int8_t *) "Task not created\r\n";
	static const int8_t *task_already_created_message = (int8_t *) "The task has already been created. Execute the delete-task command first.\r\n";
	int32_t parameter_value;

	/* Remove compile time warnings about unused parameters, and check the
	write buffer is not NULL.  NOTE - for simplicity, this example assumes the
	write buffer length is adequate, so does not check for buffer overflows. */
	(void) xWriteBufferLen;
	configASSERT(pcWriteBuffer);

	/* Obtain the parameter string. */
	parameter_string = (int8_t *) FreeRTOS_CLIGetParameter(
									pcCommandString,		/* The command string itself. */
									1,						/* Return the first parameter. */
									&parameter_string_length	/* Store the parameter string length. */
								);

	/* Turn the parameter into a number. */
	parameter_value = (int32_t) atol((const char *) parameter_string);

	/* Attempt to create the task. */
	if (created_task_handle != NULL) {
		strcpy((char *) pcWriteBuffer,
				(const char *) task_already_created_message);
	} else {
		if (xTaskCreate(created_task, (const signed char *) "Created",
				configMINIMAL_STACK_SIZE,
				(void *) parameter_value, tskIDLE_PRIORITY,
				&created_task_handle) == pdPASS) {
			strcpy((char *) pcWriteBuffer,
					(const char *) success_message);
		} else {
			strcpy((char *) pcWriteBuffer,
					(const char *) failure_message);
		}
	}

	/* There is no more data to return after this single string, so return
	pdFALSE. */
	return pdFALSE;
}
开发者ID:InSoonPark,项目名称:asf,代码行数:48,代码来源:CLI-commands.c


示例9: LCD_CursorCommand

/**
 * @param	pcWriteBuffer
 * @param	xWriteBufferLen
 * @param	pcCommandString
 * @return
 */
static BaseType_t LCD_CursorCommand(char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString)
{
	const char *parameterPtr;
	int32_t paramterLen;
	uint32_t mode;

	parameterPtr = FreeRTOS_CLIGetParameter(pcCommandString, 1, &paramterLen);
	mode = DecToInt((char *) parameterPtr, paramterLen);

	LCD_Cursor(mode & BIT0);
	LCD_Blink(mode & BIT1);

	sprintf(pcWriteBuffer, "Cursor set to mode: %d\n", (uint16_t)(mode & 0x03));

	return pdFALSE;

}
开发者ID:dinowchang,项目名称:stm32-watering,代码行数:23,代码来源:lcd1602-test.c


示例10: LCD_PrintCommand

/**
 * @param	pcWriteBuffer
 * @param	xWriteBufferLen
 * @param	pcCommandString
 * @return
 */
static BaseType_t LCD_PrintCommand(char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString)
{
	const char *parameterPtr;
	int32_t paramterLen;
	uint8_t i = 0;

	parameterPtr = FreeRTOS_CLIGetParameter(pcCommandString, 1, &paramterLen);
	while(i < paramterLen)
	{
		LCD_WriteData(parameterPtr[i]);
		i++;
	}
	sprintf(pcWriteBuffer, "\n");

	return pdFALSE;

}
开发者ID:dinowchang,项目名称:stm32-watering,代码行数:23,代码来源:lcd1602-test.c


示例11: prvDelCommand

static portBASE_TYPE prvDelCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
{
int8_t *pcParameter;
portBASE_TYPE xParameterStringLength;
const unsigned portBASE_TYPE uxFirstParameter = 1U;

	/* This assumes pcWriteBuffer is long enough. */
	( void ) xWriteBufferLen;

	/* Obtain the name of the file being deleted. */
	pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter( pcCommandString, uxFirstParameter, &xParameterStringLength );

	/* Terminate the parameter string. */
	pcParameter[ xParameterStringLength ] = 0x00;

	if( f_unlink( ( const TCHAR * ) pcParameter ) != FR_OK )
	{
		snprintf( ( char * ) pcWriteBuffer, xWriteBufferLen, "Could not delete %s\r\n\r\n", pcParameter );
	}

	/* There is only ever one string to return. */
	return pdFALSE;
}
开发者ID:cisarnet,项目名称:Vocoder,代码行数:23,代码来源:SPI-interface-to-SD-card.c


示例12: prvDELCommand

static portBASE_TYPE prvDELCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{
const char *pcParameter;
portBASE_TYPE xParameterStringLength;
unsigned char ucReturned;

	/* This function assumes xWriteBufferLen is large enough! */
	( void ) xWriteBufferLen;

	/* Obtain the parameter string. */
	pcParameter = FreeRTOS_CLIGetParameter
						(
							pcCommandString,		/* The command string itself. */
							1,						/* Return the first parameter. */
							&xParameterStringLength	/* Store the parameter string length. */
						);

	/* Sanity check something was returned. */
	configASSERT( pcParameter );

	/* Attempt to delete the file. */
	ucReturned = f_delete( pcParameter );

	if( ucReturned == F_NO_ERROR )
	{
		sprintf( pcWriteBuffer, "%s was deleted", pcParameter );
	}
	else
	{
		sprintf( pcWriteBuffer, "Error" );
	}

	strcat( pcWriteBuffer, cliNEW_LINE );

	return pdFALSE;
}
开发者ID:Eclo,项目名称:FreeRTOS,代码行数:36,代码来源:File-releated-CLI-commands.c


示例13: prvCDCommand

static portBASE_TYPE prvCDCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{
const char *pcParameter;
portBASE_TYPE xParameterStringLength;
unsigned char ucReturned;
size_t xStringLength;

	/* Obtain the parameter string. */
	pcParameter = FreeRTOS_CLIGetParameter
						(
							pcCommandString,		/* The command string itself. */
							1,						/* Return the first parameter. */
							&xParameterStringLength	/* Store the parameter string length. */
						);

	/* Sanity check something was returned. */
	configASSERT( pcParameter );

	/* Attempt to move to the requested directory. */
	ucReturned = f_chdir( pcParameter );

	if( ucReturned == F_NO_ERROR )
	{
		sprintf( pcWriteBuffer, "In: " );
		xStringLength = strlen( pcWriteBuffer );
		f_getcwd( &( pcWriteBuffer[ xStringLength ] ), ( unsigned char ) ( xWriteBufferLen - xStringLength ) );
	}
	else
	{
		sprintf( pcWriteBuffer, "Error" );
	}

	strcat( pcWriteBuffer, cliNEW_LINE );

	return pdFALSE;
}
开发者ID:Eclo,项目名称:FreeRTOS,代码行数:36,代码来源:File-releated-CLI-commands.c


示例14: LCD_MoveCommand

/**
 * @param	pcWriteBuffer
 * @param	xWriteBufferLen
 * @param	pcCommandString
 * @return
 */
static BaseType_t LCD_MoveCommand(char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString)
{
	const char *parameterPtr;
	int32_t paramterLen;
	uint32_t mode;

	parameterPtr = FreeRTOS_CLIGetParameter(pcCommandString, 1, &paramterLen);
	mode = DecToInt((char *) parameterPtr, paramterLen);

	switch(mode)
	{
		case 3:
			LCD_ScrollRight();
			break;

		case 2:
			LCD_ScrollLeft();
			break;

		case 1:
			LCD_CursorMoveRight();
			break;

		case 0:
			LCD_CursorMoveLeft();
			break;

		default:
			break;
	}

	sprintf(pcWriteBuffer, "\n");

	return pdFALSE;

}
开发者ID:dinowchang,项目名称:stm32-watering,代码行数:42,代码来源:lcd1602-test.c


示例15: prvCOPYCommand

static portBASE_TYPE prvCOPYCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{
const char *pcDestinationFile;
char *pcSourceFile;
portBASE_TYPE xParameterStringLength;
long lSourceLength, lDestinationLength = 0;

	/* Obtain the name of the destination file. */
	pcDestinationFile = FreeRTOS_CLIGetParameter
							(
								pcCommandString,		/* The command string itself. */
								2,						/* Return the second parameter. */
								&xParameterStringLength	/* Store the parameter string length. */
							);

	/* Sanity check something was returned. */
	configASSERT( pcDestinationFile );

	/* Obtain the name of the source file. */
	pcSourceFile = ( char * ) FreeRTOS_CLIGetParameter
								(
									pcCommandString,		/* The command string itself. */
									1,						/* Return the first parameter. */
									&xParameterStringLength	/* Store the parameter string length. */
								);

	/* Sanity check something was returned. */
	configASSERT( pcSourceFile );

	/* Terminate the string. */
	pcSourceFile[ xParameterStringLength ] = 0x00;

	/* See if the source file exists, obtain its length if it does. */
	lSourceLength = f_filelength( pcSourceFile );

	if( lSourceLength == 0 )
	{
		sprintf( pcWriteBuffer, "Source file does not exist" );
	}
	else
	{
		/* See if the destination file exists. */
		lDestinationLength = f_filelength( pcDestinationFile );

		if( lDestinationLength != 0 )
		{
			sprintf( pcWriteBuffer, "Error: Destination file already exists" );
		}
	}

	/* Continue only if the source file exists and the destination file does
	not exist. */
	if( ( lSourceLength != 0 ) && ( lDestinationLength == 0 ) )
	{
		if( prvPerformCopy( pcSourceFile, lSourceLength, pcDestinationFile, pcWriteBuffer, xWriteBufferLen ) == pdPASS )
		{
			sprintf( pcWriteBuffer, "Copy made" );
		}
		else
		{
			sprintf( pcWriteBuffer, "Error during copy" );
		}
	}

	strcat( pcWriteBuffer, cliNEW_LINE );

	return pdFALSE;
}
开发者ID:Eclo,项目名称:FreeRTOS,代码行数:68,代码来源:File-releated-CLI-commands.c


示例16: prvTYPECommand

static portBASE_TYPE prvTYPECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{
const char *pcParameter;
portBASE_TYPE xParameterStringLength, xReturn = pdTRUE;
static F_FILE *pxFile = NULL;
int iChar;
size_t xByte;
size_t xColumns = 50U;

	/* Ensure there is always a null terminator after each character written. */
	memset( pcWriteBuffer, 0x00, xWriteBufferLen );

	/* Ensure the buffer leaves space for the \r\n. */
	configASSERT( xWriteBufferLen > ( strlen( cliNEW_LINE ) * 2 ) );
	xWriteBufferLen -= strlen( cliNEW_LINE );

	if( xWriteBufferLen < xColumns )
	{
		/* Ensure the loop that uses xColumns as an end condition does not
		write off the end of the buffer. */
		xColumns = xWriteBufferLen;
	}

	if( pxFile == NULL )
	{
		/* The file has not been opened yet.  Find the file name. */
		pcParameter = FreeRTOS_CLIGetParameter
							(
								pcCommandString,		/* The command string itself. */
								1,						/* Return the first parameter. */
								&xParameterStringLength	/* Store the parameter string length. */
							);

		/* Sanity check something was returned. */
		configASSERT( pcParameter );

		/* Attempt to open the requested file. */
		pxFile = f_open( pcParameter, "r" );
	}

	if( pxFile != NULL )
	{
		/* Read the next chunk of data from the file. */
		for( xByte = 0; xByte < xColumns; xByte++ )
		{
			iChar = f_getc( pxFile );

			if( iChar == -1 )
			{
				/* No more characters to return. */
				f_close( pxFile );
				pxFile = NULL;
				break;
			}
			else
			{
				pcWriteBuffer[ xByte ] = ( char ) iChar;
			}
		}
	}

	if( pxFile == NULL )
	{
		/* Either the file was not opened, or all the data from the file has
		been returned and the file is now closed. */
		xReturn = pdFALSE;
	}

	strcat( pcWriteBuffer, cliNEW_LINE );

	return xReturn;
}
开发者ID:Eclo,项目名称:FreeRTOS,代码行数:72,代码来源:File-releated-CLI-commands.c


示例17: motorCommand

static portBASE_TYPE motorCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
{
	int8_t *pcParameterString1, *pcParameterString2, *pcParameterString3; 
	portBASE_TYPE xParameterStringLength1 = 0, xParameterStringLength2 = 0, xParameterStringLength3 = 0;
	
	/* Remove compile time warnings about unused parameters, and check the
	write buffer is not NULL.  NOTE - for simplicity, this example assumes the
	write buffer length is adequate, so does not check for buffer overflows. */
	( void ) xWriteBufferLen;
	configASSERT( pcWriteBuffer );
	
	/* Obtain the 1st parameter string. */
	pcParameterString1 = ( int8_t * ) FreeRTOS_CLIGetParameter
								(
									pcCommandString,		/* The command string itself. */
									1,						/* Return the first parameter. */
									&xParameterStringLength1	/* Store the parameter string length. */
								);

	/* Obtain the 2nd parameter string. */
	pcParameterString2 = ( int8_t * ) FreeRTOS_CLIGetParameter (pcCommandString, 2, &xParameterStringLength2);

	/* Obtain the 3rd parameter string. */
	pcParameterString3 = ( int8_t * ) FreeRTOS_CLIGetParameter (pcCommandString, 3, &xParameterStringLength3);

	/* Read the motor port */
	if( pcParameterString1 != NULL )
	{	
		if (pcParameterString1[0] == 'P' || pcParameterString1[0] == 'p') 
		{
			motor = ( uint8_t ) atol( ( char * ) (pcParameterString1+1) );	
		}
	}	
	
	strcpy( (char *) pcWriteBuffer, "\r\n" );
	
	/* Read the motor command */
	if( pcParameterString2 != NULL )
	{
		if (!strncmp(( char * ) pcParameterString2, "start", (size_t) xParameterStringLength2)) {
			mode = 1;	
		}	else if (!strncmp(( char * ) pcParameterString2, "stop", (size_t) xParameterStringLength2)) {
			mode = 2;	
		}	else if (!strncmp(( char * ) pcParameterString2, "min", (size_t) xParameterStringLength2)) {
			mode = 5;	
		}	else if (!strncmp(( char * ) pcParameterString2, "maxCW", (size_t) xParameterStringLength2)) {
			mode = 6;	
		}	else if (!strncmp(( char * ) pcParameterString2, "maxCCW", (size_t) xParameterStringLength2)) {
			mode = 7;	
//		}	else if (!strncmp(( char * ) pcParameterString2, "middle", (size_t) xParameterStringLength2)) {
//			mode = 4;	
//		}	else if (!strncmp(( char * ) pcParameterString2, "sweep", (size_t) xParameterStringLength2)) {
//			mode = 7;	
//		}	else if (!strncmp(( char * ) pcParameterString2, "angle", (size_t) xParameterStringLength2)) {
//			mode = 3;	
//			if( pcParameterString3 != NULL ) {
//				angle = atoi( ( char * ) (pcParameterString3) );
//			}
		}	else if (!strncmp(( char * ) pcParameterString2, "speed", (size_t) xParameterStringLength2)) {	
			mode = 8;			
			if( pcParameterString3 != NULL ) {
				rate = atof( ( char * ) (pcParameterString3) );
			}
		}
		
	}
	
	

	/* There is no more data to return after this single string, so return
	pdFALSE. */
	return pdFALSE;
}
开发者ID:OUWECAD,项目名称:MOWE,代码行数:73,代码来源:aos_cli.c


示例18: prvThreeParameterEchoCommand

static portBASE_TYPE prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{
const char *pcParameter;
portBASE_TYPE lParameterStringLength, xReturn;
static portBASE_TYPE lParameterNumber = 0;

	/* Remove compile time warnings about unused parameters, and check the
	write buffer is not NULL.  NOTE - for simplicity, this example assumes the
	write buffer length is adequate, so does not check for buffer overflows. */
	( void ) pcCommandString;
	( void ) xWriteBufferLen;
	configASSERT( pcWriteBuffer );

	if( lParameterNumber == 0 )
	{
		/* The first time the function is called after the command has been
		entered just a header string is returned. */
		sprintf( pcWriteBuffer, "The three parameters were:\r\n" );

		/* Next time the function is called the first parameter will be echoed
		back. */
		lParameterNumber = 1L;

		/* There is more data to be returned as no parameters have been echoed
		back yet. */
		xReturn = pdPASS;
	}
	else
	{
		/* Obtain the parameter string. */
		pcParameter = FreeRTOS_CLIGetParameter
						(
							pcCommandString,		/* The command string itself. */
							lParameterNumber,		/* Return the next parameter. */
							&lParameterStringLength	/* Store the parameter string length. */
						);

		/* Sanity check something was returned. */
		configASSERT( pcParameter );

		/* Return the parameter string. */
		memset( pcWriteBuffer, 0x00, xWriteBufferLen );
		sprintf( pcWriteBuffer, "%d: ", lParameterNumber );
		strncat( pcWriteBuffer, pcParameter, lParameterStringLength );
		strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );

		/* If this is the last of the three parameters then there are no more
		strings to return after this one. */
		if( lParameterNumber == 3L )
		{
			/* If this is the last of the three parameters then there are no more
			strings to return after this one. */
			xReturn = pdFALSE;
			lParameterNumber = 0L;
		}
		else
		{
			/* There are more parameters to return after this one. */
			xReturn = pdTRUE;
			lParameterNumber++;
		}
	}

	return xReturn;
}
开发者ID:DanielKristofKiss,项目名称:FreeRTOS,代码行数:65,代码来源:CLI-commands.c


示例19: prvCopyCommand

static portBASE_TYPE prvCopyCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
{
int8_t *pcParameter1, *pcParameter2;
portBASE_TYPE xParameter1StringLength, xParameter2StringLength, xFinished = pdFALSE;
const unsigned portBASE_TYPE uxFirstParameter = 1U, uxSecondParameter = 2U;
UINT xBytesRead, xBytesWritten;
const portTickType xMaxDelay = 500UL / portTICK_RATE_MS;

	( void ) xWriteBufferLen;

	/* Obtain the name of the source file, and the length of its name. */
	pcParameter1 = ( int8_t * ) FreeRTOS_CLIGetParameter( pcCommandString, uxFirstParameter, &xParameter1StringLength );

	/* Obtain the name of the destination file, and the length of its name. */
	pcParameter2 = ( int8_t * ) FreeRTOS_CLIGetParameter( pcCommandString, uxSecondParameter, &xParameter2StringLength );

	/* Terminate both file names. */
	pcParameter1[ xParameter1StringLength ] = 0x00;
	pcParameter2[ xParameter2StringLength ] = 0x00;

	/* Open the source file. */
	if( f_open( &xCommandLineFile1, ( const TCHAR * ) pcParameter1, ( FA_OPEN_EXISTING | FA_READ ) ) == FR_OK )
	{
		/* Open the destination file. */
		if( f_open( &xCommandLineFile2, ( const TCHAR * ) pcParameter2, ( FA_CREATE_ALWAYS | FA_WRITE ) ) == FR_OK )
		{
			while( xFinished == pdFALSE )
			{
				/* About to use the RAM buffer, ensure this task has exclusive access
				to it while it is in use. */
				if( xSemaphoreTake( xRamBufferMutex, xMaxDelay ) == pdPASS )
				{
					if( f_read( &xCommandLineFile1, cRAMBuffer, sizeof( cRAMBuffer ), &xBytesRead ) == FR_OK )
					{
						if( xBytesRead != 0U )
						{
							if( f_write( &xCommandLineFile2, cRAMBuffer, xBytesRead, &xBytesWritten ) == FR_OK )
							{
								if( xBytesWritten < xBytesRead )
								{
									snprintf( ( char * ) pcWriteBuffer, xWriteBufferLen, "Error writing to %s, disk full?\r\n\r\n", pcParameter2 );
									xFinished = pdTRUE;
								}
							}
							else
							{
								snprintf( ( char * ) pcWriteBuffer, xWriteBufferLen, "Error during copy\r\n\r\n" );
								xFinished = pdTRUE;
							}
						}
						else
						{
							/* EOF. */
							xFinished = pdTRUE;
						}
					}
					else
					{
						snprintf( ( char * ) pcWriteBuffer, xWriteBufferLen, "Error during copy\r\n\r\n" );
						xFinished = pdTRUE;
					}
					
					/* Must give the mutex back! */
					xSemaphoreGive( xRamBufferMutex );
				}				
			}

			/* Close both files. */
			f_close( &xCommandLineFile1 );
			f_close( &xCommandLineFile2 );
		}
		else
		{
			snprintf( ( char * ) pcWriteBuffer, xWriteBufferLen, "Could not open or create %s\r\n\r\n", pcParameter2 );

			/* Close the source file. */
			f_close( &xCommandLineFile1 );
		}
	}
	else
	{
		snprintf( ( char * ) pcWriteBuffer, xWriteBufferLen, "Could not open %s\r\n\r\n", pcParameter1 );
	}

	return pdFALSE;
}
开发者ID:cisarnet,项目名称:Vocoder,代码行数:86,代码来源:SPI-interface-to-SD-card.c


示例20: prvCanCmd

portBASE_TYPE prvCanCmd( int8_t *pcWriteBuffer,
						size_t xWriteBufferLen,
						const int8_t *pcCommandString )
{
portCHAR *pcParameter;
portBASE_TYPE lParameterStringLength;
static portSHORT xArgL1;
static portSHORT xArgL2;
static portSHORT xArgL3;
static portUCHAR xArgMsg[8];
static portUCHAR xMsgIdx;
static xCanCmdStates_t xState;
static portBASE_TYPE lParameterNumber = 0;
static xCanCmdElement_t xCanCmdElement;

	(void) xWriteBufferLen;
	pcWriteBuffer[ 0 ] = 0x00;
	portBASE_TYPE xReturn = pdPASS;
	
    if( lParameterNumber == 0 )
    {
		//entering can command parser
        xState = STATE_Z;
		lParameterNumber = 1L;
	} else 
	{
		pcParameter = ( portCHAR * ) FreeRTOS_CLIGetParameter ( pcCommandString,
														lParameterNumber,
														&lParameterStringLength
		);	
		
		if (pcParameter) 
		{
			lParameterNumber++;
			switch (xState) 
			{
			case STATE_Z: //first arg ena dis open close baud mob 
				if (!strncmp(pcParameter, CCC_RESET, CCC_RESET_L)) 
				{
					xState = STATE_RESET;
				} else 
				if (!strncmp(pcParameter, CCC_ENA, CCC_ENA_L)) 
				{
					xState = STATE_ENA;
				} else 
				if (!strncmp(pcParameter, CCC_DIS, CCC_DIS_L)) 
				{
					xState = STATE_DIS;
				} else
				if (!strncmp(pcParameter, CCC_CONF, CCC_CONF_L)) 
				{
					xState = STATE_CONF1;
				} else 
				if (!strncmp(pcParameter, CCC_CLOSE, CCC_CLOSE_L)) 
				{
					xState = STATE_CLOSE;
				} else
				if (!strncmp(pcParameter, CCC_BAUD, CCC_BAUD_L)) 
				{
					xState = STATE_BAUD1;
				} else
				if (!strncmp(pcParameter, CCC_MOB, CCC_MOB_L)) 
				{
					xState = STATE_MOB1;
				} else
				{
					xState = STATE_FAIL;
					xReturn = pdFAIL;
				}
			break;
			case STATE_ENA: //arg: listen
				if (!strncmp(pcParameter, CCC_LISTEN, CCC_LISTEN_L)) 
				{
					xState = STATE_ENALISTEN;
				} else 				
				{
					xState = STATE_FAIL;
					xReturn = pdFAIL;
				}
			break;
			case STATE_CONF1: //arg: #conf
				xArgL1 = strtol(pcParameter,NULL,16);
				xState = STATE_CONFVALUE;
			break;
			case STATE_BAUD1: //arg: auto set get
				if (!strncmp(pcParameter, CCC_AUTO, CCC_AUTO_L)) 
				{
					xState = STATE_BAUDAUTO;
				} else 				
				if (!strncmp(pcParameter, CCC_GET, CCC_GET_L)) 
				{
					xState = STATE_BAUDGET;
				} else 				
				if (!strncmp(pcParameter, CCC_SET, CCC_SET_L)) 
				{
					xState = STATE_BAUDSET1;
				} else 				
				{
					xState = STATE_FAIL;
					xReturn = pdFAIL;
//.........这里部分代码省略.........
开发者ID:ievosabo,项目名称:Canner,代码行数:101,代码来源:FreeRTOS_can_cli.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FreeRTOS_htons函数代码示例发布时间:2022-05-30
下一篇:
C++ FreeRCString函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap