Skip to content

Add rotation support to CO5300 display driver, and BMI270 IMU support for M5AtomS3R targets#1605

Open
kitazaki wants to merge 3 commits intoModdable-OpenSource:publicfrom
kitazaki:public
Open

Add rotation support to CO5300 display driver, and BMI270 IMU support for M5AtomS3R targets#1605
kitazaki wants to merge 3 commits intoModdable-OpenSource:publicfrom
kitazaki:public

Conversation

@kitazaki
Copy link
Copy Markdown
Contributor

@kitazaki kitazaki commented May 7, 2026

Summary

Add rotation support to the CO5300 display driver used by esp32/waveshare_amoled_206.

The driver now supports rotation values of 0, 90, 180, and 270, consistent with other Moddable display drivers.

Changes

  • Added a rotation getter/setter to modules/drivers/co5300/co5300.js.
  • Added native rotation state handling in modCo5300.c.
  • Updated width and height getters for 90/270 degree rotation.
  • Added validation for unsupported rotation values.
  • Added software pixel rearrangement for 90, 180, and 270 degree rotation.
  • Preserved the existing fast path for 0 degree rotation.

Notes

The CO5300 does not appear to provide a MADCTL-style row/column exchange mode suitable for 90/270 degree rotation. Non-zero rotations are therefore handled in software before pixel data is sent to the display.

Rotated modes may be slower than the default 0 degree mode, but existing behavior is unchanged when rotation is not set.

Testing

Tested on esp32/waveshare_amoled_206, which uses the CO5300 display driver.

Verified the following rotation values with examples/piu/cards:

  • 0
  • 90
  • 180
  • 270
1 2

kitazaki added 3 commits May 7, 2026 22:56
## Summary

Add rotation support to the CO5300 display driver used by `esp32/waveshare_amoled_206`.

The driver now supports `rotation` values of `0`, `90`, `180`, and `270`, consistent with other Moddable display drivers.

## Changes

- Added a `rotation` getter/setter to `modules/drivers/co5300/co5300.js`.
- Added native rotation state handling in `modCo5300.c`.
- Updated `width` and `height` getters for 90/270 degree rotation.
- Added validation for unsupported rotation values.
- Added software pixel rearrangement for 90, 180, and 270 degree rotation.
- Preserved the existing fast path for 0 degree rotation.

## Notes

The CO5300 does not appear to provide a MADCTL-style row/column exchange mode suitable for 90/270 degree rotation. Non-zero rotations are therefore handled in software before pixel data is sent to the display.

Rotated modes may be slower than the default 0 degree mode, but existing behavior is unchanged when `rotation` is not set.

## Testing

Tested on `esp32/waveshare_amoled_206`, which uses the CO5300 display driver.

Verified the following rotation values with `examples/piu/clock`:

- `0`
- `90`
- `180`
- `270`
## Summary

This PR adds BMI270 IMU support to the M5AtomS3R target family.

Moddable SDK 8.1.0 added support for the BMI270 sensor device.
Since the M5AtomS3R family uses the same BMI270 IMU, this PR updates the corresponding target definitions.

Updated targets:

- `esp32/m5atom_s3r`
- `esp32/m5atom_s3r_cam`
- `esp32/m5atom_s3r_m12`

## Changes

- Added the BMI270 sensor driver manifest to the M5AtomS3R target manifests.
- Added `device.sensor.IMU` definitions for M5AtomS3R targets.
- Added axis correction for `m5atom_s3r` so the IMU orientation matches `m5atom_s3`.
- Scaled BMI270 accelerometer values from `m/s^2` to `g` for compatibility with existing AtomS3 IMU(MPU6886) examples.
- Updated `examples/drivers/atoms3-imu` to handle samples that may not include accelerometer or gyroscope data immediately.
- Added `examples/drivers/atoms3r-imu-console` for console-based IMU verification on displayless M5AtomS3R variants.

## Verification

- `examples/drivers/atoms3-imu` with `esp32/m5atom_s3r`
- `examples/drivers/atoms3r-imu-console` with `esp32/m5atom_s3r`
- `examples/drivers/atoms3r-imu-console` with `esp32/m5atom_s3r_cam`
- `examples/drivers/atoms3r-imu-console` with `esp32/m5atom_s3r_m12`

## Note

M5Stack Core2 v1.3 also uses the BMI270 IMU. However, the Core2 hardware configuration changed between v1.1 and v1.3:
the IMU changed from MPU6886 to BMI270, and the PMU changed from AXP2101 to AXP192.

I plan to submit a separate PR for Core2 v1.3 after verifying the detection logic for these hardware differences.
@kitazaki kitazaki changed the title Add rotation support to CO5300 display driver Add rotation support to CO5300 display driver, and BMI270 IMU support for M5AtomS3R targets May 8, 2026
@kitazaki
Copy link
Copy Markdown
Contributor Author

kitazaki commented May 8, 2026

Summary

This PR adds BMI270 IMU support to the M5AtomS3R target family.

Moddable SDK 8.1.0 added support for the BMI270 sensor device.
Since the M5AtomS3R family uses the same BMI270 IMU, this PR updates the corresponding target definitions.

Updated targets:

  • esp32/m5atom_s3r
  • esp32/m5atom_s3r_cam
  • esp32/m5atom_s3r_m12

Changes

  • Added the BMI270 sensor driver manifest to the M5AtomS3R target manifests.
  • Added device.sensor.IMU definitions for M5AtomS3R targets.
  • Added axis correction for m5atom_s3r so the IMU orientation matches m5atom_s3.
  • Scaled BMI270 accelerometer values from m/s^2 to g for compatibility with existing AtomS3 IMU(MPU6886) examples.
  • Updated examples/drivers/atoms3-imu to handle samples that may not include accelerometer or gyroscope data immediately.
  • Added examples/drivers/atoms3r-imu-console for console-based IMU verification on displayless M5AtomS3R variants.

Testing

  • examples/drivers/atoms3-imu with esp32/m5atom_s3r
  • examples/drivers/atoms3r-imu-console with esp32/m5atom_s3r
  • examples/drivers/atoms3r-imu-console with esp32/m5atom_s3r_cam
  • examples/drivers/atoms3r-imu-console with esp32/m5atom_s3r_m12
1

Notes

M5Stack Core2 v1.3 also uses the BMI270 IMU. However, the Core2 hardware configuration changed between v1.1 and v1.3: the IMU changed from MPU6886 to BMI270
a separate PR for Core2 v1.3 after verifying the detection logic for these hardware differences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant