mikewuu / KinesisBLE

Custom Kinesis Controller with Wireless BLE
54 stars 17 forks source link

Guide for key mapping? #5

Closed mseflek closed 4 years ago

mseflek commented 4 years ago

Hi Mike,

Just finished building it. Everything works flawlessly (after swapping out the I/O expander for the correct one). I'm super excited about this. I'll be writing my build thoughts on /r/ergomechkeyboards soon.

Are you planning on writing something up about how to change keymaps around? I tried looking through some of your old commits, and looked through the firmware code but couldn't quite wrap my head around it. I was also curious about how you set up shortcuts like the reset bluetooth combo -- are those easy to add?

Thanks!

mikewuu commented 4 years ago

Cool, glad you got it working!

I'm not sure when I'll be able to get around to a proper write up. In the mean time take a look at HID.cpp to change basic keymaps:

This maps the left thumb key 1 to the equals key.

[(int)Keymap::Key::SL1] = { .scancode = Scancode::Equal, .shift = false },

And this would map it to Key A

[(int)Keymap::Key::SL1] = { .scancode = Scancode::A, .shift = false },

If you look above, the HID codes are defined.

To change actual key positions, check out [(int)Layer::Base] in KeyMap.cpp

As for key combos, I've only implemented them in the previous firmware. In the current firmware I handle combos, hyper key etc. via software, specifically Hammerspoon. This ensures the keyboard latency stays as low as possible.

mseflek commented 4 years ago

Great! This is super helpful. Thanks. So does that mean that your layer switching also happens in the software, and not via a key defined in the firmware? When you say latency, is it the case that the more complex the firmware (ie. including combos, layers, etc.) the slower the keyboard responsiveness?

BTW: I know that you mentioned that the NRF52840 draws more power than the 832 that's currently used, but if you ever figure out how to lower the power draw, I'd be excited to try it out. Being able to switch between bluetooth and USB connections would be awesome, which I believe is possible on the 840 but not on the 832.

mikewuu commented 4 years ago

Layers are actually already implemented. I haven't tested it as I don't use layers but I believe it's mapped to the Sym key. You might need to add the Sym key back in the matrix.

Yep keyboard responsiveness. You can check it at https://blog.seethis.link/scan-rate-estimator/

As for the 840, it does consume more power but I think going from 4-5 months of battery to 2-3 isn't really an issue where usability is concerned.

I've got a test firmware working with the usb switching. Unfortunately it needs a new PCB and I'm not sure when I'll have the time to do it.

mseflek commented 4 years ago

Awesome. Looking forward to trying out the new firmware and PCB. Agreed on the battery life.

Last two question re: remapping:

Thanks again for the help!

mikewuu commented 4 years ago

I believe light / heavy applies to layers. Light = only for 1 press, and heavy = always on.

Currently there isn't any on-the-fly remapping available unfortunately.

mseflek commented 4 years ago

Closing this, as your explanation and looking through the code was sufficient to figure out key mappings.