You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "tmedicci (via GitHub)" <gi...@apache.org> on 2023/12/15 20:06:26 UTC

[PR] examples/rmtchar: Implement RX and/or TX using the RMT char driver [nuttx-apps]

tmedicci opened a new pull request, #2232:
URL: https://github.com/apache/nuttx-apps/pull/2232

   ## Summary
   
   * examples/rmtchar: Implement RX and/or TX using the RMT char driver
   
   The RMT (remote control) character driver is used to send and/or receive data packets. Eventually, this app can be used to perform a loopback test to validate the RMT driver implementation.
   
   ## Impact
   
   Enable testing the RMT character driver.
   
   ## Testing
   
   Internal CI testing + ESP32-S2-Saola-1 and ESP32-S3-DevKitC-1 with the new RMT driver (to be sent upstream).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] examples/rmtchar: Implement RX and/or TX using the RMT char driver [nuttx-apps]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on code in PR #2232:
URL: https://github.com/apache/nuttx-apps/pull/2232#discussion_r1430499305


##########
examples/rmtchar/rmtchar_main.c:
##########
@@ -0,0 +1,360 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <errno.h>
+#include <debug.h>
+
+#include "rmtchar.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if !defined(CONFIG_EXAMPLES_RMTCHAR_RX) && \
+    !defined(CONFIG_EXAMPLES_RMTCHAR_TX)
+#  error "At least one of CONFIG_EXAMPLES_RMTCHAR_RX or \
+          CONFIG_EXAMPLES_RMTCHAR_TX must be defined"
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct rmtchar_state_s g_rmtchar;

