Shriyans406 opened a new pull request, #19359:
URL: https://github.com/apache/nuttx/pull/19359
## Summary
This PR adds a standard lower-half I2C character driver for the InvenSense
MPU6050 6-axis IMU (3-axis accelerometer + 3-axis gyroscope + temperature
sensor), along with board-level bringup integration for the ESP32 Heltec WiFi
LoRa32 board.
Key additions:
- `include/nuttx/sensors/mpu6050.h`: Public header defining register
addresses, data structures (`struct mpu6050_data_s`), and registration
prototype (`mpu6050_register`).
- `drivers/sensors/mpu6050.c`: Lower-half I2C character driver implementing
standard file operations (`open`, `close`, `read`, `write`, `ioctl`). Supports
configurable sample rate divider, gyroscope/accelerometer full-scale range
configuration, and power management.
- `drivers/sensors/Kconfig` & `Make.defs`: Build system integration under
`CONFIG_SENSORS_MPU6050`.
- `boards/xtensa/esp32/common`: MPU6050 common board initialization helper
(`esp32_mpu6050.c`).
- `boards/xtensa/esp32/heltec_wifi_lora32`: Bringup integration initializing
I2C bus 0 and registering `/dev/imu0` during boot when `CONFIG_SENSORS_MPU6050`
is enabled.
## Impact
- **New feature**: Adds native support for MPU6050 IMU sensors across NuttX.
- **Hardware**: Tested and verified on ESP32 (`heltec_wifi_lora32`).
- **Build / Compatibility**: No impact on existing drivers or boards;
enabled optionally via `CONFIG_SENSORS_MPU6050`.
## Testing
Tested on **Heltec WiFi LoRa32 (ESP32)** host board connected to an MPU6050
sensor module via I2C0.
- **Verification steps**:
1. Built NuttX with `CONFIG_SENSORS=y`, `CONFIG_I2C=y`,
`CONFIG_SENSORS_MPU6050=y`, and ESP32 I2C0 enabled.
2. Flashed firmware to Heltec WiFi LoRa32 board and booted.
3. Verified `/dev/imu0` device node creation during board bringup.
4. Performed sensor reads from `/dev/imu0` and verified valid
accelerometer, gyroscope, and temperature readings.
5. Ran `./tools/checkpatch.sh -c -u -m -g upstream/master..HEAD` to verify
style (`nxstyle`), commit messages, and spelling compliance.
--
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]