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

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new ca53446c193 sensors/goldfish_gnss_uorb: Using different nbuffer for 
each topic of GNSS
ca53446c193 is described below

commit ca53446c193afd3bab15149b1ad3e17e107f4d8d
Author: wangjianyu3 <[email protected]>
AuthorDate: Mon Dec 2 18:12:53 2024 +0800

    sensors/goldfish_gnss_uorb: Using different nbuffer for each topic of GNSS
    
    Pass one nbuffer entry per GNSS topic (indexed by SENSOR_GNSS_IDX_*)
    to the multi-buffer gnss_register() API instead of a single shared
    batch_number, so each topic gets its own event buffer.
    
    Assisted-by: OpenCode:mimo-v2.6-pro
    Signed-off-by: wangjianyu3 <[email protected]>
---
 drivers/sensors/goldfish_gnss_uorb.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/sensors/goldfish_gnss_uorb.c 
b/drivers/sensors/goldfish_gnss_uorb.c
index cd07e76ca85..0ba576ee245 100644
--- a/drivers/sensors/goldfish_gnss_uorb.c
+++ b/drivers/sensors/goldfish_gnss_uorb.c
@@ -31,6 +31,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <string.h>
+#include <sys/param.h>
 
 #include <nuttx/debug.h>
 #include <nuttx/fs/fs.h>
@@ -198,6 +199,15 @@ int goldfish_gnss_init(int devno, uint32_t batch_number)
   FAR struct goldfish_gnss_s *gnss;
   FAR char *argv[2];
   char arg1[32];
+  uint32_t nbuffer[] =
+  {
+    [SENSOR_GNSS_IDX_GNSS] = batch_number,
+    [SENSOR_GNSS_IDX_GNSS_SATELLITE] = batch_number,
+    [SENSOR_GNSS_IDX_GNSS_MEASUREMENT] = batch_number,
+    [SENSOR_GNSS_IDX_GNSS_CLOCK] = batch_number,
+    [SENSOR_GNSS_IDX_GNSS_GEOFENCE] = batch_number,
+  };
+
   int ret;
 
   /* Alloc memory for sensor */
@@ -235,5 +245,5 @@ int goldfish_gnss_init(int devno, uint32_t batch_number)
 
   gnss->gnss.ops = &g_goldfish_gnss_ops;
 
-  return gnss_register(&gnss->gnss, devno, batch_number);
+  return gnss_register(&gnss->gnss, devno, nbuffer, nitems(nbuffer));
 }

Reply via email to