Review Comment:
   Did you see [this comment](https://github.com/apache/nuttx-apps/pull/2232#discussion_r1429968865)?
   
   I didn`t make it local here to be able to keep track of the options between multiple runs...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] examples/rmtchar: Implement RX and/or TX using the RMT char driver [nuttx-apps]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #2232:
URL: https://github.com/apache/nuttx-apps/pull/2232#issuecomment-1860563332

   @tmedicci ci break is fixed here: https://github.com/apache/nuttx/pull/11414


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] examples/rmtchar: Implement RX and/or TX using the RMT char driver [nuttx-apps]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #2232:
URL: https://github.com/apache/nuttx-apps/pull/2232#discussion_r1430541184


##########
examples/rmtchar/rmtchar_main.c:
##########
@@ -0,0 +1,360 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <errno.h>
+#include <debug.h>
+
+#include "rmtchar.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if !defined(CONFIG_EXAMPLES_RMTCHAR_RX) && \
+    !defined(CONFIG_EXAMPLES_RMTCHAR_TX)
+#  error "At least one of CONFIG_EXAMPLES_RMTCHAR_RX or \
+          CONFIG_EXAMPLES_RMTCHAR_TX must be defined"
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct rmtchar_state_s g_rmtchar;

Review Comment:
   but, why need track the options?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] examples/rmtchar: Implement RX and/or TX using the RMT char driver [nuttx-apps]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #2232:
URL: https://github.com/apache/nuttx-apps/pull/2232#discussion_r1428665819


##########
examples/rmtchar/rmtchar_receiver.c:
##########
@@ -0,0 +1,137 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar_receiver.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <errno.h>
+#include <debug.h>
+#include <unistd.h>
+
+#include "rmtchar.h"
+
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rmtchar_receiver()
+ *
+ * Description:
+ *   This is the entry point for the receiver thread.
+ *
+ ****************************************************************************/
+
+pthread_addr_t rmtchar_receiver(pthread_addr_t arg)
+{
+  struct rmt_item32_s buf[g_rmtchar.rmtchar_items];

Review Comment:
   let's pass `g_rmtchar` through `arg` and change g_rmtchar to local variable



##########
examples/rmtchar/rmtchar_transmitter.c:
##########
@@ -0,0 +1,155 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar_transmitter.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <errno.h>
+#include <debug.h>
+#include <unistd.h>
+
+#include <nuttx/audio/audio.h>
+
+#include "rmtchar.h"
+
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rmtchar_transmitter()
+ *
+ * Description:
+ *   This is the entry point for the transmitter thread.
+ *
+ ****************************************************************************/
+
+pthread_addr_t rmtchar_transmitter(pthread_addr_t arg)
+{
+  struct rmt_item32_s buf[g_rmtchar.rmtchar_items];

Review Comment:
   ditto



##########
examples/rmtchar/CMakeLists.txt:
##########
@@ -0,0 +1,38 @@
+# ##############################################################################
+# apps/examples/rmtchar/CMakeLists.txt

Review Comment:
   look like rmt is an infrared remote control hardware? why not use lirc driver model?
   
   https://github.com/apache/nuttx/blob/master/include/nuttx/lirc.h
   https://github.com/apache/nuttx/blob/master/include/nuttx/rc/lirc_dev.h
   https://github.com/apache/nuttx/tree/master/drivers/rc
   https://github.com/apache/nuttx-apps/tree/master/testing/irtest
   https://www.lirc.org/



##########
examples/rmtchar/rmtchar_main.c:
##########
@@ -0,0 +1,364 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <errno.h>
+#include <debug.h>
+
+#include "rmtchar.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if !defined(CONFIG_EXAMPLES_RMTCHAR_RX) && \
+    !defined(CONFIG_EXAMPLES_RMTCHAR_TX)
+#  error "At least one of CONFIG_EXAMPLES_RMTCHAR_RX or \
+          CONFIG_EXAMPLES_RMTCHAR_TX must be defined"
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+struct rmtchar_state_s g_rmtchar;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rmtchar_devpath
+ ****************************************************************************/
+
+static void rmtchar_devpath(FAR struct rmtchar_state_s *rmtchar,
+                            FAR const char *devpath,
+                            bool is_tx)
+{
+  /* Get rid of any old device path */
+
+  if (is_tx)
+    {
+      if (rmtchar->txdevpath)
+        {
+          free(rmtchar->txdevpath);
+        }
+
+      /* Then set-up the new device path by copying the string */
+
+      rmtchar->txdevpath = strdup(devpath);
+    }
+  else
+    {
+      if (rmtchar->rxdevpath)
+        {
+          free(rmtchar->rxdevpath);
+        }
+
+      /* Then set-up the new device path by copying the string */
+
+      rmtchar->rxdevpath = strdup(devpath);
+    }
+}
+
+/****************************************************************************
+ * Name: rmtchar_help
+ ****************************************************************************/
+
+static void rmtchar_help(FAR struct rmtchar_state_s *rmtchar)
+{
+  printf("Usage: rmtchar [OPTIONS]\n");
+  printf("\nArguments are \"sticky\".\n");
+  printf("For example, once the RMT character device is\n");
+  printf("specified, that device will be re-used until it is changed.\n");
+  printf("\n\"sticky\" OPTIONS include:\n");
+  printf("  [-i items] selects the number of words (items) to be transmitted"
+         " or received by the RMT character device. "
+         "Default: %d Current: %d\n",
+         CONFIG_EXAMPLES_RMTCHAR_ITEMS,
+         g_rmtchar.rmtchar_items ? g_rmtchar.rmtchar_items :
+         CONFIG_EXAMPLES_RMTCHAR_ITEMS);
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+  printf("  [-t devpath] selects the RMT transmitter character device path. "
+         "Default: %s Current: %s\n",
+         CONFIG_EXAMPLES_RMTCHAR_TX_DEVPATH,
+         g_rmtchar.txdevpath ? g_rmtchar.txdevpath : "NONE");
+#endif
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+  printf("  [-r devpath] selects the RMT receiver character device path. "
+         "Default: %s Current: %s\n",
+         CONFIG_EXAMPLES_RMTCHAR_RX_DEVPATH,
+         g_rmtchar.rxdevpath ? g_rmtchar.rxdevpath : "NONE");
+#endif
+  printf("  [-h] shows this message and exits\n");
+}
+
+/****************************************************************************
+ * Name: arg_string
+ ****************************************************************************/
+
+static int arg_string(FAR char **arg, FAR char **value)
+{
+  FAR char *ptr = *arg;
+
+  if (ptr[2] == '\0')
+    {
+      *value = arg[1];
+      return 2;
+    }
+  else
+    {
+      *value = &ptr[2];
+      return 1;
+    }
+}
+
+/****************************************************************************
+ * Name: arg_decimal
+ ****************************************************************************/
+
+static int arg_decimal(FAR char **arg, FAR int *value)
+{
+  FAR char *string;
+  int ret;
+
+  ret = arg_string(arg, &string);
+  *value = strtol(string, NULL, 10);
+  return ret;
+}
+
+/****************************************************************************
+ * Name: parse_args
+ ****************************************************************************/
+
+static void parse_args(FAR struct rmtchar_state_s *rmtchar,
+                       int argc,
+                       FAR char **argv)
+{
+  FAR char *ptr;
+  FAR char *str;
+  int value;
+  int index;
+  int nargs;
+
+  for (index = 1; index < argc; )
+    {
+      ptr = argv[index];
+      if (ptr[0] != '-')
+        {
+          printf("Invalid options format: %s\n", ptr);
+          exit(0);
+        }
+
+      switch (ptr[1])
+        {
+          case 'i':
+            nargs = arg_decimal(&argv[index], &value);
+            if (value < 0)
+              {
+                printf("Count must be non-negative: %d\n", value);
+                exit(1);
+              }
+
+            rmtchar->rmtchar_items = value;
+            index += nargs;
+            break;
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+          case 't':
+            nargs = arg_string(&argv[index], &str);
+            rmtchar_devpath(rmtchar, str, true);
+            index += nargs;
+            break;
+#endif
+
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+          case 'r':
+            nargs = arg_string(&argv[index], &str);
+            rmtchar_devpath(rmtchar, str, false);
+            index += nargs;
+            break;
+#endif
+          case 'h':
+            rmtchar_help(rmtchar);
+            exit(0);
+
+          default:
+            printf("Unsupported option: %s\n", ptr);
+            rmtchar_help(rmtchar);
+            exit(1);
+        }
+    }
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rmtchar_main
+ ****************************************************************************/
+
+int main(int argc, FAR char *argv[])
+{
+  pthread_attr_t attr;
+  pthread_addr_t result;
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+  pthread_t transmitter;
+#endif
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+  pthread_t receiver;
+#endif
+#if defined(CONFIG_EXAMPLES_RMTCHAR_RX) && defined(CONFIG_EXAMPLES_RMTCHAR_TX)
+  struct sched_param param;
+#endif
+  int ret;
+
+  UNUSED(ret);
+
+  /* Check if we have initialized */
+
+  if (!g_rmtchar.initialized)
+    {
+      /* Set the default values */
+
+      g_rmtchar.rmtchar_items = CONFIG_EXAMPLES_RMTCHAR_ITEMS;
+
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+      rmtchar_devpath(&g_rmtchar, CONFIG_EXAMPLES_RMTCHAR_TX_DEVPATH, true);
+#endif
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+      rmtchar_devpath(&g_rmtchar, CONFIG_EXAMPLES_RMTCHAR_RX_DEVPATH, false);
+#endif
+
+      g_rmtchar.initialized = true;
+    }
+
+  /* Parse the command line */
+
+  parse_args(&g_rmtchar, argc, argv);
+
+  sched_lock();

Review Comment:
   why need lock the sched, the normal program shouldn't depend on the implementation of scheduler.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] examples/rmtchar: Implement RX and/or TX using the RMT char driver [nuttx-apps]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on code in PR #2232:
URL: https://github.com/apache/nuttx-apps/pull/2232#discussion_r1429968865


##########
examples/rmtchar/rmtchar_receiver.c:
##########
@@ -0,0 +1,137 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar_receiver.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <errno.h>
+#include <debug.h>
+#include <unistd.h>
+
+#include "rmtchar.h"
+
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rmtchar_receiver()
+ *
+ * Description:
+ *   This is the entry point for the receiver thread.
+ *
+ ****************************************************************************/
+
+pthread_addr_t rmtchar_receiver(pthread_addr_t arg)
+{
+  struct rmt_item32_s buf[g_rmtchar.rmtchar_items];

Review Comment:
   Done!
   
   Please note that I kept g_rmtchar on `rmtchar_main.c` to be able to check for device initialization and keep configs. But the var is not public anymore.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] examples/rmtchar: Implement RX and/or TX using the RMT char driver [nuttx-apps]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #2232:
URL: https://github.com/apache/nuttx-apps/pull/2232#discussion_r1430448491


##########
examples/rmtchar/rmtchar.h:
##########
@@ -0,0 +1,127 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __APPS_EXAMPLES_RMTCHAR_RMTCHAR_H
+#define __APPS_EXAMPLES_RMTCHAR_RMTCHAR_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <pthread.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Configuration */
+
+#ifndef CONFIG_EXAMPLES_RMTCHAR_TX_DEVPATH
+#  define CONFIG_EXAMPLES_RMTCHAR_TX_DEVPATH "/dev/rmt0"
+#endif
+
+#ifndef CONFIG_EXAMPLES_RMTCHAR_RX_DEVPATH
+#  define CONFIG_EXAMPLES_RMTCHAR_RX_DEVPATH "/dev/rmt1"
+#endif
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+struct rmtchar_state_s
+{
+  bool initialized;

Review Comment:
   remove, don't need



##########
examples/rmtchar/rmtchar_receiver.c:
##########
@@ -0,0 +1,138 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar_receiver.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <errno.h>
+#include <debug.h>
+#include <unistd.h>
+
+#include "rmtchar.h"
+
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rmtchar_receiver()
+ *
+ * Description:
+ *   This is the entry point for the receiver thread.
+ *
+ ****************************************************************************/
+
+pthread_addr_t rmtchar_receiver(pthread_addr_t arg)
+{
+  struct rmtchar_state_s *rmtchar = (struct rmtchar_state_s *)arg;

Review Comment:
   ```suggestion
     FAR struct rmtchar_state_s *rmtchar = (FAR struct rmtchar_state_s *)arg;
   ```



##########
examples/rmtchar/rmtchar_main.c:
##########
@@ -0,0 +1,360 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <errno.h>
+#include <debug.h>
+
+#include "rmtchar.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if !defined(CONFIG_EXAMPLES_RMTCHAR_RX) && \
+    !defined(CONFIG_EXAMPLES_RMTCHAR_TX)
+#  error "At least one of CONFIG_EXAMPLES_RMTCHAR_RX or \
+          CONFIG_EXAMPLES_RMTCHAR_TX must be defined"
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct rmtchar_state_s g_rmtchar;

Review Comment:
   change to local variable too



##########
examples/rmtchar/rmtchar_transmitter.c:
##########
@@ -0,0 +1,156 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar_transmitter.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <errno.h>
+#include <debug.h>
+#include <unistd.h>
+
+#include <nuttx/audio/audio.h>
+
+#include "rmtchar.h"
+
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rmtchar_transmitter()
+ *
+ * Description:
+ *   This is the entry point for the transmitter thread.
+ *
+ ****************************************************************************/
+
+pthread_addr_t rmtchar_transmitter(pthread_addr_t arg)
+{
+  struct rmtchar_state_s *rmtchar = (struct rmtchar_state_s *)arg;

Review Comment:
   ```suggestion
     FAR struct rmtchar_state_s *rmtchar = (FAR struct rmtchar_state_s *)arg;
   ```



##########
examples/rmtchar/rmtchar_main.c:
##########
@@ -0,0 +1,360 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <errno.h>
+#include <debug.h>
+
+#include "rmtchar.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if !defined(CONFIG_EXAMPLES_RMTCHAR_RX) && \
+    !defined(CONFIG_EXAMPLES_RMTCHAR_TX)
+#  error "At least one of CONFIG_EXAMPLES_RMTCHAR_RX or \
+          CONFIG_EXAMPLES_RMTCHAR_TX must be defined"
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct rmtchar_state_s g_rmtchar;
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rmtchar_devpath
+ ****************************************************************************/
+
+static void rmtchar_devpath(FAR struct rmtchar_state_s *rmtchar,
+                            FAR const char *devpath,
+                            bool is_tx)
+{
+  /* Get rid of any old device path */
+
+  if (is_tx)
+    {
+      if (rmtchar->txdevpath)
+        {
+          free(rmtchar->txdevpath);
+        }
+
+      /* Then set-up the new device path by copying the string */
+
+      rmtchar->txdevpath = strdup(devpath);
+    }
+  else
+    {
+      if (rmtchar->rxdevpath)
+        {
+          free(rmtchar->rxdevpath);
+        }
+
+      /* Then set-up the new device path by copying the string */
+
+      rmtchar->rxdevpath = strdup(devpath);
+    }
+}
+
+/****************************************************************************
+ * Name: rmtchar_help
+ ****************************************************************************/
+
+static void rmtchar_help(FAR struct rmtchar_state_s *rmtchar)
+{
+  printf("Usage: rmtchar [OPTIONS]\n");
+  printf("\nArguments are \"sticky\".\n");
+  printf("For example, once the RMT character device is\n");
+  printf("specified, that device will be re-used until it is changed.\n");
+  printf("\n\"sticky\" OPTIONS include:\n");
+  printf("  [-i items] selects the number of words (items) to be transmitted"
+         " or received by the RMT character device. "
+         "Default: %d Current: %d\n",
+         CONFIG_EXAMPLES_RMTCHAR_ITEMS,
+         rmtchar->rmtchar_items ? rmtchar->rmtchar_items :
+         CONFIG_EXAMPLES_RMTCHAR_ITEMS);
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+  printf("  [-t devpath] selects the RMT transmitter character device path. "
+         "Default: %s Current: %s\n",
+         CONFIG_EXAMPLES_RMTCHAR_TX_DEVPATH,
+         rmtchar->txdevpath ? rmtchar->txdevpath : "NONE");
+#endif
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+  printf("  [-r devpath] selects the RMT receiver character device path. "
+         "Default: %s Current: %s\n",
+         CONFIG_EXAMPLES_RMTCHAR_RX_DEVPATH,
+         rmtchar->rxdevpath ? rmtchar->rxdevpath : "NONE");
+#endif
+  printf("  [-h] shows this message and exits\n");
+}
+
+/****************************************************************************
+ * Name: arg_string
+ ****************************************************************************/
+
+static int arg_string(FAR char **arg, FAR char **value)
+{
+  FAR char *ptr = *arg;
+
+  if (ptr[2] == '\0')
+    {
+      *value = arg[1];
+      return 2;
+    }
+  else
+    {
+      *value = &ptr[2];
+      return 1;
+    }
+}
+
+/****************************************************************************
+ * Name: arg_decimal
+ ****************************************************************************/
+
+static int arg_decimal(FAR char **arg, FAR int *value)
+{
+  FAR char *string;
+  int ret;
+
+  ret = arg_string(arg, &string);
+  *value = strtol(string, NULL, 10);
+  return ret;
+}
+
+/****************************************************************************
+ * Name: parse_args
+ ****************************************************************************/
+
+static void parse_args(FAR struct rmtchar_state_s *rmtchar,
+                       int argc,
+                       FAR char **argv)
+{
+  FAR char *ptr;
+  FAR char *str;
+  int value;
+  int index;
+  int nargs;
+
+  for (index = 1; index < argc; )
+    {
+      ptr = argv[index];
+      if (ptr[0] != '-')
+        {
+          printf("Invalid options format: %s\n", ptr);
+          exit(0);
+        }
+
+      switch (ptr[1])
+        {
+          case 'i':
+            nargs = arg_decimal(&argv[index], &value);
+            if (value < 0)
+              {
+                printf("Count must be non-negative: %d\n", value);
+                exit(1);
+              }
+
+            rmtchar->rmtchar_items = value;
+            index += nargs;
+            break;
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+          case 't':
+            nargs = arg_string(&argv[index], &str);
+            rmtchar_devpath(rmtchar, str, true);
+            index += nargs;
+            break;
+#endif
+
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+          case 'r':
+            nargs = arg_string(&argv[index], &str);
+            rmtchar_devpath(rmtchar, str, false);
+            index += nargs;
+            break;
+#endif
+          case 'h':
+            rmtchar_help(rmtchar);
+            exit(0);
+
+          default:
+            printf("Unsupported option: %s\n", ptr);
+            rmtchar_help(rmtchar);
+            exit(1);
+        }
+    }
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rmtchar_main
+ ****************************************************************************/
+
+int main(int argc, FAR char *argv[])
+{
+  pthread_attr_t attr;
+  pthread_addr_t result;
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+  pthread_t transmitter;
+#endif
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+  pthread_t receiver;
+#endif
+#if defined(CONFIG_EXAMPLES_RMTCHAR_RX) && defined(CONFIG_EXAMPLES_RMTCHAR_TX)
+  struct sched_param param;
+#endif
+  int ret;
+
+  UNUSED(ret);
+
+  /* Check if we have initialized */
+
+  if (!g_rmtchar.initialized)

Review Comment:
   remove the check and initialized field



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] examples/rmtchar: Implement RX and/or TX using the RMT char driver [nuttx-apps]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #2232:
URL: https://github.com/apache/nuttx-apps/pull/2232


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] examples/rmtchar: Implement RX and/or TX using the RMT char driver [nuttx-apps]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on code in PR #2232:
URL: https://github.com/apache/nuttx-apps/pull/2232#discussion_r1430573604


##########
examples/rmtchar/rmtchar_main.c:
##########
@@ -0,0 +1,360 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <errno.h>
+#include <debug.h>
+
+#include "rmtchar.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if !defined(CONFIG_EXAMPLES_RMTCHAR_RX) && \
+    !defined(CONFIG_EXAMPLES_RMTCHAR_TX)
+#  error "At least one of CONFIG_EXAMPLES_RMTCHAR_RX or \
+          CONFIG_EXAMPLES_RMTCHAR_TX must be defined"
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct rmtchar_state_s g_rmtchar;

Review Comment:
   Because, for testing applications, it's easier to just setup every parameters once and rerun when needed (or change only part of the previously setup environment). The same is valid for other testing applications, like [`adc`](https://github.com/apache/incubator-nuttx-apps/blob/2ac8589a25b5a64b075eb25a3b58e170dac5bcab/examples/adc/adc_main.c#L59), [`dac`](https://github.com/apache/incubator-nuttx-apps/blob/054cf3b1cb2697fc4f1c114a52c030d5a88a6899/examples/dac/dac_main.c#L88), [`pwm`](https://github.com/apache/incubator-nuttx-apps/blob/0a7c308f1b609a5a41f0e8246a528f66f5deb284/examples/pwm/pwm_main.c#L119) and [`i2schar`](https://github.com/apache/incubator-nuttx-apps/blob/66f957792f3618c3e6fc4f9dede577967228d494/examples/i2schar/i2schar_main.c#L58), for instance.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] examples/rmtchar: Implement RX and/or TX using the RMT char driver [nuttx-apps]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on code in PR #2232:
URL: https://github.com/apache/nuttx-apps/pull/2232#discussion_r1429969521


##########
examples/rmtchar/rmtchar_transmitter.c:
##########
@@ -0,0 +1,155 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar_transmitter.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <errno.h>
+#include <debug.h>
+#include <unistd.h>
+
+#include <nuttx/audio/audio.h>
+
+#include "rmtchar.h"
+
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rmtchar_transmitter()
+ *
+ * Description:
+ *   This is the entry point for the transmitter thread.
+ *
+ ****************************************************************************/
+
+pthread_addr_t rmtchar_transmitter(pthread_addr_t arg)
+{
+  struct rmt_item32_s buf[g_rmtchar.rmtchar_items];

Review Comment:
   Done!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] examples/rmtchar: Implement RX and/or TX using the RMT char driver [nuttx-apps]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on code in PR #2232:
URL: https://github.com/apache/nuttx-apps/pull/2232#discussion_r1428970143


##########
examples/rmtchar/CMakeLists.txt:
##########
@@ -0,0 +1,38 @@
+# ##############################################################################
+# apps/examples/rmtchar/CMakeLists.txt

Review Comment:
   Yes, the `lirc` is intended to be used with the RMT peripheral, but we would like to provide an application to test the "raw" RMT character driver, just to be able to test the lower-half driver implementation. This is similar to the [`i2schar`](https://github.com/apache/nuttx-apps/tree/master/examples/i2schar) app ;)
   
   On ESP32, for instance, the RMT peripheral is used as a generic one-wire peripheral that enables a lot of different protocols to be implemented.
   
   I'll fix the issues on Monday!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] examples/rmtchar: Implement RX and/or TX using the RMT char driver [nuttx-apps]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on code in PR #2232:
URL: https://github.com/apache/nuttx-apps/pull/2232#discussion_r1430499552


##########
examples/rmtchar/rmtchar_main.c:
##########
@@ -0,0 +1,360 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <errno.h>
+#include <debug.h>
+
+#include "rmtchar.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if !defined(CONFIG_EXAMPLES_RMTCHAR_RX) && \
+    !defined(CONFIG_EXAMPLES_RMTCHAR_TX)
+#  error "At least one of CONFIG_EXAMPLES_RMTCHAR_RX or \
+          CONFIG_EXAMPLES_RMTCHAR_TX must be defined"
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct rmtchar_state_s g_rmtchar;
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rmtchar_devpath
+ ****************************************************************************/
+
+static void rmtchar_devpath(FAR struct rmtchar_state_s *rmtchar,
+                            FAR const char *devpath,
+                            bool is_tx)
+{
+  /* Get rid of any old device path */
+
+  if (is_tx)
+    {
+      if (rmtchar->txdevpath)
+        {
+          free(rmtchar->txdevpath);
+        }
+
+      /* Then set-up the new device path by copying the string */
+
+      rmtchar->txdevpath = strdup(devpath);
+    }
+  else
+    {
+      if (rmtchar->rxdevpath)
+        {
+          free(rmtchar->rxdevpath);
+        }
+
+      /* Then set-up the new device path by copying the string */
+
+      rmtchar->rxdevpath = strdup(devpath);
+    }
+}
+
+/****************************************************************************
+ * Name: rmtchar_help
+ ****************************************************************************/
+
+static void rmtchar_help(FAR struct rmtchar_state_s *rmtchar)
+{
+  printf("Usage: rmtchar [OPTIONS]\n");
+  printf("\nArguments are \"sticky\".\n");
+  printf("For example, once the RMT character device is\n");
+  printf("specified, that device will be re-used until it is changed.\n");
+  printf("\n\"sticky\" OPTIONS include:\n");
+  printf("  [-i items] selects the number of words (items) to be transmitted"
+         " or received by the RMT character device. "
+         "Default: %d Current: %d\n",
+         CONFIG_EXAMPLES_RMTCHAR_ITEMS,
+         rmtchar->rmtchar_items ? rmtchar->rmtchar_items :
+         CONFIG_EXAMPLES_RMTCHAR_ITEMS);
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+  printf("  [-t devpath] selects the RMT transmitter character device path. "
+         "Default: %s Current: %s\n",
+         CONFIG_EXAMPLES_RMTCHAR_TX_DEVPATH,
+         rmtchar->txdevpath ? rmtchar->txdevpath : "NONE");
+#endif
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+  printf("  [-r devpath] selects the RMT receiver character device path. "
+         "Default: %s Current: %s\n",
+         CONFIG_EXAMPLES_RMTCHAR_RX_DEVPATH,
+         rmtchar->rxdevpath ? rmtchar->rxdevpath : "NONE");
+#endif
+  printf("  [-h] shows this message and exits\n");
+}
+
+/****************************************************************************
+ * Name: arg_string
+ ****************************************************************************/
+
+static int arg_string(FAR char **arg, FAR char **value)
+{
+  FAR char *ptr = *arg;
+
+  if (ptr[2] == '\0')
+    {
+      *value = arg[1];
+      return 2;
+    }
+  else
+    {
+      *value = &ptr[2];
+      return 1;
+    }
+}
+
+/****************************************************************************
+ * Name: arg_decimal
+ ****************************************************************************/
+
+static int arg_decimal(FAR char **arg, FAR int *value)
+{
+  FAR char *string;
+  int ret;
+
+  ret = arg_string(arg, &string);
+  *value = strtol(string, NULL, 10);
+  return ret;
+}
+
+/****************************************************************************
+ * Name: parse_args
+ ****************************************************************************/
+
+static void parse_args(FAR struct rmtchar_state_s *rmtchar,
+                       int argc,
+                       FAR char **argv)
+{
+  FAR char *ptr;
+  FAR char *str;
+  int value;
+  int index;
+  int nargs;
+
+  for (index = 1; index < argc; )
+    {
+      ptr = argv[index];
+      if (ptr[0] != '-')
+        {
+          printf("Invalid options format: %s\n", ptr);
+          exit(0);
+        }
+
+      switch (ptr[1])
+        {
+          case 'i':
+            nargs = arg_decimal(&argv[index], &value);
+            if (value < 0)
+              {
+                printf("Count must be non-negative: %d\n", value);
+                exit(1);
+              }
+
+            rmtchar->rmtchar_items = value;
+            index += nargs;
+            break;
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+          case 't':
+            nargs = arg_string(&argv[index], &str);
+            rmtchar_devpath(rmtchar, str, true);
+            index += nargs;
+            break;
+#endif
+
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+          case 'r':
+            nargs = arg_string(&argv[index], &str);
+            rmtchar_devpath(rmtchar, str, false);
+            index += nargs;
+            break;
+#endif
+          case 'h':
+            rmtchar_help(rmtchar);
+            exit(0);
+
+          default:
+            printf("Unsupported option: %s\n", ptr);
+            rmtchar_help(rmtchar);
+            exit(1);
+        }
+    }
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rmtchar_main
+ ****************************************************************************/
+
+int main(int argc, FAR char *argv[])
+{
+  pthread_attr_t attr;
+  pthread_addr_t result;
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+  pthread_t transmitter;
+#endif
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+  pthread_t receiver;
+#endif
+#if defined(CONFIG_EXAMPLES_RMTCHAR_RX) && defined(CONFIG_EXAMPLES_RMTCHAR_TX)
+  struct sched_param param;
+#endif
+  int ret;
+
+  UNUSED(ret);
+
+  /* Check if we have initialized */
+
+  if (!g_rmtchar.initialized)

Review Comment:
   The same of https://github.com/apache/nuttx-apps/pull/2232#discussion_r1430499305



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] examples/rmtchar: Implement RX and/or TX using the RMT char driver [nuttx-apps]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on PR #2232:
URL: https://github.com/apache/nuttx-apps/pull/2232#issuecomment-1860322561

   CI seems to be failing due to unrelated issues... 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] examples/rmtchar: Implement RX and/or TX using the RMT char driver [nuttx-apps]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on code in PR #2232:
URL: https://github.com/apache/nuttx-apps/pull/2232#discussion_r1430500049


##########
examples/rmtchar/rmtchar.h:
##########
@@ -0,0 +1,127 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __APPS_EXAMPLES_RMTCHAR_RMTCHAR_H
+#define __APPS_EXAMPLES_RMTCHAR_RMTCHAR_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <pthread.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Configuration */
+
+#ifndef CONFIG_EXAMPLES_RMTCHAR_TX_DEVPATH
+#  define CONFIG_EXAMPLES_RMTCHAR_TX_DEVPATH "/dev/rmt0"
+#endif
+
+#ifndef CONFIG_EXAMPLES_RMTCHAR_RX_DEVPATH
+#  define CONFIG_EXAMPLES_RMTCHAR_RX_DEVPATH "/dev/rmt1"
+#endif
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+struct rmtchar_state_s
+{
+  bool initialized;

Review Comment:
   The same of https://github.com/apache/nuttx-apps/pull/2232#discussion_r1430499305



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] examples/rmtchar: Implement RX and/or TX using the RMT char driver [nuttx-apps]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on code in PR #2232:
URL: https://github.com/apache/nuttx-apps/pull/2232#discussion_r1429970658


##########
examples/rmtchar/rmtchar_main.c:
##########
@@ -0,0 +1,364 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar_main.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <errno.h>
+#include <debug.h>
+
+#include "rmtchar.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if !defined(CONFIG_EXAMPLES_RMTCHAR_RX) && \
+    !defined(CONFIG_EXAMPLES_RMTCHAR_TX)
+#  error "At least one of CONFIG_EXAMPLES_RMTCHAR_RX or \
+          CONFIG_EXAMPLES_RMTCHAR_TX must be defined"
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+struct rmtchar_state_s g_rmtchar;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rmtchar_devpath
+ ****************************************************************************/
+
+static void rmtchar_devpath(FAR struct rmtchar_state_s *rmtchar,
+                            FAR const char *devpath,
+                            bool is_tx)
+{
+  /* Get rid of any old device path */
+
+  if (is_tx)
+    {
+      if (rmtchar->txdevpath)
+        {
+          free(rmtchar->txdevpath);
+        }
+
+      /* Then set-up the new device path by copying the string */
+
+      rmtchar->txdevpath = strdup(devpath);
+    }
+  else
+    {
+      if (rmtchar->rxdevpath)
+        {
+          free(rmtchar->rxdevpath);
+        }
+
+      /* Then set-up the new device path by copying the string */
+
+      rmtchar->rxdevpath = strdup(devpath);
+    }
+}
+
+/****************************************************************************
+ * Name: rmtchar_help
+ ****************************************************************************/
+
+static void rmtchar_help(FAR struct rmtchar_state_s *rmtchar)
+{
+  printf("Usage: rmtchar [OPTIONS]\n");
+  printf("\nArguments are \"sticky\".\n");
+  printf("For example, once the RMT character device is\n");
+  printf("specified, that device will be re-used until it is changed.\n");
+  printf("\n\"sticky\" OPTIONS include:\n");
+  printf("  [-i items] selects the number of words (items) to be transmitted"
+         " or received by the RMT character device. "
+         "Default: %d Current: %d\n",
+         CONFIG_EXAMPLES_RMTCHAR_ITEMS,
+         g_rmtchar.rmtchar_items ? g_rmtchar.rmtchar_items :
+         CONFIG_EXAMPLES_RMTCHAR_ITEMS);
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+  printf("  [-t devpath] selects the RMT transmitter character device path. "
+         "Default: %s Current: %s\n",
+         CONFIG_EXAMPLES_RMTCHAR_TX_DEVPATH,
+         g_rmtchar.txdevpath ? g_rmtchar.txdevpath : "NONE");
+#endif
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+  printf("  [-r devpath] selects the RMT receiver character device path. "
+         "Default: %s Current: %s\n",
+         CONFIG_EXAMPLES_RMTCHAR_RX_DEVPATH,
+         g_rmtchar.rxdevpath ? g_rmtchar.rxdevpath : "NONE");
+#endif
+  printf("  [-h] shows this message and exits\n");
+}
+
+/****************************************************************************
+ * Name: arg_string
+ ****************************************************************************/
+
+static int arg_string(FAR char **arg, FAR char **value)
+{
+  FAR char *ptr = *arg;
+
+  if (ptr[2] == '\0')
+    {
+      *value = arg[1];
+      return 2;
+    }
+  else
+    {
+      *value = &ptr[2];
+      return 1;
+    }
+}
+
+/****************************************************************************
+ * Name: arg_decimal
+ ****************************************************************************/
+
+static int arg_decimal(FAR char **arg, FAR int *value)
+{
+  FAR char *string;
+  int ret;
+
+  ret = arg_string(arg, &string);
+  *value = strtol(string, NULL, 10);
+  return ret;
+}
+
+/****************************************************************************
+ * Name: parse_args
+ ****************************************************************************/
+
+static void parse_args(FAR struct rmtchar_state_s *rmtchar,
+                       int argc,
+                       FAR char **argv)
+{
+  FAR char *ptr;
+  FAR char *str;
+  int value;
+  int index;
+  int nargs;
+
+  for (index = 1; index < argc; )
+    {
+      ptr = argv[index];
+      if (ptr[0] != '-')
+        {
+          printf("Invalid options format: %s\n", ptr);
+          exit(0);
+        }
+
+      switch (ptr[1])
+        {
+          case 'i':
+            nargs = arg_decimal(&argv[index], &value);
+            if (value < 0)
+              {
+                printf("Count must be non-negative: %d\n", value);
+                exit(1);
+              }
+
+            rmtchar->rmtchar_items = value;
+            index += nargs;
+            break;
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+          case 't':
+            nargs = arg_string(&argv[index], &str);
+            rmtchar_devpath(rmtchar, str, true);
+            index += nargs;
+            break;
+#endif
+
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+          case 'r':
+            nargs = arg_string(&argv[index], &str);
+            rmtchar_devpath(rmtchar, str, false);
+            index += nargs;
+            break;
+#endif
+          case 'h':
+            rmtchar_help(rmtchar);
+            exit(0);
+
+          default:
+            printf("Unsupported option: %s\n", ptr);
+            rmtchar_help(rmtchar);
+            exit(1);
+        }
+    }
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rmtchar_main
+ ****************************************************************************/
+
+int main(int argc, FAR char *argv[])
+{
+  pthread_attr_t attr;
+  pthread_addr_t result;
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+  pthread_t transmitter;
+#endif
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+  pthread_t receiver;
+#endif
+#if defined(CONFIG_EXAMPLES_RMTCHAR_RX) && defined(CONFIG_EXAMPLES_RMTCHAR_TX)
+  struct sched_param param;
+#endif
+  int ret;
+
+  UNUSED(ret);
+
+  /* Check if we have initialized */
+
+  if (!g_rmtchar.initialized)
+    {
+      /* Set the default values */
+
+      g_rmtchar.rmtchar_items = CONFIG_EXAMPLES_RMTCHAR_ITEMS;
+
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+      rmtchar_devpath(&g_rmtchar, CONFIG_EXAMPLES_RMTCHAR_TX_DEVPATH, true);
+#endif
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+      rmtchar_devpath(&g_rmtchar, CONFIG_EXAMPLES_RMTCHAR_RX_DEVPATH, false);
+#endif
+
+      g_rmtchar.initialized = true;
+    }
+
+  /* Parse the command line */
+
+  parse_args(&g_rmtchar, argc, argv);
+
+  sched_lock();

Review Comment:
   There is no need... it`s from legacy code. Removed, thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] examples/rmtchar: Implement RX and/or TX using the RMT char driver [nuttx-apps]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on code in PR #2232:
