int appInit(int argc, char **argv) { const char *opt; _flubAppCtx.launchedFromConsole = _appLaunchedFromConsole(); if((opt = strrchr(argv[0], PLATFORM_PATH_SEP)) != NULL) { _flubAppCtx.progName = opt; } else { _flubAppCtx.progName = argv[0]; } if((!logInit()) || (!cmdlineInit(argc, argv)) || (!flubSDLInit()) || (!flubPhysfsInit(argv[0])) || (!flubCfgInit()) || (!videoInit()) || (!texmgrInit()) || (!flubFontInit()) || (!gfxInit()) || (!audioInit()) || (!inputInit()) || (!consoleInit()) || (!flubGuiThemeInit()) ) { return 0; } return 1; }
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); }
int main(int argc, char **argv) { char ch; cprintf("Main started\nVersion: "); cprintf(MAIN_VERSION); cprintf("\n"); for (ch = 0; ch < 26; ch++) { osram_write(osram_init[ch]); }; rs485Init(); steppersInit(); cmdlineInit(); cmdlineAddCommand("help", do_help); cmdlineAddCommand("?", do_help); cmdlineAddCommand("dump", do_dump); cmdlineAddCommand("ls", do_ls); cmdlineAddCommand("dir", do_ls); cmdlineAddCommand("mv", do_rename); cmdlineAddCommand("rename", do_rename); cmdlineAddCommand("rm", do_rm); cmdlineAddCommand("delete", do_rm); cmdlineAddCommand("spi_speed", do_spi_speed); cmdlineAddCommand("osram", do_osram); cmdlineAddCommand("flash", do_flash); cmdlineAddCommand("readmem", do_readmem); cmdlineAddCommand("rd", do_rd); cmdlineAddCommand("wr", do_wr); cmdlineAddCommand("rd32", do_rd32); cmdlineAddCommand("wr32", do_wr32); cmdlineAddCommand("step", do_step); cmdlineAddCommand("build", do_build); cmdlineAddCommand("sendcmd", do_sendcmd); cmdlineAddCommand("reset", (void *)0xE000); cmdlinePrintPrompt(); while (1) { if (getc_nowait(&ch)) { cmdlineInputFunc(ch); }; cmdlineMainLoop(); rs485MainLoop(); steppersMainLoop(); }; cprintf("\ndone\n"); return 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(); } }
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"); }