chmod222 / libcmmk

An unofficial LED control API for Coolermaster Masterkey keyboards
GNU Lesser General Public License v3.0
100 stars 24 forks source link

Add US keymap and support for Pro S #7

Closed pokonski closed 5 years ago

pokonski commented 5 years ago

I own a Masterkeys Pro S keyboard (tenkeyless) and I mapped the US version codes for every key I have on my keyboard, but of course it is missing numpad.

Additionally I added a full layout and ability to switch products via constructor

chmod222 commented 5 years ago

Hey, sorry for the long wait.

I wanted to merge the changes as-is but it struck me how my way of representing the layouts was less than optimal, so I rewrote the thing, so the layout is now passed as a third parameter to attach().

I ditched the old way of representing keys using K_Keyname because this will all break down once multiple layouts are in play and would force the library to be compiled separately for every layout. The library now uses the same schema as the official SDK, using the 6x22 matrix only, so keys no longer define the position in the matrix, the matrix defines the position of the keys.

I hope your mapping survived my refactoring. The new cmmk-test binary should light up all your keys from top left to bottom right in succession. Just make sure you change the parameter in test.c:29 to CMMK_LAYOUT_US_S, as I shamelessly overrode it with my testing version.

pokonski commented 5 years ago

Hey! No worries about the refactoring, will have a look and confirm it works today :)

pokonski commented 5 years ago

Just tried and all works well!