i2c drivers: add '-k' flag for keep_running directly to BusCLIArguments

This commit is contained in:
Beat Küng
2020-09-18 10:18:40 +02:00
committed by Daniel Agar
parent 1bf030e8ba
commit 5fdff6a0e4
10 changed files with 48 additions and 39 deletions

View File

@@ -84,6 +84,10 @@ int BusCLIArguments::getopt(int argc, char *argv[], const char *options)
*(p++) = 'm'; *(p++) = ':'; // spi mode
}
if (support_keep_running) {
*(p++) = 'k';
}
*(p++) = 'b'; *(p++) = ':'; // bus
*(p++) = 'f'; *(p++) = ':'; // frequency
*(p++) = 'q'; // quiet flag
@@ -163,6 +167,14 @@ int BusCLIArguments::getopt(int argc, char *argv[], const char *options)
quiet_start = true;
break;
case 'k':
if (!support_keep_running) {
return ch;
}
keep_running = true;
break;
default:
if (ch == '?') {
// abort further parsing on unknown arguments