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.
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.
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>
Turn `event_handler_hook_use` and `loop_hook_use` into real functions, so that
we can apply a `deprecated` attribute, which in turn will emit a compile-time
warning when either of these functions are used.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
Neither of these are used in any plugin, within Arduino-Boards or outside of it.
We keep the `_hook_use` aliases, because there are a few users of it outside of
Arduino-Boards.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>