gpio: fix code style (long lines)

This commit is contained in:
Beat Küng 2020-07-09 12:10:49 +02:00 committed by Alan Carvalho de Assis
parent 31d198f5b6
commit 6daab509ca

View File

@ -56,12 +56,17 @@
static void show_usage(FAR const char *progname)
{
fprintf(stderr, "USAGE: %s [-w <signo>] [-o <value>] <driver-path>\n", progname);
fprintf(stderr, "USAGE: %s [-w <signo>] [-o <value>] <driver-path>\n",
progname);
fprintf(stderr, " %s -h\n", progname);
fprintf(stderr, "Where:\n");
fprintf(stderr, "\t<driver-path>: The full path to the GPIO pin driver.\n");
fprintf(stderr, "\t-w <signo>: Wait for an signal if this is an interrupt pin.\n");
fprintf(stderr, "\t-o <value>: Write this value (0 or 1) if this is an output pin.\n");
fprintf(stderr, "\t<driver-path>: The full path to the GPIO pin "
"driver.\n");
fprintf(stderr,
"\t-w <signo>: Wait for an signal if this is an interrupt pin.\n");
fprintf(stderr,
"\t-o <value>: Write this value (0 or 1) if this is an output "
"pin.\n");
fprintf(stderr, "\t-h: Print this usage information and exit.\n");
}
@ -176,7 +181,8 @@ int main(int argc, FAR char *argv[])
if (ret < 0)
{
int errcode = errno;
fprintf(stderr, "ERROR: Failed to read pintype from %s: %d\n", devpath, errcode);
fprintf(stderr, "ERROR: Failed to read pintype from %s: %d\n",
devpath, errcode);
close(fd);
return EXIT_FAILURE;
}
@ -187,7 +193,8 @@ int main(int argc, FAR char *argv[])
if (ret < 0)
{
int errcode = errno;
fprintf(stderr, "ERROR: Failed to read value from %s: %d\n", devpath, errcode);
fprintf(stderr, "ERROR: Failed to read value from %s: %d\n",
devpath, errcode);
close(fd);
return EXIT_FAILURE;
}
@ -198,19 +205,22 @@ int main(int argc, FAR char *argv[])
{
case GPIO_INPUT_PIN:
{
printf(" Input pin: Value=%u\n", (unsigned int)invalue);
printf(" Input pin: Value=%u\n",
(unsigned int)invalue);
}
break;
case GPIO_INPUT_PIN_PULLUP:
{
printf(" Input pin (pull-up): Value=%u\n", (unsigned int)invalue);
printf(" Input pin (pull-up): Value=%u\n",
(unsigned int)invalue);
}
break;
case GPIO_INPUT_PIN_PULLDOWN:
{
printf(" Input pin (pull-down): Value=%u\n", (unsigned int)invalue);
printf(" Input pin (pull-down): Value=%u\n",
(unsigned int)invalue);
}
break;
@ -229,7 +239,8 @@ int main(int argc, FAR char *argv[])
if (ret < 0)
{
int errcode = errno;
fprintf(stderr, "ERROR: Failed to write value %u from %s: %d\n",
fprintf(stderr,
"ERROR: Failed to write value %u from %s: %d\n",
devpath, (unsigned int)outvalue, errcode);
close(fd);
return EXIT_FAILURE;
@ -237,11 +248,13 @@ int main(int argc, FAR char *argv[])
/* Re-read the pin value */
ret = ioctl(fd, GPIOC_READ, (unsigned long)((uintptr_t)&invalue));
ret = ioctl(fd, GPIOC_READ,
(unsigned long)((uintptr_t)&invalue));
if (ret < 0)
{
int errcode = errno;
fprintf(stderr, "ERROR: Failed to re-read value from %s: %d\n",
fprintf(stderr,
"ERROR: Failed to re-read value from %s: %d\n",
devpath, errcode);
close(fd);
return EXIT_FAILURE;
@ -272,7 +285,8 @@ int main(int argc, FAR char *argv[])
{
int errcode = errno;
fprintf(stderr, "ERROR: Failed to setup for signal from %s: %d\n",
fprintf(stderr,
"ERROR: Failed to setup for signal from %s: %d\n",
devpath, errcode);
close(fd);
@ -301,8 +315,8 @@ int main(int argc, FAR char *argv[])
}
else
{
fprintf(stderr, "ERROR: Failed to wait signal %d from %s: %d\n",
signo, devpath, errcode);
fprintf(stderr, "ERROR: Failed to wait signal %d "
"from %s: %d\n", signo, devpath, errcode);
close(fd);
return EXIT_FAILURE;
}
@ -310,11 +324,13 @@ int main(int argc, FAR char *argv[])
/* Re-read the pin value */
ret = ioctl(fd, GPIOC_READ, (unsigned long)((uintptr_t)&invalue));
ret = ioctl(fd, GPIOC_READ,
(unsigned long)((uintptr_t)&invalue));
if (ret < 0)
{
int errcode = errno;
fprintf(stderr, "ERROR: Failed to re-read value from %s: %d\n",
fprintf(stderr,
"ERROR: Failed to re-read value from %s: %d\n",
devpath, errcode);
close(fd);
return EXIT_FAILURE;