If it's an old sketch, LayerCount will default to 0, so in order for
Layer.on() to function, don't bother checking for out-of-bounds if
LayerCount == 0.
Declaring LayerCount as a weak symbol in layers.cpp lets us override
it if the CREATE_KEYMAP macro is used to define the keymap in the
sketch file, but still allows old sketch files to compile without
errors.
Still some changes necessary to allow old sketches to work
properly (Layer.on() will abort before doing anything).
This macro allows the definition of the LayerCount variable and the
keymaps[] array together. It shouldn't break old sketches, but this is
probably not all that's necessary; LayerCount still doesn't get
initialized outside the macro.
Update key_events.cpp (IS_INTERNAL Handling)
I'm merging this for now, even though I know it's not the 'right' solution. But I'd like Mute to work correctly for MP2 keyboards and we're on deadline
This file is meant to be included in sketch files in order to make
data available to Kaleidoscope functions. In particular, the size of
the keymaps[] array (i.e. the number of defined layers), which is
needed in order to prevent reading uninitialized memory past the end
of that array due to Key_KeymapNext_Momentary.
This took some trial and error to figure out, but once I determined
that the example sketches were being built, I made this change to keep
the build working. Hopefully this will satisfy Travis-CI.
By moving the IS_CONSUMER flag to B00001000 instead of
B00000010 (swap with IS_INTERNAL) we can detect the if the key is a
consumer key and strip out the flags and use the full 10bit to send to
the hid report. This enable us to use all the Consumer_* keys
Reordered if chain in handleSyntheticKeyswitchEvent to fix a bug preventing some Consumer and System Control HID functions from being sent due to bit overload/collision with the IS_INTERNAL flag.
I install GNU coreutils on my Macs, to get GNU `ls`. It also installs
a GNU-flavored `stty`, which wants `-F` instead of `-f`. Giving the
full path to the OS `stty` avoids issues in this case, and should be
consequence-free for folks that _don't_ have GNU coreutils installed.
Make Kaleidoscope_ a friend class, so that it can access .begin. The
reason behind this is that .begin is an interface towards
Kaleidoscope.use(), and that function should be the only user. To
discourage its use, make it protected.
This does not break any existing - and valid - code, but allows us to
slowly migrate the plugins to a protected begin() method.
Fixes#177.
I don't have write access, but through conversation with @Jennigma in the forum I've made a few changes above.
- I gave a first pass up to the Editing Keymaps part, then skimmed after there.
- I rearranged some sentences to try to fit more with the "voice" of the Keyboardio brand from its website, to the emails and tweets. It's a soft, friendly and inviting voice. Specifically I used a lot more "We", and tried to gracefully include lines like "uncompromising typists" and "heirloom-grade" (these distinctions left a powerful first impression on me). To be honest, I could spend A LOT more time doing that brand writing, it's so much fun. If there are parts that could be more "branded" let me know.
- I changed a few instances of "Keyboardio" to "Model 01", but perhaps not consistently, when I saw that "keyboardio" is lowercase in the Arduino board manager I wondered if I have over capitalized. If I thought a part of the software could apply to future Keyboardio-brand products I left it as "Keyboardio", and if it seemed very specific to this product I used "Model 01".
- I softened some parts, like removed the IDE part in the first paragraph, moving that to the Arduino introduction below.
- The only completely-removed line was about requiring cleverness and following instructions. I feel like those aren't required. The offers for support I've seen online suggest the non-clever would also get the help they need! Besides, the non-clever just use whatever flavour of rubber domes Dell is shipping this month amiright?! haha.
As discussed in #196, if we are making `KaleidoscopePlugin.begin` protected, we
might as well give it a better name. That name is `initialSetup`, and this
change is the first step towards the migration. It introduces `initialSetup`
which will call `begin` for now, and deprecate `begin`, which is no longer an
abstract function.
Once everyone migrated to the new name, we can remove `.begin`, and turn
`.initialSetup` into an abstract function.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
* Added Arduino IDE install instructions
Completed a first draft of the IDE install instructions through flashing the board with the unedited sketch.
Also made a couple edits as suggested by @algernon, and a few other refinements I noticed.
* typo
Wanted to post this in the partial state so folks can start reviewing what I've done and making suggestions. This is a first draft of the intro section, and the outline for the rest of the document.
Make `Kaleidoscope_` a friend class, so that it can access `.begin`. The reason
behind this is that `.begin` is an interface towards `Kaleidoscope.use()`, and
that function should be the only user. To discourage its use, make it protected.
This does not break any existing - and valid - code, but allows us to slowly
migrate the plugins to a protected `begin()` method.
Fixes#177.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
`Kaleidoscope.use` is a much better interface, therefore deprecate USE_PLUGINS.
We do this by creating a wrapper function, `__USE_PLUGINS` that will call
`Kaleidoscope.use` under the hood, but has a deprecated attribute attached. We
then make the `USE_PLUGINS` macro call this function.
We do this because we want to make sure that the list is NULL-terminated, and
for that, we need the macro.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
This was only ever used for `Kaleidoscope.setup()`, and while the variant that
takes an argument is deprecated, and emits a warning already, we can do the same
for `KEYMAP_SIZE` too.
This does set the const to 0, so if used anywhere else than
`Kaleidoscope.setup()`, it will have undesired side-effects. But as far as I
saw, it was never used elsewhere, thus, this change should be safe.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
We do not use `keymap_count` anymore, so deprecate this variant of the setup
function, with a message that also tells the user that `KEYMAP_SIZE` is
deprecated too.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>