summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGergely Nagy <algernon@keyboard.io>2018-10-09 00:57:05 +0200
committerGergely Nagy <algernon@keyboard.io>2018-10-09 00:57:05 +0200
commit718aba9a43351e8bc327a71ce13167815809c622 (patch)
tree8495204b682e6bd52cbd73399a182f558fb56422
parentc24497f0e6b3fb7254c80da3bfcde68464aa9e2d (diff)
downloadmodel01-firmware-718aba9a43351e8bc327a71ce13167815809c622.tar.gz
model01-firmware-718aba9a43351e8bc327a71ce13167815809c622.tar.bz2
model01-firmware-718aba9a43351e8bc327a71ce13167815809c622.zip
Support an EEPROM-based keymap overlay & Focus
This adds the necessary code to support having five additional layers in EEPROM. Also adds support for Focus, so these layers can be changed, and the default layer set, too. We also enable the EEPROM commands, which can be helpful in debugging and backing up one's EEPROM contents. Signed-off-by: Gergely Nagy <algernon@keyboard.io>
-rw-r--r--Model01-Firmware.ino29
1 files changed, 29 insertions, 0 deletions
diff --git a/Model01-Firmware.ino b/Model01-Firmware.ino
index 2789078..371effb 100644
--- a/Model01-Firmware.ino
+++ b/Model01-Firmware.ino
@@ -16,6 +16,13 @@
// The Kaleidoscope core
#include "Kaleidoscope.h"
+// Support for storing the keymap in EEPROM
+#include "Kaleidoscope-EEPROM-Settings.h"
+#include "Kaleidoscope-EEPROM-Keymap.h"
+
+// Support for communicating with the host via a simple Serial protocol
+#include "Kaleidoscope-FocusSerial.h"
+
// Support for keys that move the mouse
#include "Kaleidoscope-MouseKeys.h"
@@ -396,6 +403,22 @@ USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol,
// The order can be important. For example, LED effects are
// added in the order they're listed here.
KALEIDOSCOPE_INIT_PLUGINS(
+ // The EEPROMSettings & EEPROMKeymap plugins make it possible to have an
+ // editable keymap in EEPROM.
+ EEPROMSettings,
+ EEPROMKeymap,
+
+ // Focus allows bi-directional communication with the host, and is the
+ // interface through which the keymap in EEPROM can be edited.
+ Focus,
+
+ // FocusSettingsCommand adds a few Focus commands, intended to aid in changing some settings of the keyboard, such as the default layer (via the `settings.defaultLayer` command)
+ FocusSettingsCommand,
+
+ // FocusEEPROMCommand adds a set of Focus commands, which are very helpful in
+ // both debugging, and in backing up one's EEPROM contents.
+ FocusEEPROMCommand,
+
// The boot greeting effect pulses the LED button for 10 seconds after the keyboard is first connected
BootGreetingEffect,
@@ -488,6 +511,12 @@ void setup() {
// This avoids over-taxing devices that don't have a lot of power to share
// with USB devices
LEDOff.activate();
+
+ // To make the keymap editable without flashing new firmware, we store
+ // additional layers in EEPROM. For now, we reserve space for five layers. If
+ // one wants to use these layers, just set the default layer to one in EEPROM,
+ // by using the `settings.defaultLayer` Focus command.
+ EEPROMKeymap.setup(5, EEPROMKeymap.Mode::EXTEND);
}
/** loop is the second of the standard Arduino sketch functions.