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

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


The following commit(s) were added to refs/heads/master by this push:
     new 58326d39d system/uorb: add a new uorb topic ENG
58326d39d is described below

commit 58326d39dcc1886b39f695cb4b5d36db07593ecd
Author: liucheng5 <[email protected]>
AuthorDate: Mon Nov 4 17:26:05 2024 +0800

    system/uorb: add a new uorb topic ENG
    
    Add a new uorb topic for ENG sensor
    
    Signed-off-by: liucheng5 <[email protected]>
    Signed-off-by: likun17 <[email protected]>
---
 system/uorb/sensor/eng.c    | 41 +++++++++++++++++++++++++++++++++++++++++
 system/uorb/sensor/eng.h    | 38 ++++++++++++++++++++++++++++++++++++++
 system/uorb/sensor/topics.c |  4 +++-
 3 files changed, 82 insertions(+), 1 deletion(-)

diff --git a/system/uorb/sensor/eng.c b/system/uorb/sensor/eng.c
new file mode 100644
index 000000000..afc712aec
--- /dev/null
+++ b/system/uorb/sensor/eng.c
@@ -0,0 +1,41 @@
+/****************************************************************************
+ * apps/system/uorb/sensor/eng.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 <sensor/eng.h>
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#ifdef CONFIG_DEBUG_UORB
+static const char sensor_eng_format[] =
+  "timestamp:%" PRIu64 ",eng0:%hf,eng1:%hf,eng2:%hf,eng3:%hf,"
+  "status:0x%" PRIx32 "";
+#endif
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+ORB_DEFINE(sensor_eng, struct sensor_eng, sensor_eng_format);
diff --git a/system/uorb/sensor/eng.h b/system/uorb/sensor/eng.h
new file mode 100644
index 000000000..099c13290
--- /dev/null
+++ b/system/uorb/sensor/eng.h
@@ -0,0 +1,38 @@
+/****************************************************************************
+ * apps/system/uorb/sensor/eng.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_SYSTEM_UORB_SENSOR_ENG_H
+#define __APPS_SYSTEM_UORB_SENSOR_ENG_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <uORB/uORB.h>
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/* register this as object request broker structure */
+
+ORB_DECLARE(sensor_eng);
+
+#endif
diff --git a/system/uorb/sensor/topics.c b/system/uorb/sensor/topics.c
index 02666a5f0..48619627f 100644
--- a/system/uorb/sensor/topics.c
+++ b/system/uorb/sensor/topics.c
@@ -38,6 +38,7 @@
 #include <sensor/co2.h>
 #include <sensor/dust.h>
 #include <sensor/ecg.h>
+#include <sensor/eng.h>
 #include <sensor/force.h>
 #include <sensor/gas.h>
 #include <sensor/gnss.h>
@@ -87,6 +88,7 @@ static FAR const struct orb_metadata *g_sensor_list[] =
   ORB_ID(sensor_device_orientation),
   ORB_ID(sensor_dust),
   ORB_ID(sensor_ecg),
+  ORB_ID(sensor_eng),
   ORB_ID(sensor_force),
   ORB_ID(sensor_gas),
   ORB_ID(sensor_glance_gesture),
@@ -157,7 +159,7 @@ FAR const struct orb_metadata *orb_get_meta(FAR const char 
*name)
   int fd;
   int i;
 
-  /* Fisrt search built-in topics */
+  /* First search built-in topics */
 
   for (i = 0; g_sensor_list[i]; i++)
     {

Reply via email to