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

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

commit f4226080e90b8a01d48584a773fca1659acd6a30
Author: Alan Carvalho de Assis <[email protected]>
AuthorDate: Fri Oct 9 11:35:51 2026 -0300

    nuttx/uorb: Add Inclinometer type
    
    This PR adds inclinometer uORB sensor type.
    
    Signed-off-by: Alan C. Assis <[email protected]>
---
 drivers/sensors/sensor.c |  1 +
 include/nuttx/uorb.h     | 23 ++++++++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/sensors/sensor.c b/drivers/sensors/sensor.c
index 95ad1b52ead..33b0858d8df 100644
--- a/drivers/sensors/sensor.c
+++ b/drivers/sensors/sensor.c
@@ -231,6 +231,7 @@ static const struct sensor_meta_s g_sensor_meta[] =
   {sizeof(struct sensor_conductivity),        "conductivity"},
   {sizeof(struct sensor_energy),              "energy"},
   {sizeof(struct sensor_charge),              "charge"},
+  {sizeof(struct sensor_inclinometer),        "inclinometer"},
 };
 
 static const struct file_operations g_sensor_fops =
diff --git a/include/nuttx/uorb.h b/include/nuttx/uorb.h
index c67f88b99cb..9bdaa2bab87 100644
--- a/include/nuttx/uorb.h
+++ b/include/nuttx/uorb.h
@@ -648,11 +648,23 @@
 
 #define SENSOR_TYPE_CHARGE                          65
 
+/* Inclinometer
+ * A sensor of this type returns the static inclination (tilt) of the
+ * device X, Y and Z axes relative to the horizontal plane, derived from
+ * the gravity vector. Each value is in degrees and signed, in the range
+ * [-90, +90]: 0 means the axis is horizontal, +90 means the axis points
+ * straight up (away from gravity, where an accelerometer on that axis
+ * reads +1g) and -90 means it points straight down. The values are only
+ * meaningful while the device is not accelerating.
+ */
+
+#define SENSOR_TYPE_INCLINOMETER                    66
+
 /* The total number of sensor
  * please increase it if you added a new sensor type!
  */
 
-#define SENSOR_TYPE_COUNT                           66
+#define SENSOR_TYPE_COUNT                           67
 
 /* The additional sensor open flags */
 
@@ -1136,6 +1148,15 @@ struct sensor_charge        /* Type: Charge */
   int64_t charge;           /* Accumulated charge. Unit is uC. */
 };
 
+struct sensor_inclinometer   /* Type: Inclinometer */
+{
+  uint64_t      timestamp;   /* Units is microseconds */
+  sensor_data_t x;           /* X axis inclination in degrees */
+  sensor_data_t y;           /* Y axis inclination in degrees */
+  sensor_data_t z;           /* Z axis inclination in degrees */
+  sensor_data_t temperature; /* Temperature in degrees celsius */
+};
+
 struct sensor_gnss          /* Type: GNSS */
 {
   uint64_t timestamp;       /* Time since system start, Units is microseconds 
*/

Reply via email to