It only causes trouble when trying to use the library from another one,
and for the KeyboardioFirmware, serves no useful purpose.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Do not hardcode the name of the tool that computes md5 sums, but make it
platform-dependent: on at least Debian, the tool is called md5sum.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Moved the library sources into src/, and the sketch into examples/. This
makes it easier to use the project as a library, and the default
firmware sketch shows up in Arduino IDE's Files/Examples menu. This in
turn, has a very neat side effect: an end user can start from this
example, and when they save it, it will be saved to their Sketchbook,
and the library can be updated independently, without having to worry
about conflicts.
Having the Sketch separate from the sources also paves the way for
moving the keymap there.
As far as Arduino IDE dependencies go: this requires Arduino IDE 1.6.7+,
the same minimum version required previously.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Two things are done here: loop() hooks are introduced, and both loop and
event handler hooks are pre-allocated for HOOK_MAX (64 by default)
elements.
Two helpers are introduced too, that make it easier to append a new hook
to the end of these arrays.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
The function is not used anymore, there's a different, better way to
hook into the event handler now.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Instead of a single custom function, have an array of functions that get
called in order, until one of them returns true. Defaults to the normal
event handler.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Instead of always calling handle_user_key_event(), call a function
pointed to by the customHandler variable. This makes it possible to
override what function gets called, at run time, at very little cost.
The reason for this change is to be able to change the user function
into a testing one, if a magic combo is pressed, while still allowing
the end-user to fully customize handle_user_key_event, and allow them to
have access to the testing one too, without them doing anything special.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This allows external libraries to look up the keycode for a given
position, without having to reimplement the keymap themselves. This
becomes important when you hook into the event processing.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This adds a new `handle_user_key_event` function, that will get called
before anything else, and can override what happens. If it returns true,
the event will not be processed further by the firmware. By default,
this function returns false, and is a no-op.
It is defined with a `weak` attribute, to let the linker know that any
other function with the same name should override his one. This makes it
possible to have another version of this function in a firmware Sketch,
and override the behaviour, to extend the event handling.
This is the foundation that allows it to use external libraries, and tap
into the firmware's event handler, to add new stuff. (We can already
hook into the main loop by changing the top `loop` function in the
Sketch)
This addresses #21 for the most part.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>