qmk_firmware icon indicating copy to clipboard operation
qmk_firmware copied to clipboard

Add new mouse "Ploopy Knob"

Open ploopyco opened this issue 6 months ago • 4 comments

Added a new definition for a Ploopy input device, the "Knob". It's a dial with a magnetic rotary encoder, the AS5600 chip. The AS5600 isn't currently in use in QMK anywhere, so this PR also includes code to use it.

Description

The Knob is a dial with a single rotary encoder. It's currently configured to operate as a vertical scrolling device; this code lives in ploopyco.c.

The AS5600 is an I2C magnetic field sensor device. Although the PR includes a full register map for it, the only register that is regularly read is the "rawangle" register, which provides the raw, 12-bit angle of the magnetic field sensed by the sensor.

Types of Changes

  • [ ] Core
  • [ ] Bugfix
  • [ ] New feature
  • [ ] Enhancement/optimization
  • [x] Keyboard (addition or update)
  • [x] Keymap/layout (addition or update)
  • [ ] Documentation

Issues Fixed or Closed by This PR

Checklist

  • [x] My code follows the code style of this project: C, Python
  • [x] I have read the PR Checklist document and have made the appropriate changes.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.
  • [x] I have tested the changes and verified that they work and don't break anything (as well as I can manage).

ploopyco avatar Jun 18 '25 15:06 ploopyco

@drashna Any chance to review this?

ploopyco avatar Jul 23 '25 14:07 ploopyco

This has some merge conflicts now

drashna avatar Sep 07 '25 17:09 drashna

Thank you for your contribution! This pull request has been automatically marked as stale because it has not had activity in the last 45 days. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, or re-open when it's ready. For maintainers: Please label with bug, awaiting review, breaking_change, in progress, or on hold to prevent the issue from being re-flagged.

github-actions[bot] avatar Oct 23 '25 02:10 github-actions[bot]

@drashna and anyone else interested, I've marked this as an open PR, but I think it needs some additional review, perhaps some refactoring.

I have the as5600.c in the Ploopy "common" directory, but I think it could be argued that it belongs in the /drivers/sensors directory. I'm using it as a pointing device, and it may benefit the broader QMK community to have more logical access to it. Could use an opinion on this point.

Speaking of that, yes, the AS5600 is being used as a pointing device even though it behaves like an encoder. This is because it doesn't behave like an EC11 encoder, which is what QMK's encoders all do. Furthermore, it takes advantage of the high-resolution scrolling feature, which is currently labeled as a pointing device feature (which makes sense historically, as this was used primarily for drag scrolling).

Lastly, I put the code dictating the behaviour of the AS5600 into keymap.c instead of the ploopy.c file, which is starting to become monolithic. This makes for better logical encapsulation of the code, but it could result in repeated code if other Ploopy devices also use the features of the AS5600. An opinion on whether the code should be refactored into ploopy.c is welcome.

ploopyco avatar Nov 04 '25 21:11 ploopyco