xiaoxiang781216 commented on code in PR #10077:
URL: https://github.com/apache/nuttx/pull/10077#discussion_r1295565646
##########
drivers/sensors/bmi160.c:
##########
@@ -608,7 +608,7 @@ static ssize_t bmi160_read(FAR struct file *filep, FAR char
*buffer,
if (len < sizeof(struct accel_gyro_st_s))
{
- snerr("Expected buffer size is %d\n", sizeof(struct accel_gyro_st_s));
+ snerr("Expected buffer size is %lu\n", sizeof(struct accel_gyro_st_s));
Review Comment:
```suggestion
snerr("Expected buffer size is %zu\n", sizeof(struct accel_gyro_st_s));
```
##########
drivers/sensors/Kconfig:
##########
@@ -161,6 +161,14 @@ config SENSORS_BMI160
if SENSORS_BMI160
+config SENSORS_BMI160_UORB
+ bool "BMI160 UORB Interface"
+ default n
+ select UORB
Review Comment:
depends on
##########
include/nuttx/sensors/bmi160_uorb.h:
##########
@@ -0,0 +1,148 @@
+/****************************************************************************
+ * include/nuttx/sensors/bmi160_uorb.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 __INCLUDE_NUTTX_SENSORS_BMI160_H
+#define __INCLUDE_NUTTX_SENSORS_BMI160_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/fs/ioctl.h>
+
+#if defined(CONFIG_SENSORS_BMI160) || defined(CONFIG_SENSORS_BMI160_SCU)
+
+#ifdef CONFIG_SENSORS_BMI160_SCU_I2C
+#define CONFIG_SENSORS_BMI160_I2C
+#endif
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define BMI160_SPI_MAXFREQUENCY 10000000
+
+/* Configuration ************************************************************/
+
+/* Power mode */
+
+#define BMI160_PM_SUSPEND (0x00)
+#define BMI160_PM_NORMAL (0x01)
+#define BMI160_PM_LOWPOWER (0x02)
+#define BMI160_PM_FASTSTARTUP (0x03)
+
+/* Output data rate */
+
+#define BMI160_ACCEL_ODR_0_78HZ (0x01)
+#define BMI160_ACCEL_ODR_1_56HZ (0x02)
+#define BMI160_ACCEL_ODR_3_12HZ (0x03)
+#define BMI160_ACCEL_ODR_6_25HZ (0x04)
+#define BMI160_ACCEL_ODR_12_5HZ (0x05)
+#define BMI160_ACCEL_ODR_25HZ (0x06)
+#define BMI160_ACCEL_ODR_50HZ (0x07)
+#define BMI160_ACCEL_ODR_100HZ (0x08)
+#define BMI160_ACCEL_ODR_200HZ (0x09)
+#define BMI160_ACCEL_ODR_400HZ (0x0A)
+#define BMI160_ACCEL_ODR_800HZ (0x0B)
+#define BMI160_ACCEL_ODR_1600HZ (0x0C)
+
+/* IOCTL Commands ***********************************************************/
+
+#define SNIOC_ENABLESC _SNIOC(0x0001) /* Arg: uint8_t value */
+#define SNIOC_READSC _SNIOC(0x0002) /* Arg: int16_t* pointer */
+#define SNIOC_SETACCPM _SNIOC(0x0003) /* Arg: uint8_t value */
+#define SNIOC_SETACCODR _SNIOC(0x0004) /* Arg: uint8_t value */
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * struct 6-axis data
+ ****************************************************************************/
+
+struct spi_dev_s;
+struct i2c_master_s;
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Name: bmi160_register
+ *
+ * Description:
+ * Register the BMI160 sensor.
+ *
+ * Input Parameters:
+ * devno - Sensor device number.
+ * config - Interrupt fuctions.
+ *
+ * Returned Value:
+ * Description of the value returned by this function (if any),
+ * including an enumeration of all possible error values.
+ *
+ * Assumptions/Limitations:
+ * none.
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_SENSORS_BMI160_SCU
+
+# ifdef CONFIG_SENSORS_BMI160_I2C
+int bmi160_register(int devno, FAR struct i2c_master_s *dev);
+# else /* CONFIG_BMI160_SPI */
+int bmi160_register(int devno, FAR struct spi_dev_s *dev);
+# endif
+
+#else /* CONFIG_SENSORS_BMI160_SCU */
Review Comment:
let's remove Spresense specific code(
fhttps://github.com/apache/nuttx/issues/10240).
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]