-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement QMI8658 gyro/accelerometer support #1161
base: main
Are you sure you want to change the base?
Conversation
Glad to see someone taking advantage of the new Aux structures. Given that we're in the middle of rolling a release, this will likely need to move off to the next version to give us time to get hardware to check it out.
|
Signed-off-by: Daniël van de Giessen <[email protected]>
Signed-off-by: Daniël van de Giessen <[email protected]>
Thanks for the feedback!
Fixed! I didn't notice my editor used
I copied the QMI8658 library directly from Waveshare, so I didn't look into cleaning these up yet. I've addressed these two points for now; there's more things in these files that could be cleaned up but at least for now it is somewhat functional. |
This is a cool add-on, @DvdGiessen what do you think it would take to get this one done? I like the functionality! |
I'd also be interested in using an accelerometer, the BMI160 to be specific. There are many types, but the BMI160 seems to be quite a popular one. Maybe I'll have a look into it if something like a generic accelerometer/gyro implementation isn't available for the next release. |
I haven't yet made time to continue work on this, but have not forgotten about it.
Aside from cleaning up the code to be easier to understand/maintain main thing would be adding a bunch of well thought out configurable options for calibration, smoothing, all kinds of things you'd want to build a good gyro control. I suspect we'll need this because there isn't a lot of options to tweak this in most software that supports gyro/accelerometers; for example I tried with the usually excellent Steam Input for remapping but support there wasn't as complete as I had hoped. I suspect that since we're emulating a PlayStation controller there aren't that many variants of that, most software assumes they already have a fairly consistent calibration, respond in a specific way, etc. The code in this PR gives output, but is not very easy to use because of lacking calibration. And important to keep in mind there would be bringing these improvements to a few other gyro chips as well. Aka not implement them in the QMI8658 addon but in a generic / reusable IMU addon; so we can more easily support multiple gyro's (such as the mentioned BMI160; I also got asked on Discord about the BNO086, LSM6DSO, and MPU6886). Once this is implemented it would be very helpful to document it well. Recommending a few pieces of software to use it with if you want for example mouse emulation, mapping it to other control schemes, guides on how to calibrate the sensors properly, etc. That would make the functionality easier to get started with, and I suspect would be very welcome to those interested in using this for accessibility purposes.
Feel free to ping me if you want to collaborate on it! No promises about me actually being available, but I told myself I should make some time for this. :) |
This implements basic support for the QMI8658 IMU, which is for example used on a number of off-the-shelf Waveshare RP2040 boards (I'm using this one, see my branch with the board config here).
This is a very basic implementation, making use of the MIT-licensed code from Waveshare to implement communications with the IMU. It uses the GP2040 I2C abstraction, and I've added a simple configuration for it that for now only allows enabling/disabling it.
Sharing it here as a draft PR; in case I don't find the time to finish polishing this up with extra settings, calibration, etc it might hopefully still be useful to others. :)