Arch puts the Arduino tools into /usr/bin, hardware bits under
/usr/share/arduino, and so on. To make ends meet, and support both the
traditional install, and Arch, introduce a bit of magic:
- If `ARDUINO_TOOLS_PATH` is empty, then we should not add the `-tools`
param that refers to it. On arch, this is not needed, and there is no
reasonable alternative, that would also make sense. So in this case,
it should not be added at all. Setting the variable to an empty string
accomplishes that goal nicely.
- If an `AVR_GCC_PREFIX` variable is set, use that as the value for
`runtime.tools.avr-gcc.path`, otherwise `arduino-builder` will try to
find the avr-* tools somewhere under the Arduino prefix, which on
Arch, is not the case.
With this change, along with keyboardio/KeyboardioHID#3, and adding an
`archlinux-arduino`=>`arduino` symlink somewhere, it becomes possible to
complie KeyboardioFirmware on Arch, using the packaged Arduino, with the
following commandline:
> make ARDUINO_BUILDER_PATH=/usr/bin/arduino-builder \
> ARDUINO_PATH=/usr/share/arduino \
> ARDUINO_LOCAL_LIB_PATH=../arduino-local \
> AVR_GCC_PREFIX=/usr \
> ARDUINO_TOOLS_PATH= \
> AVR_SIZE_PATH=avr-size
Not the nicest, by far, but possible.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Instead of syncing right after updating, sync at the end of the loop. This
allows hooks (both loop and event handler hooks) to override LED colors, without
cooperation from the active LED effect, and without flickering.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Because we have `raw`, `rawKey` was confusing. Rename it to `keyCode` instead,
which better conveys what the byte is for.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Makes some code not only easier to follow (by not having to use `.raw`
all the time), but for some odd reason, smaller too, in many cases.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
We want the `Keyboardio` object to be a singleton. If it is static, then
each library that gets compiled separately, and uses it in one way or
the other, will have a copy of it.
Making it extern, we'll only have one copy, as it should be.
I don't think there were any bugs caused by it being static, but it was
certainly a tiny bit of wasted code and memory.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
With the Layer code not using the hooks anymore, the Arduino builder will tell
the linker to remove any unreferenced code. As we are using dot_a_linkage, that
means that the hook functions will be removed due to being unreferenced before
plugins had a chance to reference them.
Add a dummy call in Keyboardio_::setup() to prevent this case.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>