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

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

commit cb46138bdb1ba41eb3a718e168db2f7266517262
Author: Alan Carvalho de Assis <[email protected]>
AuthorDate: Fri Oct 9 11:10:00 2026 -0300

    system/uorb, system/sensortest: Add inclinometer sensor type.
    
    NuttX adds SENSOR_TYPE_INCLINOMETER and struct sensor_inclinometer
    (X, Y and Z tilt in degrees, plus temperature) for the Murata SCL3300
    driver.  Define the sensor_inclinometer topic, so that uorb_listener
    can print it, and add it to sensortest.  The struct has the same layout
    as struct sensor_accel, so sensortest prints it with print_vec3.
    
    This depends on the NuttX commit that adds the sensor type.
    
    Assisted-by: Claude:claude-opus-5-5
    Signed-off-by: Alan Carvalho de Assis <[email protected]>
---
 system/sensortest/sensortest.c    |  2 ++
 system/uorb/sensor/inclinometer.c | 41 +++++++++++++++++++++++++++++++++++++++
 system/uorb/sensor/inclinometer.h | 38 ++++++++++++++++++++++++++++++++++++
 system/uorb/sensor/topics.c       |  2 ++
 4 files changed, 83 insertions(+)

diff --git a/system/sensortest/sensortest.c b/system/sensortest/sensortest.c
index 73b8db177..d54f9904a 100644
--- a/system/sensortest/sensortest.c
+++ b/system/sensortest/sensortest.c
@@ -105,6 +105,8 @@ static const struct sensor_info g_sensor_info[] =
   {print_valf,  sizeof(struct sensor_hrate), "hrate"},
   {print_valf,  sizeof(struct sensor_humi),  "humi"},
   {print_valf2, sizeof(struct sensor_impd),  "impd"},
+  {print_vec3,  sizeof(struct sensor_inclinometer),
+                                             "inclinometer"},
   {print_valf,  sizeof(struct sensor_ir),    "ir"},
   {print_valf,  sizeof(struct sensor_light), "light"},
   {print_vec3,  sizeof(struct sensor_mag),   "mag"},
diff --git a/system/uorb/sensor/inclinometer.c 
b/system/uorb/sensor/inclinometer.c
new file mode 100644
index 000000000..50fb01222
--- /dev/null
+++ b/system/uorb/sensor/inclinometer.c
@@ -0,0 +1,41 @@
+/****************************************************************************
+ * apps/system/uorb/sensor/inclinometer.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/inclinometer.h>
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#ifdef CONFIG_UORB_FORMAT
+static const char sensor_inclinometer_format[] =
+  "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,temperature:%hf";
+#endif
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+ORB_DEFINE(sensor_inclinometer, struct sensor_inclinometer,
+           sensor_inclinometer_format);
diff --git a/system/uorb/sensor/inclinometer.h 
b/system/uorb/sensor/inclinometer.h
new file mode 100644
index 000000000..1c0c7f8d8
--- /dev/null
+++ b/system/uorb/sensor/inclinometer.h
@@ -0,0 +1,38 @@
+/****************************************************************************
+ * apps/system/uorb/sensor/inclinometer.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_INCLINOMETER_H
+#define __APPS_SYSTEM_UORB_SENSOR_INCLINOMETER_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <uORB/uORB.h>
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/* register this as object request broker structure */
+
+ORB_DECLARE(sensor_inclinometer);
+
+#endif
diff --git a/system/uorb/sensor/topics.c b/system/uorb/sensor/topics.c
index e1941233c..a30167ce2 100644
--- a/system/uorb/sensor/topics.c
+++ b/system/uorb/sensor/topics.c
@@ -54,6 +54,7 @@
 #include <sensor/hrate.h>
 #include <sensor/humi.h>
 #include <sensor/impd.h>
+#include <sensor/inclinometer.h>
 #include <sensor/ir.h>
 #include <sensor/light.h>
 #include <sensor/mag.h>
@@ -119,6 +120,7 @@ static FAR const struct orb_metadata *g_sensor_list[] =
   ORB_ID(sensor_humi),
   ORB_ID(sensor_hrate),
   ORB_ID(sensor_impd),
+  ORB_ID(sensor_inclinometer),
   ORB_ID(sensor_ir),
   ORB_ID(sensor_light),
   ORB_ID(sensor_light_uncal),

Reply via email to