void HAL_Linux::init(int argc,char* const argv[]) const { int opt; /* parse command line options */ while ((opt = getopt(argc, argv, "A:B:C:h")) != -1) { switch (opt) { case 'A': uartADriver.set_device_path(optarg); break; case 'B': uartBDriver.set_device_path(optarg); break; case 'C': uartCDriver.set_device_path(optarg); break; case 'h': printf("Usage: -A uartAPath -B uartBPath -C uartCPath\n"); exit(0); default: printf("Unknown option '%c'\n", (char)opt); exit(1); } } scheduler->init(NULL); uartA->begin(115200); i2c->begin(); spi->init(NULL); }
void HAL_Linux::init(int argc,char* const argv[]) const { int opt; const struct GetOptLong::option options[] = { {"uartA", true, 0, 'A'}, {"uartB", true, 0, 'B'}, {"uartC", true, 0, 'C'}, {"uartE", true, 0, 'E'}, {"log-directory", true, 0, 'l'}, {"terrain-directory", true, 0, 't'}, {"help", false, 0, 'h'}, {0, false, 0, 0} }; GetOptLong gopt(argc, argv, "A:B:C:E:l:t:h", options); /* parse command line options */ while ((opt = gopt.getoption()) != -1) { switch (opt) { case 'A': uartADriver.set_device_path(gopt.optarg); break; case 'B': uartBDriver.set_device_path(gopt.optarg); break; case 'C': uartCDriver.set_device_path(gopt.optarg); break; case 'E': uartEDriver.set_device_path(gopt.optarg); break; case 'l': utilInstance.set_custom_log_directory(gopt.optarg); break; case 't': utilInstance.set_custom_terrain_directory(gopt.optarg); break; case 'h': _usage(); exit(0); default: printf("Unknown option '%c'\n", (char)opt); exit(1); } } scheduler->init(NULL); gpio->init(); i2c->begin(); rcout->init(NULL); rcin->init(NULL); uartA->begin(115200); uartE->begin(115200); spi->init(NULL); analogin->init(NULL); utilInstance.init(argc+gopt.optind, &argv[gopt.optind]); }
void HAL_Linux::init(int argc,char* const argv[]) const { int opt; /* parse command line options */ while ((opt = getopt(argc, argv, "A:B:C:E:h")) != -1) { switch (opt) { case 'A': uartADriver.set_device_path(optarg); break; case 'B': uartBDriver.set_device_path(optarg); break; case 'C': uartCDriver.set_device_path(optarg); break; case 'E': uartEDriver.set_device_path(optarg); break; case 'h': _usage(); exit(0); default: printf("Unknown option '%c'\n", (char)opt); exit(1); } } scheduler->init(NULL); gpio->init(); i2c->begin(); rcout->init(NULL); rcin->init(NULL); uartA->begin(115200); uartE->begin(115200); spi->init(NULL); analogin->init(NULL); utilInstance.init(argc, argv); }