void CommandLine(void)
{
	u08 c;
	/* Variable to Run or stop program */
	Run = TRUE;

	/* Clears the screen and sets the cursor under the Title */
	vt100ClearScreen();
	vt100SetCursorPos(1,0);

	rprintfProgStrM("\r\n\t\t\tStepper Motor Driver - Serial Console\r\n");

	cmdlineInit();
	cmdlineSetOutputFunc(uartSendByte);

	cmdlineAddCommand("quit", quitCommandLine);
	cmdlineAddCommand("help", helpDisplay);
	cmdlineAddCommand("step", runMotor);

	cmdlineInputFunc('\r');

	while(Run)
	{
		while( uartReceiveByte(&c) )
			cmdlineInputFunc(c);

		cmdlineMainLoop();

	}

	rprintfCRLF();
	rprintf("Program halted.");


}
void menuInit(void) {
  cmdlineSetOutputFunc(DGB_Menu_Output);                                        //set function for character output for commandline interface
  cmdlineInit();                                                                // initialize command line interface                                                    

  // add commands to commandline interface command list
  cmdlineAddCommand("help",help_descr);
  cmdlineAddCommand("set-time",setTime);
  cmdlineAddCommand("set-date",setDate);
  cmdlineAddCommand("set-id",set_ID);
  cmdlineAddCommand("set-mac", set_MAC);
  cmdlineAddCommand("set-localip", set_LocalIP);
  cmdlineAddCommand("set-serverip", set_RemoteIP);
  cmdlineAddCommand("set-mask", set_MaskIP);
  cmdlineAddCommand("set-phone",set_Phone);
  cmdlineAddCommand("set-gps",set_GPS);
  cmdlineAddCommand("test-gsm",gsm);
  cmdlineAddCommand("test-ethernet", eth_test);
  cmdlineAddCommand("interlock", InterlockToggle);
  cmdlineAddCommand("system", show_sys);
  cmdlineAddCommand("go-bootloader", bootloader);

  cmdlineAddCommand("scani2c", show_i2c);
  cmdlineAddCommand("ina", show_ina);
  //cmdlineAddCommand("calibtx", calibrate_tx);
  //cmdlineAddCommand("calibrx", calibrate_rx);

}
Exemple #3
0
/*------------------------------------------------------------------------------------*/
void tkCmd(void * pvParameters)
{

u08 c;
u08 ticks;
( void ) pvParameters;

	while ( !startTask )
		vTaskDelay( ( TickType_t)( 100 / portTICK_RATE_MS ) );

	cmdlineInit();
	cmdlineSetOutputFunc(pvFreeRTOS_UART1_writeChar);

	cmdlineAddCommand((u08 *)("cls"), cmdClearScreen );
	cmdlineAddCommand((u08 *)("help"), cmdHelpFunction);
	cmdlineAddCommand((u08 *)("reset"), cmdResetFunction);
	cmdlineAddCommand((u08 *)("read"), cmdReadFunction);
	cmdlineAddCommand((u08 *)("write"), cmdWriteFunction);
	cmdlineAddCommand((u08 *)("redial"), cmdRedialFunction);
	cmdlineAddCommand((u08 *)("status"), cmdStatusFunction);


	// Espero la notificacion para arrancar
	vTaskDelay( ( TickType_t)( 500 / portTICK_RATE_MS ) );

	snprintf_P( cmd_printfBuff,sizeof(cmd_printfBuff),PSTR("starting tkCmd..\r\n\0"));
	FreeRTOS_write( &pdUART1, cmd_printfBuff, sizeof(cmd_printfBuff) );

	ticks = 1;
	FreeRTOS_ioctl( &pdUART1,ioctlSET_TIMEOUT, &ticks );

	// loop
	for( ;; )
	{
		u_clearWdg(WDG_CMD);

		c = '\0';	// Lo borro para que luego del un CR no resetee siempre el timer.
		// el read se bloquea 50ms. lo que genera la espera.
		while ( FreeRTOS_read( &pdUART1, &c, 1 ) == 1 ) {
			cmdlineInputFunc(c);
		}

		/* run the cmdline execution functions */
		cmdlineMainLoop();
	}
}
Exemple #4
0
void goCmdline(void)
{
	u08 c;

	// print welcome message
	vt100ClearScreen();
	vt100SetCursorPos(1,0);
	rprintfProgStrM("\r\nWelcome to the Command Line Test Suite!\r\n");

	// initialize cmdline system
	cmdlineInit();

	// direct cmdline output to uart (serial port)
	cmdlineSetOutputFunc(uartSendByte);

	// add commands to the command database
	cmdlineAddCommand("exit",		exitFunction);
	cmdlineAddCommand("help",		helpFunction);
	cmdlineAddCommand("dumpargs1",	dumpArgsStr);
	cmdlineAddCommand("dumpargs2",	dumpArgsInt);
	cmdlineAddCommand("dumpargs3",	dumpArgsHex);

	// send a CR to cmdline input to stimulate a prompt
	cmdlineInputFunc('\r');

	// set state to run
	Run = TRUE;

	// main loop
	while(Run)
	{
		// pass characters received on the uart (serial port)
		// into the cmdline processor
		while(uartReceiveByte(&c)) cmdlineInputFunc(c);

		// run the cmdline execution functions
		cmdlineMainLoop();
	}

	rprintfCRLF();
	rprintf("Exited program!\r\n");
}