Instead of repeating the same cRGB reading code in three places, use the
recently introduced Focus.readColor() function. This both makes the code
cleaner, and more than 50 bytes smaller too.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Instead of using a lambda (which is not constexpr in C++11), use a temporary,
anonymous struct instance to wrap the `static_assert`, which is constexpr in
C++11.
Fixeskeyboardio/Model01-Firmware#53. Thanks to @noseglasses for finding the
cause, and explaining the fix!
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Many plugins use timers, and most of them will call `millis()`, which isn't
wrong, but isn't the most efficient either. While `millis()` isn't terribly
expensive, it's not cheap either. For most cases, we do not need an exact timer,
and one updated once per cycle is enough - which is what `.millisAtCycleStart()`
is. Having a timer that is consistent throughout the whole cycle may also be
beneficial.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Use ./_build/ for the build path by default, and do not delete it at the end of
compilation, only when doing a clean.
Fixes#315.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Instead of a twisted combination, use the palm keys - easy to press, and
otherwise unused in the example. Also, use `Macros.type` instead of
`Serial.println`, because the former is easier to play with as a user.
Fixes#5.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Instead of running `scanMatrix` whenever we get there, use Timer1 to set a
consistent period. This does not mean we'll run every time the timer is up, but
we will run at consistent intervals.
Fixes#6.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Instead of hardcoding the max program size, pick it out of boards.txt, like we
pick the device VID and PID.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
As this is a new port, there is little sense in supporting the legacy API.
Disable it for some nice space savings!
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
This adds a very simple debouncing algorithm for debouncing. It works by making
sure a key is not changing state more than a configurable amount of cycles.
Defaults to five cycles for now.
Fixes#1.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
The global `ErgoDox` symbol should be a shortcut, an alias, to KeyboardHardware.
When using ErgoDox-specific functionality, `ErgoDox.someMethod()` is much
clearer about that than `KeyboardHardware.someMethod()` would be.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
The member functions of the union now take all arguments const, meaning
that it is not possible to modify this value somehow. This reduces the
chance of subtle bugs and widens the contexts in which these member
functions can be used.
Furthermore, one signature took a `Key' by value while all functions
take `Key' by reference. For the sake of consistency, this was adapted
to.
Making the member functions of Key `const' explicitly flags that they
will not change the union. This will allow to use Key in const contexts.
Adding the `constexpr' specifier to the function makes it possible to
rely on the results at compile time. This puts some kind of restrictions
on the function, especially when using C++11 and not a newer standard,
but these restrictions were already fulfilled, so this seems to be safe.
Updates the formatting a bit, and adds a few entries too. Still much to be done,
but... small steps!
Signed-off-by: Gergely Nagy <algernon@keyboard.io>