linguini1 commented on code in PR #15789:
URL: https://github.com/apache/nuttx/pull/15789#discussion_r1948138726


##########
include/nuttx/sensors/lsm6dso32.h:
##########
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * include/nuttx/sensors/lsm6dso32.h
+ *
+ * Contributed by Carleton University InSpace
+ *
+ * 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 __INCLUDE_NUTTX_SENSORS_LSM6DSO32_H
+#define __INCLUDE_NUTTX_SENSORS_LSM6DSO32_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/irq.h>
+#include <nuttx/i2c/i2c_master.h>
+#include <nuttx/sensors/ioctl.h>
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/* Gyroscope FSRs */
+
+enum lsm6dso32_fsr_gyro_e
+{
+  LSM6DSO32_FSR_GY_250DPS = 0x0,  /* +-250dps */
+  LSM6DSO32_FSR_GY_125DPS = 0x1,  /* +-125dps */
+  LSM6DSO32_FSR_GY_500DPS = 0x2,  /* +-500dps */
+  LSM6DSO32_FSR_GY_1000DPS = 0x4, /* +-1000dps */
+  LSM6DSO32_FSR_GY_2000DPS = 0x6, /* +-2000dps */
+};
+
+/* Accelerometer FSRs */
+
+enum lsm6dso32_fsr_xl_e
+{
+  LSM6DSO32_FSR_XL_4G = 0x0,  /* +-4g */
+  LSM6DSO32_FSR_XL_32G = 0x1, /* +-32g */
+  LSM6DSO32_FSR_XL_8G = 0x2,  /* +-8g */
+  LSM6DSO32_FSR_XL_16G = 0x3, /* +-16g */
+};

Review Comment:
   This is a good point. Do you think it would be worthwhile compiling some of 
these standard ways of doing things into a guide for writing new sensor 
drivers? I.e. use uORB, minimize device specific arguments, etc?
   
   For one thing, uORB accelerometers use SI units of m/s^2, but that's 
cumbersome to use as the value for the FSR which is normally set in g. It could 
be worth writing down somewhere "all accelerometers should support the 
`SNIOC_SETFULLSCALE` command to change the FSR, where the argument is the new 
FSR in g". A lot of these commands have popped up or similar commands made to 
be sensor specific in sensors/ioctl.h. I like the idea of starting to unify 
them by picking out some existing commands to make common across sensor types.



-- 
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