URL: https://github.com/apache/nuttx-apps/pull/2232#discussion_r1430530341


##########
examples/rmtchar/rmtchar_transmitter.c:
##########
@@ -0,0 +1,156 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar_transmitter.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <errno.h>
+#include <debug.h>
+#include <unistd.h>
+
+#include <nuttx/audio/audio.h>
+
+#include "rmtchar.h"
+
+#ifdef CONFIG_EXAMPLES_RMTCHAR_TX
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rmtchar_transmitter()
+ *
+ * Description:
+ *   This is the entry point for the transmitter thread.
+ *
+ ****************************************************************************/
+
+pthread_addr_t rmtchar_transmitter(pthread_addr_t arg)
+{
+  struct rmtchar_state_s *rmtchar = (struct rmtchar_state_s *)arg;

Review Comment:
   done!



##########
examples/rmtchar/rmtchar_receiver.c:
##########
@@ -0,0 +1,138 @@
+/****************************************************************************
+ * apps/examples/rmtchar/rmtchar_receiver.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <errno.h>
+#include <debug.h>
+#include <unistd.h>
+
+#include "rmtchar.h"
+
+#ifdef CONFIG_EXAMPLES_RMTCHAR_RX
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rmtchar_receiver()
+ *
+ * Description:
+ *   This is the entry point for the receiver thread.
+ *
+ ****************************************************************************/
+
+pthread_addr_t rmtchar_receiver(pthread_addr_t arg)
+{
+  struct rmtchar_state_s *rmtchar = (struct rmtchar_state_s *)arg;

Review Comment:
   done!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org