acassis commented on code in PR #16605:
URL: https://github.com/apache/nuttx/pull/16605#discussion_r2164011453


##########
Documentation/components/drivers/special/sensors/l86xxx.rst:
##########
@@ -0,0 +1,149 @@
+=======
+L86-XXX
+=======
+
+This driver provides support for the L86-XXX family of GNSS modules by
+Quectel via the :doc:`uorb </components/drivers/special/sensors/sensors_uorb>` 
interface. 
+Functionality for this driver was tested using the Quectel L86-M33.
+
+.. warning::
+   This driver only contains preliminary support for a handful of proprietary
+   'PMTK' commands There is no support for the entire suite of commands yet
+   CONSIDER THIS DRIVER EXPERIMENTAL.
+
+Application Programming Interface
+=================================
+
+To register the device for use, you will need to enable the standard upper half
+serial drivers (``CONFIG_STANDARD_SERIAL``), since the L86-XXX driver requires
+the path to the UART interface the module is connected to. You will also need 
to 
+ensure that the baud rate of the UART interface is set to 9600, which is the 
default 
+baud rate of the L86-XXX series of GNSS modules. 
+
+The driver supports changing the default baud rate and update rate of the GNSS 
module.
+As a result, you will also need to enable serial TERMIOS support 
(``CONFIG_SERIAL_TERMIOS``).
+The baud rate and update rate of the GNSS module can be configured using the 
``L86_XXX_BAUD`` and ``L86_XXX_FIX_INT`` options respectively.
+Note that a faster update rate will require a higher baud rate to support it 
and the supported baud rates for the L86-XXX series of GNSS modules are: 4800, 
9600, 14400, 19200, 38400, 57600 and 115200.
+The baud rate and update rates of the module are changed at registration time.
+
+.. code-block:: c
+
+   #if defined(CONFIG_SENSORS_L86_XXX)
+      #include <nuttx/sensors/l86xxx.h>
+      
+      /* Register L86-M33 on USART3 */
+
+      ret = l86xxx_register("/dev/l86m33", "/dev/ttyS2", 0);
+      if (ret < 0) {
+         syslog(LOG_ERR, "Failed to register L86-M33: %d\n", ret);
+      }
+   #endif
+
+One the driver is registered, it starts a thread that continuosly reads raw 
output from the specified UART device and

Review Comment:
   ```suggestion
   Once the driver is registered, it starts a thread that continuosly reads raw 
output from the specified UART device and



##########
drivers/sensors/l86xxx_uorb.c:
##########
@@ -0,0 +1,675 @@
+/****************************************************************************
+ * drivers/sensors/l86mxx_uorb.c
+ * 
+ * NOTE: EXPERIMENTAL DRIVER
+ *
+ * Contributed by Carleton University InSpace
+ * 
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * 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 <nuttx/nuttx.h>
+#include <debug.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <math.h>
+#include <time.h>
+#include <termios.h>
+
+#include <nuttx/fs/fs.h>
+#include <nuttx/kmalloc.h>
+#include <nuttx/kthread.h>
+#include <nuttx/mutex.h>
+#include <nuttx/semaphore.h>
+#include <nuttx/signal.h>
+#include <nuttx/wqueue.h>
+#include <nuttx/sensors/sensor.h>
+#include <minmea/minmea.h>
+
+#include <nuttx/sensors/l86xxx.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#ifndef CONFIG_SENSORS_L86_XXX_THREAD_STACKSIZE
+#define CONFIG_SENSORS_L86_XXX_THREAD_STACKSIZE 10000
+#endif
+
+#ifndef CONFIG_L86_XXX_BAUD
+#define CONFIG_L86_XXX_BAUD 9600
+#endif
+
+#if CONFIG_L86_XXX_BAUD == 4800
+  #define L86_XXX_BAUD_RATE 4800
+#elif CONFIG_L86_XXX_BAUD == 9600
+    #define L86_XXX_BAUD_RATE 9600
+#elif CONFIG_L86_XXX_BAUD == 14400
+  #define L86_XXX_BAUD_RATE 14400
+#elif CONFIG_L86_XXX_BAUD == 19200
+  #define L86_XXX_BAUD_RATE 19200
+#elif CONFIG_L86_XXX_BAUD == 38400
+  #define L86_XXX_BAUD_RATE 38400
+#elif CONFIG_L86_XXX_BAUD == 57600
+  #define L86_XXX_BAUD_RATE 57600
+#elif CONFIG_L86_XXX_BAUD == 115200
+  #define L86_XXX_BAUD_RATE 115200
+#else
+  #error "Invalid baud rate. Supported baud rates are: 4800, 5600, 14400, 
19200, 38400, 57600, 115200"
+#endif
+
+#ifdef CONFIG_L86_XXX_FIX_INT
+#define L86_XXX_FIX_INT CONFIG_L86_XXX_FIX_INT
+#endif
+
+/* Helper to get array length */
+
+#define MINMEA_MAX_LENGTH    256
+
+/****************************************************************************
+ * Private Data Types
+ ****************************************************************************/
+
+/* GNSS device struct */
+
+typedef struct
+{
+  FAR struct file uart;               /* UART interface */
+  struct sensor_lowerhalf_s lower;    /* UORB lower-half */
+  mutex_t devlock;                    /* Exclusive access */
+  sem_t run;                          /* Start/stop collection thread */
+  bool enabled;                       /* If module has started */
+  char buffer[MINMEA_MAX_LENGTH];     /* Buffer for UART interface */
+#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
+  int16_t crefs; /* Number of open references */
+#endif
+} l86xxx_dev_s;
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static int l86xxx_control(FAR struct sensor_lowerhalf_s *lower,
+                         FAR struct file *filep, int cmd, unsigned long arg);
+static int l86xxx_activate(FAR struct sensor_lowerhalf_s *lower,
+                          FAR struct file *filep, bool enable);
+static int l86xxx_set_interval(FAR struct sensor_lowerhalf_s *lower,
+                                     FAR struct file *filep,
+                                     FAR uint32_t *period_us);
+static char calculate_checksum(char* data, int len);
+static int set_baud_rate(l86xxx_dev_s *dev, int br);
+static int send_command(l86xxx_dev_s *dev, L86XXX_PMTK_COMMAND cmd, unsigned 
long arg);
+static void read_line(l86xxx_dev_s *dev);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const struct sensor_ops_s g_sensor_ops =
+{
+  .control = l86xxx_control,
+  .activate = l86xxx_activate,
+  .set_interval = l86xxx_set_interval,
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+/****************************************************************************
+ * Name: calculate_checksum
+ *
+ * Description:
+ *   Calculate checksum of PMTK command.
+ *
+ * Arguments:
+ *    data      -  Char pointer to calculate checksum for
+ *    len       -  Length of char string
+ * 
+ * Returns:
+ *  1-byte checksum value to be interpreted as a hex byte
+ ****************************************************************************/
+ static char calculate_checksum(char* data, int len){

Review Comment:
   Please follow the NuttX Coding Style:
   https://nuttx.apache.org/docs/latest/contributing/coding_style.html



-- 
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-unsubscr...@nuttx.apache.org

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

Reply via email to