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


C++ FreeRTOS_CLIGetParameter函数代码示例

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


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


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