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-06-16 17:07:47 +02:00
committed by Julian Oes
parent 64db89ab20
commit 84dd8839a2
55 changed files with 245 additions and 214 deletions
@@ -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();