i2c_spi_buses:Track NuttX change to getopts avoid name collision

NuttX #defined optarg and getopt to move to TLS. This fixes the
  name collision.
This commit is contained in:
David Sidrane
2021-04-20 10:47:11 -07:00
committed by Julian Oes
parent 64db89ab20
commit 84dd8839a2
55 changed files with 245 additions and 214 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (C) 2020 PX4 Development Team. All rights reserved.
* Copyright (C) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -51,15 +51,15 @@ static pthread_mutex_t i2c_spi_module_instances_mutex = PTHREAD_MUTEX_INITIALIZE
const char *BusCLIArguments::parseDefaultArguments(int argc, char *argv[])
{
if (getopt(argc, argv, "") == EOF) {
return optarg();
if (getOpt(argc, argv, "") == EOF) {
return optArg();
}
// unexpected arguments
return nullptr;
}
int BusCLIArguments::getopt(int argc, char *argv[], const char *options)
int BusCLIArguments::getOpt(int argc, char *argv[], const char *options)
{
if (_options[0] == 0) { // need to initialize
if (!validateConfiguration()) {
@@ -92,13 +92,13 @@ public:
/**
* Like px4_getopt(), but adds and handles i2c/spi driver-specific arguments
*/
int getopt(int argc, char *argv[], const char *options);
int getOpt(int argc, char *argv[], const char *options);
/**
* returns the current optional argument (for options like 'T:'), or the command (e.g. "start")
* @return nullptr or argument/command
*/
const char *optarg() const { return _optarg; }
const char *optArg() const { return _optarg; }
I2CSPIBusOption bus_option{I2CSPIBusOption::All};
+4 -4
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (C) 2020 PX4 Development Team. All rights reserved.
* Copyright (C) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -182,11 +182,11 @@ extern "C" int ads1115_main(int argc, char *argv[])
cli.default_i2c_frequency = 400000;
cli.i2c_address = 0x48;
while ((ch = cli.getopt(argc, argv, "")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "")) != EOF) {
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -209,4 +209,4 @@ extern "C" int ads1115_main(int argc, char *argv[])
ThisDriver::print_usage();
return -1;
}
}
+4 -4
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2012-2019 PX4 Development Team. All rights reserved.
* Copyright (c) 2012-2019, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -100,10 +100,10 @@ extern "C" int ms5611_main(int argc, char *argv[])
cli.default_spi_frequency = 20 * 1000 * 1000;
uint16_t dev_type_driver = DRV_BARO_DEVTYPE_MS5611;
while ((ch = cli.getopt(argc, argv, "T:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "T:")) != EOF) {
switch (ch) {
case 'T': {
int val = atoi(cli.optarg());
int val = atoi(cli.optArg());
if (val == 5611) {
cli.type = MS5611_DEVICE;
@@ -118,7 +118,7 @@ extern "C" int ms5611_main(int argc, char *argv[])
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2013, 2014 PX4 Development Team. All rights reserved.
* Copyright (c) 2013, 2014, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -307,15 +307,15 @@ ms4525_airspeed_main(int argc, char *argv[])
cli.default_i2c_frequency = 100000;
int device_type = DEVICE_TYPE_MS4525;
while ((ch = cli.getopt(argc, argv, "T:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "T:")) != EOF) {
switch (ch) {
case 'T':
device_type = atoi(cli.optarg());
device_type = atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -73,15 +73,15 @@ extern "C" __EXPORT int gy_us42_main(int argc, char *argv[])
cli.orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING;
cli.default_i2c_frequency = 100000;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.orientation = atoi(cli.optarg());
cli.orientation = atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2013-2016 PX4 Development Team. All rights reserved.
* Copyright (c) 2013-2016, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -453,15 +453,15 @@ extern "C" __EXPORT int lightware_laser_i2c_main(int argc, char *argv[])
cli.orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING;
cli.default_i2c_frequency = 400000;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.orientation = atoi(cli.optarg());
cli.orientation = atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -102,15 +102,15 @@ extern "C" __EXPORT int ll40ls_main(int argc, char *argv[])
cli.orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING;
cli.default_i2c_frequency = 100000;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.orientation = (enum Rotation)atoi(cli.optarg());
cli.orientation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2013-2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2013-2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -74,15 +74,15 @@ extern "C" __EXPORT int srf02_main(int argc, char *argv[])
cli.orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING;
cli.default_i2c_frequency = 100000;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.orientation = atoi(cli.optarg());
cli.orientation = atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2013-2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2013-2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -84,15 +84,15 @@ extern "C" __EXPORT int teraranger_main(int argc, char *argv[])
cli.orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING;
cli.default_i2c_frequency = 100000;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.orientation = atoi(cli.optarg());
cli.orientation = atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -568,15 +568,15 @@ extern "C" __EXPORT int vl53l0x_main(int argc, char *argv[])
cli.default_i2c_frequency = 400000;
cli.orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.orientation = atoi(cli.optarg());
cli.orientation = atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -685,15 +685,15 @@ extern "C" __EXPORT int vl53l1x_main(int argc, char *argv[])
cli.default_i2c_frequency = 400000;
cli.orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.orientation = atoi(cli.optarg());
cli.orientation = atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
+4 -4
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2018-2019 PX4 Development Team. All rights reserved.
* Copyright (c) 2018-2019, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -73,15 +73,15 @@ extern "C" int adis16477_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = 1000000;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
+4 -4
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2018-2019 PX4 Development Team. All rights reserved.
* Copyright (c) 2018-2019, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -73,15 +73,15 @@ extern "C" int adis16497_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = 5000000;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -72,15 +72,15 @@ extern "C" int adis16448_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = SPI_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -72,15 +72,15 @@ extern "C" int adis16470_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = SPI_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
+4 -4
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -56,7 +56,7 @@ extern "C" int bmi055_main(int argc, char *argv[])
cli.type = 0;
cli.default_spi_frequency = 10000000;
while ((ch = cli.getopt(argc, argv, "AGR:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "AGR:")) != EOF) {
switch (ch) {
case 'A':
cli.type = DRV_ACC_DEVTYPE_BMI055;
@@ -67,12 +67,12 @@ extern "C" int bmi055_main(int argc, char *argv[])
break;
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -60,7 +60,7 @@ extern "C" int bmi088_i2c_main(int argc, char *argv[])
cli.default_spi_frequency = 400 * 1000;
while ((ch = cli.getopt(argc, argv, "AGR:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "AGR:")) != EOF) {
switch (ch) {
case 'A':
cli.type = DRV_ACC_DEVTYPE_BMI088;
@@ -73,12 +73,12 @@ extern "C" int bmi088_i2c_main(int argc, char *argv[])
break;
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
+4 -4
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -56,7 +56,7 @@ extern "C" int bmi088_main(int argc, char *argv[])
cli.type = 0;
cli.default_spi_frequency = 10000000;
while ((ch = cli.getopt(argc, argv, "AGR:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "AGR:")) != EOF) {
switch (ch) {
case 'A':
cli.type = DRV_ACC_DEVTYPE_BMI088;
@@ -67,12 +67,12 @@ extern "C" int bmi088_main(int argc, char *argv[])
break;
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2017-2019 PX4 Development Team. All rights reserved.
* Copyright (c) 2017-2019, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -103,15 +103,15 @@ extern "C" int fxas21002c_main(int argc, char *argv[])
cli.spi_mode = SPIDEV_MODE0;
cli.i2c_address = 0x20;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2017-2019 PX4 Development Team. All rights reserved.
* Copyright (c) 2017-2019, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -109,15 +109,15 @@ extern "C" int fxos8701cq_main(int argc, char *argv[])
cli.spi_mode = SPIDEV_MODE0;
cli.i2c_address = 0x1E;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2019 PX4 Development Team. All rights reserved.
* Copyright (c) 2019, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,15 +72,15 @@ extern "C" int icm20602_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = SPI_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2019 PX4 Development Team. All rights reserved.
* Copyright (c) 2019, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,15 +72,15 @@ extern "C" int icm20608g_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = SPI_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,15 +72,15 @@ extern "C" int icm20649_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = SPI_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,15 +72,15 @@ extern "C" int icm20689_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = SPI_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -74,19 +74,19 @@ extern "C" int icm20948_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = SPI_SPEED;
while ((ch = cli.getopt(argc, argv, "MR:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "MR:")) != EOF) {
switch (ch) {
case 'M':
cli.custom1 = 1;
break;
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,15 +72,15 @@ extern "C" int icm40609d_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = SPI_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,15 +72,15 @@ extern "C" int icm42605_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = SPI_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,15 +72,15 @@ extern "C" int icm42688p_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = SPI_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,15 +72,15 @@ extern "C" int mpu6000_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = SPI_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,15 +72,15 @@ extern "C" int mpu6500_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = SPI_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -74,15 +74,15 @@ extern "C" int mpu9250_i2c_main(int argc, char *argv[])
cli.default_i2c_frequency = I2C_SPEED;
cli.i2c_address = I2C_ADDRESS_DEFAULT;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -74,19 +74,19 @@ extern "C" int mpu9250_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = SPI_SPEED;
while ((ch = cli.getopt(argc, argv, "MR:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "MR:")) != EOF) {
switch (ch) {
case 'M':
cli.custom1 = 1;
break;
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
+4 -4
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2012-2019 PX4 Development Team. All rights reserved.
* Copyright (c) 2012-2019, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -84,15 +84,15 @@ extern "C" int l3gd20_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = 11 * 1000 * 1000;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
+4 -4
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2013-2019 PX4 Development Team. All rights reserved.
* Copyright (c) 2013-2019, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -78,15 +78,15 @@ extern "C" int lsm303d_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = 11 * 1000 * 1000;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
+4 -4
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,15 +72,15 @@ extern "C" int lsm9ds1_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = SPI_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,15 +72,15 @@ extern "C" __EXPORT int ak09916_main(int argc, char *argv[])
BusCLIArguments cli{true, false};
cli.default_i2c_frequency = I2C_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,15 +72,15 @@ extern "C" __EXPORT int ak8963_main(int argc, char *argv[])
BusCLIArguments cli{true, false};
cli.default_i2c_frequency = I2C_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,15 +72,15 @@ extern "C" int bmm150_main(int argc, char *argv[])
BusCLIArguments cli{true, false};
cli.default_i2c_frequency = I2C_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
* Copyright (c) 2012-2015, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -108,10 +108,10 @@ extern "C" int hmc5883_main(int argc, char *argv[])
cli.default_i2c_frequency = 400000;
cli.default_spi_frequency = 11 * 1000 * 1000;
while ((ch = cli.getopt(argc, argv, "R:T")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:T")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
case 'T':
@@ -120,7 +120,7 @@ extern "C" int hmc5883_main(int argc, char *argv[])
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,15 +72,15 @@ extern "C" int ist8308_main(int argc, char *argv[])
BusCLIArguments cli{true, false};
cli.default_i2c_frequency = I2C_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -75,15 +75,15 @@ extern "C" int ist8310_main(int argc, char *argv[])
cli.i2c_address = I2C_ADDRESS_DEFAULT;
cli.default_i2c_frequency = I2C_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -97,15 +97,15 @@ extern "C" int lis2mdl_main(int argc, char *argv[])
cli.default_i2c_frequency = 400000;
cli.default_spi_frequency = 11 * 1000 * 1000;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
* Copyright (c) 2012-2015, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -104,15 +104,15 @@ extern "C" int lis3mdl_main(int argc, char *argv[])
cli.default_i2c_frequency = 400000;
cli.default_spi_frequency = 11 * 1000 * 1000;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2018 PX4 Development Team. All rights reserved.
* Copyright (c) 2018, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,15 +72,15 @@ extern "C" int lsm303agr_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = 8 * 1000 * 1000;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -73,15 +73,15 @@ extern "C" __EXPORT int lsm9ds1_mag_main(int argc, char *argv[])
BusCLIArguments cli{false, true};
cli.default_spi_frequency = SPI_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -72,15 +72,15 @@ extern "C" int qmc5883l_main(int argc, char *argv[])
BusCLIArguments cli{true, false};
cli.default_i2c_frequency = I2C_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2018 PX4 Development Team. All rights reserved.
* Copyright (c) 2018, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -104,15 +104,15 @@ extern "C" int rm3100_main(int argc, char *argv[])
cli.default_i2c_frequency = 400000;
cli.default_spi_frequency = 1 * 1000 * 1000;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -71,15 +71,15 @@ extern "C" int vcm1193l_main(int argc, char *argv[])
BusCLIArguments cli{true, false};
cli.default_i2c_frequency = I2C_SPEED;
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) {
switch (ch) {
case 'R':
cli.rotation = (enum Rotation)atoi(cli.optarg());
cli.rotation = (enum Rotation)atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2019-2020 PX4 Development Team. All rights reserved.
* Copyright (c) 2019-2020, 2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -77,15 +77,15 @@ extern "C" __EXPORT int paw3902_main(int argc, char *argv[])
cli.spi_mode = SPIDEV_MODE0;
cli.default_spi_frequency = SPI_SPEED;
while ((ch = cli.getopt(argc, argv, "Y:")) != EOF) {
while ((ch = cli.getOpt(argc, argv, "Y:")) != EOF) {
switch (ch) {
case 'Y':
cli.custom1 = atoi(cli.optarg());
cli.custom1 = atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
if (!verb) {
ThisDriver::print_usage();

Some files were not shown because too many files have changed in this diff Show More