Sounds pretty awesome. Any way you can decouple the key map from the key layout? If you use standard codes to represent the layout, you could make generic map files that hopefully wouldn't require a recompile & firmware upload.
Thanks. Yes, the key map is, in principal, decoupled from the layout. By layout you mean the arrangement of switches on the physical keyboard matrix, and by map you mean the assignment of keys to switches--is that correct? In these terms, I am using a US QWERTY map as a reference to define which key is on which row/column on the layout. The codes in my config files are the standard USB keycodes.
Then, there are various key map transformations. To obtain, for instance, a Dvorak map, I am applying a transformation that tells how to swap keys on a US map in order to get Dvorak. The transformation is independent of the layout and can be reused for other layouts.
In the current version there is only a single map, and changing the map implies flashing the firmware. I'd like to change this and allow users to upload their own maps to EEPROM using some tool.
How do you feel about listening for character sequences for switching to a certain map?
That's a very good idea. It would be a generalization of the Shift+ScrollLock combination that is used on the Space Saver for switching to numpad emulation. I should be well possible to implement this.
US: QWERTY, Dvorak, Colemak, Dvorak (left handed), Dvorak (right handed), Dvorak variants?
Germany: QWERTZ, International Dvorak, Colemak?
Not sure if languages can be supported that way. When pressing, e.g., Shift+2 on a US keyboard, then the outcome is "@"; on a German keyboard it's """. On the USB protocol level, however, the keyboard simply sends the keycode for "2" plus the information that a shift key was held down, and it doesn't know that Shift+2 might be "@". Thus, the mapping of keys and modifiers is handled by the operating system.
On the other hand, there are certain country-specific USB keycodes that you could use in your map definitions (for instance, the key with "<>|" written on it, left from the Y key on German keyboards has its own code).
I once had an old programmable keyboard where you could reassign buttons with a certain key sequence. Program + key + program + other key (or something like that) would flip them and permanently store the flip. (Too bad that keyboard was domes, and it used volatile storage that would perish with the battery.)
That would be harder. Not impossible, but probably not as easily implemented as simply exchanging whole keyboard layouts.
Anyway. Beyond certain sets of keymaps, you may be able to get clever with how you activate features. If SL+SL rotates the layout, maybe SL+SL+left Ctrl swaps control and caps lock. I'm just trying to think of doing this in ways that don't require firmware builds/flashes, although I guess dip switches would be fine.
OK, so you are imagining a set of commands that tell the keyboard what to do, a bit like command vs. edit mode in vim.
I really like the idea.
The firmware takes only 3 kB of ROM space at the moment, 3.1 kB for the M4-1; that leaves about 11 kB on the ATMEGA16 for improvements... (2 kB are occupied by the boot loader)
Ever use vi/vim?
Are there any other editors?
It would be awesome if I could easily program a "normal mode" for some of the development tools I have that would be portable between computers, because it's integrated into my keyboard! Emacs users might like a sticky control key feature.
Ah, that would be another vim-like mode. Or an extension of the key map management mode. I fear the AVR's EEPROM size will not be large enough for all this, though; there are only 512 bytes on the ATMEGA16, so the macros would be rather limited in their length. Some external non-volatile memory or a bigger AVR might come handy here.
And Emacs users might want to give vim a try.
*SCNR*
And, um, on the DL, MMO guys might like it if macro playback could have humanizing randomization added. As in, realistic and non-constant (but random) delays between keys in the macro sequence.
What would that be useful for? Turning the keyboard into a chat bot? Moving a game character around in an automated fashion, but pretending it is controlled by a human? (Hm, that *might* be useful! :eyebrows:)
Sorry, I haven't been into gaming for years, so maybe I don't quite get it.
The whole macro thing sounds interesting. Is there something I have missed during the last few years?