示例#1
0
int main(int argc, char**argv) {
    KcwApp app;
//     HANDLE timer = CreateWaitableTimer(NULL, FALSE, NULL);
    int retval = 0;

//     LARGE_INTEGER li;
//     li.QuadPart = -30 * 1000000LL; // 2 seconds
//     SetWaitableTimer(timer, &li, 0, NULL, NULL, FALSE);
//     app.addCallback(timer, CB(KcwApp::quit));
//     retval = app.exec();
    retval = startConsole();
    return retval;
}
示例#2
0
void initializeConsole(Logging *sharedLogger) {
	initConsoleLogic(sharedLogger);

	startConsole(sharedLogger, &handleConsoleLine);

	sayHello();
	addConsoleAction("test", sayNothing);
	addConsoleAction("hello", sayHello);
#if EFI_HAS_RESET
	addConsoleAction("reset", scheduleReset);
#endif

	addConsoleAction("fatal", myfatal);
	addConsoleAction("error", myerror);
	addConsoleAction("threadsinfo", cmd_threads);
}
示例#3
0
/**
 * Application entry point.
 */
int main(void)
{
    /*
     * System initializations.
     * - HAL initialization, this also initializes the configured device drivers
     *   and performs the board-specific initializations.
     * - Kernel initialization, the main() function becomes a thread and the
     *   RTOS is active.
     */

    halInit();
    chSysInit();
    sdStart(&CONSOLE, &sdConfig);
    chprintf((BaseSequentialStream *)&CONSOLE, "GENIST SPIF\r\n");

    /*
     * Shell manager initialization.
     */
    shellInit();

    /* Get database from Flash */
    chprintf((BaseSequentialStream *)&CONSOLE, "Restoring database\r\n");
    dbRestore();
    chThdSleepMilliseconds(1000);

    // disable analog status
    // enableAstatus(0);

    palClearPad(OUT_AXLE1_PORT, OUT_AXLE1_PIN);
    palClearPad(OUT_AXLE2_PORT, OUT_AXLE2_PIN);
    palClearPad(OUT_AXLE3_PORT, OUT_AXLE3_PIN);
    palClearPad(OUT_AXLE4_PORT, OUT_AXLE4_PIN);
    palClearPad(OUT_BACKUP2_PORT, OUT_BACKUP2_PIN);
    palClearPad(OUT_BACKUP_PORT, OUT_BACKUP_PIN);
    palClearPad(OUT_ACTIVECOOL_PORT, OUT_ACTIVECOOL_PIN);
    palClearPad(OUT_FLOCK_PORT, OUT_FLOCK_PIN);
    palClearPad(OUT_LOCK_PORT, OUT_LOCK_PIN);
    palClearPad(OUT_BULBCHECK_PORT, OUT_BULBCHECK_PIN);
    palClearPad(OUT_LEDPOWER_PORT, OUT_LEDPOWER_PIN);
    palClearPad(OUT_SENSPOWER_PORT, OUT_SENSPOWER_PIN);
    palClearPad(LED_STBY_PAD, LED_STBY_PIN);

//    enableAstatus(0);

//    StateMachineMailboxInit();
//    startThreadStateMachine();
//    startThreadSpeed();
//    startThreadBlinker();
//    startThreadPressureSensor();
    startThreadSDADC();
    //startThreadMonitor();
#ifdef GENIST_USE_RTD
    startThreadRTD();
#endif
//    initHazard();
    /*
     * Normal main() thread activity, it does nothing except sleeping in a loop.
     */
#ifdef START_JSON
    startJSON();
#endif
    while (TRUE)
    {
#ifndef START_JSON
        if (!shelltp)
        {
            /* Spawns a new shell.*/
            shelltp = startConsole();
        }
        else
        {
            /* If the previous shell exited.*/
            if (chThdTerminated(shelltp))
            {
                /* Recovers memory of the previous shell.*/
                chThdRelease(shelltp);
                shelltp = NULL;
                dbgprint_enable = FALSE;
            }
        }
#else
#endif
        chThdSleepMilliseconds(10000);
    }
}