Skip to content

Commit

Permalink
deploy PRINT_MODULE_USAGE_PARAMS_I2C_ADDRESS
Browse files Browse the repository at this point in the history
  • Loading branch information
SalimTerryLi committed Sep 8, 2020
1 parent bb0f5b9 commit f21cc77
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/drivers/adc/ADS1115/ads1115_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void ADS1115::print_usage()
PRINT_MODULE_USAGE_NAME("ads1115", "driver");
PRINT_MODULE_USAGE_COMMAND("start");
PRINT_MODULE_USAGE_PARAMS_I2C_SPI_DRIVER(true, false);
PRINT_MODULE_USAGE_PARAM_INT('A', 0x48, 0, 0xff, "Address", true);
PRINT_MODULE_USAGE_PARAMS_I2C_ADDRESS(0x48);
PRINT_MODULE_USAGE_DEFAULT_COMMANDS();
}

Expand All @@ -184,12 +184,8 @@ extern "C" int ads1115_main(int argc, char *argv[])
cli.default_i2c_frequency = 400000;
cli.i2c_address = 0x48;

while ((ch = cli.getopt(argc, argv, "A:")) != EOF) {
switch (ch) {
case 'A':
cli.i2c_address = atoi(cli.optarg());
break;
}
while ((ch = cli.getopt(argc, argv, "")) != EOF) {

}

const char *verb = cli.optarg();
Expand Down

0 comments on commit f21cc77

Please sign in to comment.