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

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


The following commit(s) were added to refs/heads/master by this push:
     new 81b9be5  examples/serialrx: implement option to print string characters
81b9be5 is described below

commit 81b9be5d2e4a823aae77744326a1423cf241d149
Author: Michal Lenc <michall...@seznam.cz>
AuthorDate: Mon Mar 7 17:10:51 2022 +0100

    examples/serialrx: implement option to print string characters
    
    The option CONFIG_EXAMPLES_SERIALRX_PRINTSTR was available in the
    configuration but was not implemented in the source code. This commit
    implements the option.
    
    Signed-off-by: Michal Lenc <michall...@seznam.cz>
---
 examples/serialrx/serialrx_main.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/examples/serialrx/serialrx_main.c 
b/examples/serialrx/serialrx_main.c
index 71a3b64..b27b8b7 100644
--- a/examples/serialrx/serialrx_main.c
+++ b/examples/serialrx/serialrx_main.c
@@ -73,7 +73,8 @@ int main(int argc, FAR char *argv[])
 #ifdef CONFIG_EXAMPLES_SERIALRX_PRINTHYPHEN
   int count = 0;
 #endif
-#ifdef CONFIG_EXAMPLES_SERIALRX_PRINTHEX
+#if defined (CONFIG_EXAMPLES_SERIALRX_PRINTHEX) || \
+    defined (CONFIG_EXAMPLES_SERIALRX_PRINTSTR)
   int i;
 #endif
   bool eof = false;
@@ -175,7 +176,14 @@ int main(int argc, FAR char *argv[])
             }
 
           fflush(stdout);
-#endif                                  /* Kamal */
+#elif defined(CONFIG_EXAMPLES_SERIALRX_PRINTSTR)
+          for (i = 0; i < (int)n; i++)
+            {
+              printf("%c", buf[i]);
+            }
+
+          fflush(stdout);
+#endif
           cnt += n;
         }
 

Reply via email to