You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/06/30 01:43:34 UTC
[incubator-nuttx] branch master updated: Make sensor mpu60x0 more configurable in menuconfig
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new cd88ad3539 Make sensor mpu60x0 more configurable in menuconfig
cd88ad3539 is described below
commit cd88ad35397c5d1a22f1df5efb157cf78156177c
Author: AuroraRAS <ch...@gmail.com>
AuthorDate: Thu Jun 30 01:53:07 2022 +0800
Make sensor mpu60x0 more configurable in menuconfig
Signed-off-by: AuroraRAS <ch...@gmail.com>
---
drivers/sensors/Kconfig | 46 ++++++++++++++++++++++++++++++++++++++++++++++
drivers/sensors/mpu60x0.c | 15 +++++++++------
2 files changed, 55 insertions(+), 6 deletions(-)
diff --git a/drivers/sensors/Kconfig b/drivers/sensors/Kconfig
index fba436dad5..0e65af0112 100644
--- a/drivers/sensors/Kconfig
+++ b/drivers/sensors/Kconfig
@@ -738,6 +738,52 @@ config MPU60X0_EXTI
to the sampling rate chosen during operation.
Default: No interrupts or blocking, i.e. user-driven sampling.
+config MPU60X0_EXT_SYNC_SET
+ int "MPU60x0 frame sync bit position"
+ default 0
+ ---help---
+ EXT_SYNC_SET[2..0]
+ EXT_SYNC_SET: frame sync bit position
+ (see datasheet, it's ... complicated)
+
+config MPU60X0_DLPF_CFG
+ int "MPU60x0 digital low-pass filter bandwidth"
+ default 1
+ ---help---
+ DLPF_CFG[2..0]
+ DLPF_CFG: digital low-pass filter bandwidth
+ (see datasheet, it's ... complicated)
+
+config MPU60X0_GYRO_FS_SEL
+ int "MPU60x0 Gyro FS_SEL"
+ default 2
+ ---help---
+ Sets the @fs_sel bit in GYRO_CONFIG to the value provided. Per
+ the datasheet, the meaning of @fs_sel is as follows:
+ GYRO_CONFIG(0x1b) : XG_ST YG_ST ZG_ST FS_SEL1 FS_SEL0 x x x
+ XG_ST, YG_ST, ZG_ST : self-test (unsupported in this driver)
+ 1 -> activate self-test on X, Y, and/or Z gyros
+ FS_SEL[10] : full-scale range select
+ 0 -> ± 250 deg/sec
+ 1 -> ± 500 deg/sec
+ 2 -> ± 1000 deg/sec
+ 3 -> ± 2000 deg/sec
+
+config MPU60X0_ACCEL_AFS_SEL
+ int "MPU60x0 Accelerometer AFS_SEL"
+ default 2
+ ---help---
+ Sets the @afs_sel bit in ACCEL_CONFIG to the value provided. Per
+ the datasheet, the meaning of @afs_sel is as follows:
+ ACCEL_CONFIG(0x1c) : XA_ST YA_ST ZA_ST AFS_SEL1 AFS_SEL0 x x x
+ XA_ST, YA_ST, ZA_ST : self-test (unsupported in this driver)
+ 1 -> activate self-test on X, Y, and/or Z accelerometers
+ AFS_SEL[10] : full-scale range select
+ 0 -> ± 2 g
+ 1 -> ± 4 g
+ 2 -> ± 8 g
+ 3 -> ± 16 g
+
endif # SENSORS_MPU60X0
config SENSORS_MAX44009
diff --git a/drivers/sensors/mpu60x0.c b/drivers/sensors/mpu60x0.c
index 134bee0a85..4ecd684b77 100644
--- a/drivers/sensors/mpu60x0.c
+++ b/drivers/sensors/mpu60x0.c
@@ -731,17 +731,20 @@ static int mpu_reset(FAR struct mpu_dev_s *dev)
__mpu_write_pwr_mgmt_2(dev, 0);
- /* No FSYNC, set accel LPF at 184 Hz, gyro LPF at 188 Hz */
+ /* default No FSYNC, set accel LPF at 184 Hz, gyro LPF at 188 Hz in
+ * menuconfig
+ */
- __mpu_write_config(dev, 0, 1);
+ __mpu_write_config(dev, CONFIG_MPU60X0_EXT_SYNC_SET,
+ CONFIG_MPU60X0_DLPF_CFG);
- /* ± 1000 deg/sec */
+ /* default ± 1000 deg/sec in menuconfig */
- __mpu_write_gyro_config(dev, 2);
+ __mpu_write_gyro_config(dev, CONFIG_MPU60X0_GYRO_FS_SEL);
- /* ± 8g */
+ /* default ± 8g in menuconfig */
- __mpu_write_accel_config(dev, 2);
+ __mpu_write_accel_config(dev, CONFIG_MPU60X0_ACCEL_AFS_SEL);
/* clear INT on any read (we aren't using that pin right now) */