hid-io / hid-io-core

HID-IO Library and Daemon
GNU General Public License v3.0
71 stars 10 forks source link

Example Rust firmware implementation? #17

Open riskable opened 3 years ago

riskable commented 3 years ago

I would love to add support for HID-IO in my hall effect keyboard firmware but I can't find any Rust examples. Does anything exist that I can reference?

haata commented 3 years ago

Do you have any details on your keyboard?

riskable commented 3 years ago

I already made a hall effect numpad but I just designed and ordered a 65% PCB. So far I've been working with stm32f401 but it's written using platform-agnostic code/crates (embedded-hal) so it should be trivial to make it run on anything that Rust supports. I've presently got it based on Keyberon (https://github.com/TeXitoi/keyberon/) and I've been working with the author to add Sequence/Macro support (https://github.com/TeXitoi/keyberon/pull/30).

My keyboard uses analog multiplexers + 49E linear hall effect sensors (because they're cheap but work fine =). It presently uses 1000Hz polling rate and supports 6key+modifiers rollover (and reports all 6 keys in that first 1ms report--unlike QMK haha). Here's some pics and details on the numpad I made as the proof-of-concept:

https://imgur.com/a/IFsvBGh

I'm using a 3D printable magnetic separation switch design: https://gfycat.com/sorrowfulequaliraniangroundjay

The switch design is entirely parametric (.scad file) so you can control the travel, tolerances, force curve, and whatnot to a very fine degree.

The keyboard case (for the 65%) I'm working on right now will be very similar to my numpad's case in that you can pop the whole top off and take it over to the sink to give it a good scrub hehe: https://gfycat.com/welcomeindolentcanary

Hopefully that explains what you need to know :smile:

riskable commented 3 years ago

Oh, here's a force curve I measured for one of my switches: https://imgur.com/FNoTSpL

I believe that one was a 3.5mm-of-travel switch using N35 + N35 magnets with something like a 0.3mm MAGNET_GAP (a parameter in my .scad). The magnet gap controls the resting distance between the magnet in the stem and the magnet in the body which is a surprisingly accurate way to control the initial force of the switch. Since it's magnetic separation the point of tactility is basically at 0.0mm and it feels fantastic =)

haata commented 3 years ago

This sounds very interesting, we should have a chat. Are you on discord?

haata commented 3 years ago

Basically, I'm starting to port some pieces of the firmware to rust (specifically the hid-io protocol piece) instead of writing it in C. So it could be very useful for your project.

riskable commented 3 years ago

Yes I'm on Discord: riskable#4986

Also on Matrix: @riskable:matrix.org