You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2020/07/09 18:17:21 UTC

[incubator-nuttx-apps] branch master updated (d07db1f -> 6daab50)

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git.


    from d07db1f  ostest: fix assert when open CONFIG_SIG_DEFAULT
     new 31d198f  gpio: add new GPIO pin types
     new 6daab50  gpio: fix code style (long lines)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 examples/gpio/gpio_main.c | 59 +++++++++++++++++++++++++++++++++++------------
 1 file changed, 44 insertions(+), 15 deletions(-)


[incubator-nuttx-apps] 02/02: gpio: fix code style (long lines)

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 6daab509ca5575a697e864c2fe71b63f2dd8da13
Author: Beat Küng <be...@gmx.net>
AuthorDate: Thu Jul 9 12:10:49 2020 +0200

    gpio: fix code style (long lines)
---
 examples/gpio/gpio_main.c | 50 +++++++++++++++++++++++++++++++----------------
 1 file changed, 33 insertions(+), 17 deletions(-)

diff --git a/examples/gpio/gpio_main.c b/examples/gpio/gpio_main.c
index 0bc03f0..ea37041 100644
--- a/examples/gpio/gpio_main.c
+++ b/examples/gpio/gpio_main.c
@@ -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;


[incubator-nuttx-apps] 01/02: gpio: add new GPIO pin types

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 31d198f5b6311f1a8d60310aa39268735f725ae3
Author: Beat Küng <be...@gmx.net>
AuthorDate: Thu Jul 9 11:50:14 2020 +0200

    gpio: add new GPIO pin types
    
    NuttX PR: https://github.com/apache/incubator-nuttx/pull/1374
---
 examples/gpio/gpio_main.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/examples/gpio/gpio_main.c b/examples/gpio/gpio_main.c
index d373f23..0bc03f0 100644
--- a/examples/gpio/gpio_main.c
+++ b/examples/gpio/gpio_main.c
@@ -202,7 +202,20 @@ int main(int argc, FAR char *argv[])
         }
         break;
 
+      case GPIO_INPUT_PIN_PULLUP:
+        {
+          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);
+        }
+        break;
+
       case GPIO_OUTPUT_PIN:
+      case GPIO_OUTPUT_PIN_OPENDRAIN:
         {
           printf("  Output pin:    Value=%u\n", (unsigned int)invalue);