Keymaps_linear and friends

Reading over UPGRADING.md, I saw this:

The keymaps array has been replaced with a keymaps_linear array. This new array treats each layer as a simple one dimensional array of keys, rather than a two dimensional array of arrays of rows. At the same time, the KEYMAPS and KEYMAPS_STACKED macros that were previously defined in each hardware implmentation class have been replaced with PER_KEY_DATA and PER_KEY_DATA_STACKED macros in each hardware class. This change should be invisible to users, but will require changes by any plugin that accessed the ‘keymaps’ variable directly.

The example sketches, however, still seem to be using KEYMAP_STACKED, and building my own sketch with the new firmware code doesn’t produce any errors or warnings. Is this a change we can safely ignore in our sketches, or will it necessitate a change somewhere down the line? Is it as simple as a basic rename?

As the author of some of these changes I can confirm that the KEYMAP_STACKED and KEYMAP macros are still the default way of defining keymaps.

The word replaced may be a bit misleading here. The KEYMAP... macros became wrappers to the new PER_KEY_DATA... macros. So the former can be seen as a specialization of the latter.

…invisible to users… means that users don’t need to bother (unless they read the docs :smirk:).

1 Like