void status_setTestStatus(Bsm2Status new_status) { if (testmode()) { curr_status = new_status; LOG_INFO("Changing status to %s\n", status_names[new_status]); } }
static void cutoff_cut(void) { if (!cut && !testmode()) { cut = true; cutoff_procedure(0xdead); } }
void main(void) { uart0_9600_init(); leds_init_and_switches(); //Leds initialization //dc_motor_init(); //Start Dc motors ATD0CTL1=0x87; // no external trigger ATD0CTL2_ADPU=1; // ATD Enable ATD0CTL2_ETRIGE=0; // no external trigger ATD0CTL3_S8C=1; // 8 adc channels sequence ATD0CTL4_SRES8=1; // 8-bit Resolution for(;;) { ATD0CTL5=0x10; // multisequence //This will start a new convesion Delay(1); a[0] = ATD0DR0H; a[1] = ATD0DR1H; a[2] = ATD0DR2H; a[3] = ATD0DR3H; a[4] = ATD0DR4H; a[5] = ATD0DR5H; a[6] = ATD0DR6H; a[7] = ATD0DR7H; testmode(); /* if(ATD0STAT0_SCF==1) // on sequence completion { if(compensate_value(ATD0DR7H,7) <=5 && compensate_value(ATD0DR6H,6) <=5 && compensate_value(ATD0DR5H,5) <=5 && compensate_value(ATD0DR4H,4) <=5 && compensate_value(ATD0DR3H,3) <=5 && compensate_value(ATD0DR2H,2) <=5 && compensate_value(ATD0DR1H,1) <=5 && compensate_value(ATD0DR0H,0) <=5) { //ATDSTAT0_SCF=0; The flag clears automatically when we access status register and then the resukt register.. //calculate error LED2=1; //dc_motor_stop(); //motor stop } } */ } }
void cutoff_test_cut(bool on) { if (testmode()) { if (on) { for (int i = 0; i < N_CUTOFF; i++) CUTOFF_ENABLE(i, true); } else { for (int i = 0; i < N_CUTOFF; i++) CUTOFF_ENABLE(i, false); } } }
int main(int argc, char **argv) { if (argc > 1 && strcmp(argv[1], "test") == 0) { duphash_init(&top_hash, 500, 4); duphash_init(&bottom_hash, 500, 4); return (testmode()); } else { char *fn, *f; unsigned hashsize=500; unsigned duplevel=4; unsigned nthreads=4; fn=config_localfilename("filters/dupfilter-hashsize"); if ( (f=config_read1l(fn)) != 0) { sscanf(f, "%u", &hashsize); free(f); } free(fn); fn=config_localfilename("filters/dupfilter-duplevel"); if ( (f=config_read1l(fn)) != 0) { sscanf(f, "%u", &duplevel); free(f); } free(fn); fn=config_localfilename("filters/dupfilter-nthreads"); if ( (f=config_read1l(fn)) != 0) { sscanf(f, "%u", &nthreads); free(f); } free(fn); duphash_init(&top_hash, hashsize, duplevel); duphash_init(&bottom_hash, hashsize, duplevel); return (realmode(nthreads)); } }
int main(int argc, char **argv) { QCoreApplication app(argc, argv); app.setApplicationVersion("1.0"); #ifdef Q_OS_WIN const QLatin1Char pathsep(';'); #else const QLatin1Char pathsep(':'); #endif QCommandLineParser parser; parser.setApplicationDescription(QCoreApplication::translate("qtpaths", "Command line client to QStandardPaths")); parser.addPositionalArgument(QCoreApplication::translate("qtpaths", "[name]"), QCoreApplication::tr("Name of file or directory")); parser.addHelpOption(); parser.addVersionOption(); //setting up options QCommandLineOption types(QStringLiteral("types"), QCoreApplication::translate("qtpaths", "Available location types.")); parser.addOption(types); QCommandLineOption paths(QStringLiteral("paths"), QCoreApplication::translate("qtpaths", "Find paths for <type>."), QStringLiteral("type")); parser.addOption(paths); QCommandLineOption writablePath(QStringLiteral("writable-path"), QCoreApplication::translate("qtpaths", "Find writable path for <type>."), QStringLiteral("type")); parser.addOption(writablePath); QCommandLineOption locateDir(QStringList() << QStringLiteral("locate-dir") << QStringLiteral("locate-directory"), QCoreApplication::translate("qtpaths", "Locate directory [name] in <type>."), QStringLiteral("type")); parser.addOption(locateDir); QCommandLineOption locateDirs(QStringList() << QStringLiteral("locate-dirs") << QStringLiteral("locate-directories"), QCoreApplication::translate("qtpaths", "Locate directories [name] in all paths for <type>."), QStringLiteral("type")); parser.addOption(locateDirs); QCommandLineOption locateFile(QStringLiteral("locate-file"), QCoreApplication::translate("qtpaths", "Locate file [name] for <type>."), QStringLiteral("type")); parser.addOption(locateFile); QCommandLineOption locateFiles(QStringLiteral("locate-files"), QCoreApplication::translate("qtpaths", "Locate files [name] in all paths for <type>."), QStringLiteral("type")); parser.addOption(locateFiles); QCommandLineOption findExe(QStringList() << QStringLiteral("find-exe") << QStringLiteral("find-executable"), QCoreApplication::translate("qtpaths", "Find executable with [name].")); parser.addOption(findExe); QCommandLineOption display(QStringList() << QStringLiteral("display"), QCoreApplication::translate("qtpaths", "Prints user readable name for <type>."), QStringLiteral("type")); parser.addOption(display); QCommandLineOption testmode(QStringList() << QStringLiteral("testmode") << QStringLiteral("test-mode"), QCoreApplication::translate("qtpaths", "Use paths specific for unit testing.")); parser.addOption(testmode); QCommandLineOption qtversion(QStringLiteral("qt-version"), QCoreApplication::translate("qtpaths", "Qt version.")); parser.addOption(qtversion); QCommandLineOption installprefix(QStringLiteral("install-prefix"), QCoreApplication::translate("qtpaths", "Installation prefix for Qt.")); parser.addOption(installprefix); QCommandLineOption bindir(QStringList() << QStringLiteral("binaries-dir") << QStringLiteral("binaries-directory"), QCoreApplication::translate("qtpaths", "Location of Qt executables.")); parser.addOption(bindir); QCommandLineOption plugindir(QStringList() << QStringLiteral("plugin-dir") << QStringLiteral("plugin-directory"), QCoreApplication::translate("qtpaths", "Location of Qt plugins.")); parser.addOption(plugindir); parser.process(app); QStandardPaths::enableTestMode(parser.isSet(testmode)); QStringList results; if (parser.isSet(qtversion)) { QString qtversionstring = QString::fromLatin1(qVersion()); results << qtversionstring; } if (parser.isSet(installprefix)) { QString path = QLibraryInfo::location(QLibraryInfo::PrefixPath); results << path; } if (parser.isSet(bindir)) { QString path = QLibraryInfo::location(QLibraryInfo::BinariesPath); results << path; } if (parser.isSet(plugindir)) { QString path = QLibraryInfo::location(QLibraryInfo::PluginsPath); results << path; } if (parser.isSet(types)) { QStringList typesList = ::types(); results << typesList.join('\n'); } if (parser.isSet(display)) { QStandardPaths::StandardLocation location = parseLocationOrError(parser.value(display)); QString text = QStandardPaths::displayName(location); results << text; } if (parser.isSet(paths)) { QStandardPaths::StandardLocation location = parseLocationOrError(parser.value(paths)); QStringList paths = QStandardPaths::standardLocations(location); results << paths.join(pathsep); } if (parser.isSet(writablePath)) { QStandardPaths::StandardLocation location = parseLocationOrError(parser.value(writablePath)); QString path = QStandardPaths::writableLocation(location); results << path; } if (parser.isSet(findExe)) { QString searchitem = searchStringOrError(&parser); QString path = QStandardPaths::findExecutable(searchitem); results << path; } if (parser.isSet(locateDir)) { QStandardPaths::StandardLocation location = parseLocationOrError(parser.value(locateDir)); QString searchitem = searchStringOrError(&parser); QString path = QStandardPaths::locate(location, searchitem, QStandardPaths::LocateDirectory); results << path; } if (parser.isSet(locateFile)) { QStandardPaths::StandardLocation location = parseLocationOrError(parser.value(locateFile)); QString searchitem = searchStringOrError(&parser); QString path = QStandardPaths::locate(location, searchitem, QStandardPaths::LocateFile); results << path; } if (parser.isSet(locateDirs)) { QStandardPaths::StandardLocation location = parseLocationOrError(parser.value(locateDirs)); QString searchitem = searchStringOrError(&parser); QStringList paths = QStandardPaths::locateAll(location, searchitem, QStandardPaths::LocateDirectory); results << paths.join(pathsep); } if (parser.isSet(locateFiles)) { QStandardPaths::StandardLocation location = parseLocationOrError(parser.value(locateFiles)); QString searchitem = searchStringOrError(&parser); QStringList paths = QStandardPaths::locateAll(location, searchitem, QStandardPaths::LocateFile); results << paths.join(pathsep); } if (results.isEmpty()) { parser.showHelp(); } else if (results.size() == 1) { const QString &item = results.first(); message(item); if (item.isEmpty()) return EXIT_FAILURE; } else { QString errorMessage = QCoreApplication::translate("qtpaths", "Several options given, only one is supported at a time."); error(errorMessage); } return EXIT_SUCCESS; }
int main(int argc, char *argv[]) { int mode, mode2; int i, high; vga_init(); /* Initialize. */ mode = -1; mode2= -1; if(argc==2) { mode = atoi(argv[1]); } else if(argc==3) { mode = atoi(argv[1]); mode2= atoi(argv[2]); } if (mode == -1) { printf("Choose one of the following video modes: \n"); high = 0; for (i = 1; i <= vga_lastmodenumber(); i++) if (vga_hasmode(i)) { vga_modeinfo *info; char expl[100]; const char *cols = NULL; *expl = '\0'; info = vga_getmodeinfo(i); switch (info->colors) { case 2: cols = "2"; strcpy(expl, "1 bitplane, monochrome"); break; case 16: cols = "16"; strcpy(expl, "4 bitplanes"); break; case 256: if (i == G320x200x256) strcpy(expl, "packed-pixel"); else if (i == G320x240x256 || i == G320x400x256 || i == G360x480x256) strcpy(expl, "Mode X"); else strcpy(expl, "packed-pixel, banked"); break; case 1 << 15: cols = "32K"; strcpy(expl, "5-5-5 RGB, blue at LSB, banked"); break; case 1 << 16: cols = "64K"; strcpy(expl, "5-6-5 RGB, blue at LSB, banked"); break; case 1 << 24: cols = "16M"; if (info->bytesperpixel == 3) { if (info->flags & RGB_MISORDERED) strcpy(expl, "8-8-8 BGR, red byte first, banked"); else strcpy(expl, "8-8-8 RGB, blue byte first, banked"); } else if (info->flags & RGB_MISORDERED) strcpy(expl, "8-8-8 RGBX, 32-bit pixels, X byte first, banked"); else strcpy(expl, "8-8-8 XRGB, 32-bit pixels, blue byte first, banked"); break; } if (info->flags & IS_INTERLACED) { if (*expl != '\0') strcat(expl, ", "); strcat(expl, "interlaced"); } if (info->flags & IS_DYNAMICMODE) { if (*expl != '\0') strcat(expl, ", "); strcat(expl, "dynamically loaded"); } high = i; printf("%5d: %dx%d, ", i, info->width, info->height); if (cols == NULL) printf("%d", info->colors); else printf("%s", cols); printf(" colors "); if (*expl != '\0') printf("(%s)", expl); printf("\n"); } printf("Enter mode number (1-%d): ", high); scanf("%d", &mode); getchar(); printf("\n"); if (mode < 1 || mode > GLASTMODE) { printf("Error: Mode number out of range \n"); exit(-1); } } if (vga_hasmode(mode)) { testmode(mode); if(mode2!=-1 && vga_hasmode(mode2)) { testmode(mode2); } } else { printf("Error: Video mode not supported by driver\n"); exit(-1); } vga_setmode(TEXT); return 0; }