aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2019-02-10 17:38:03 +0000
committerdakkar <dakkar@thenautilus.net>2019-02-10 17:38:03 +0000
commitf6b33af7a015cbab8629ac9cbb0059b2fd2d0e16 (patch)
tree850eaf76e20445d3681af43f3bf5c488d108b2ac
parentsome color definitions (diff)
downloadkeyboardio-model01-f6b33af7a015cbab8629ac9cbb0059b2fd2d0e16.tar.gz
keyboardio-model01-f6b33af7a015cbab8629ac9cbb0059b2fd2d0e16.tar.bz2
keyboardio-model01-f6b33af7a015cbab8629ac9cbb0059b2fd2d0e16.zip
remove unused bits
and move some definitions
-rw-r--r--DakkarColor.h2
-rw-r--r--Model01-Firmware.ino218
-rw-r--r--keymap-wrapper.h5
3 files changed, 7 insertions, 218 deletions
diff --git a/DakkarColor.h b/DakkarColor.h
index 17a93cb..f7c3293 100644
--- a/DakkarColor.h
+++ b/DakkarColor.h
@@ -1,5 +1,7 @@
#pragma once
+#include "Kaleidoscope-LEDControl.h"
+
class DakkarColor: public kaleidoscope::plugin::LEDMode {
public:
typedef const cRGB (*color_function)();
diff --git a/Model01-Firmware.ino b/Model01-Firmware.ino
index e91c1cc..fdb512f 100644
--- a/Model01-Firmware.ino
+++ b/Model01-Firmware.ino
@@ -1,139 +1,25 @@
// -*- mode: c++ -*-
-// Copyright 2016 Keyboardio, inc. <jesse@keyboard.io>
-// See "LICENSE" for license details
#ifndef BUILD_INFORMATION
#define BUILD_INFORMATION "locally built"
#endif
-
-/**
- * These #include directives pull in the Kaleidoscope firmware core,
- * as well as the Kaleidoscope plugins we use in the Model 01's firmware
- */
-
-
-// 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"
-
-// Support for macros
#include "Kaleidoscope-Macros.h"
-
-// Support for controlling the keyboard's LEDs
#include "Kaleidoscope-LEDControl.h"
-
-// Support for the "Boot greeting" effect, which pulses the 'LED' button for 10s
-// when the keyboard is connected to a computer (or that computer is powered on)
#include "Kaleidoscope-LEDEffect-BootGreeting.h"
-
-// Support for Keyboardio's internal keyboard testing mode
#include "Kaleidoscope-Model01-TestMode.h"
-
-// Support for host power management (suspend & wakeup)
#include "Kaleidoscope-HostPowerManagement.h"
-
-// Support for magic combos (key chords that trigger an action)
#include "Kaleidoscope-MagicCombo.h"
-
-// Support for USB quirks, like changing the key state report protocol
#include "Kaleidoscope-USB-Quirks.h"
-/** This 'enum' is a list of all the macros used by the Model 01's firmware
- * The names aren't particularly important. What is important is that each
- * is unique.
- *
- * These are the names of your macros. They'll be used in two places.
- * The first is in your keymap definitions. There, you'll use the syntax
- * `M(MACRO_NAME)` to mark a specific keymap position as triggering `MACRO_NAME`
- *
- * The second usage is in the 'switch' statement in the `macroAction` function.
- * That switch statement actually runs the code associated with a macro when
- * a macro key is pressed.
- */
-
enum { MACRO_VERSION_INFO,
MACRO_ANY
};
-
-
-/** The Model 01's key layouts are defined as 'keymaps'. By default, there are three
- * keymaps: The standard QWERTY keymap, the "Function layer" keymap and the "Numpad"
- * keymap.
- *
- * Each keymap is defined as a list using the 'KEYMAP_STACKED' macro, built
- * of first the left hand's layout, followed by the right hand's layout.
- *
- * Keymaps typically consist mostly of `Key_` definitions. There are many, many keys
- * defined as part of the USB HID Keyboard specification. You can find the names
- * (if not yet the explanations) for all the standard `Key_` defintions offered by
- * Kaleidoscope in these files:
- * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs_keyboard.h
- * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs_consumerctl.h
- * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs_sysctl.h
- * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs_keymaps.h
- *
- * Additional things that should be documented here include
- * using ___ to let keypresses fall through to the previously active layer
- * using XXX to mark a keyswitch as 'blocked' on this layer
- * using ShiftToLayer() and LockLayer() keys to change the active keymap.
- * keeping NUM and FN consistent and accessible on all layers
- *
- * The PROG key is special, since it is how you indicate to the board that you
- * want to flash the firmware. However, it can be remapped to a regular key.
- * When the keyboard boots, it first looks to see whether the PROG key is held
- * down; if it is, it simply awaits further flashing instructions. If it is
- * not, it continues loading the rest of the firmware and the keyboard
- * functions normally, with whatever binding you have set to PROG. More detail
- * here: https://community.keyboard.io/t/how-the-prog-key-gets-you-into-the-bootloader/506/8
- *
- * The "keymaps" data structure is a list of the keymaps compiled into the firmware.
- * The order of keymaps in the list is important, as the ShiftToLayer(#) and LockLayer(#)
- * macros switch to key layers based on this list.
- *
- *
-
- * A key defined as 'ShiftToLayer(FUNCTION)' will switch to FUNCTION while held.
- * Similarly, a key defined as 'LockLayer(NUMPAD)' will switch to NUMPAD when tapped.
- */
-
-/**
- * Layers are "0-indexed" -- That is the first one is layer 0. The second one is layer 1.
- * The third one is layer 2.
- * This 'enum' lets us use names like QWERTY, FUNCTION, and NUMPAD in place of
- * the numbers 0, 1 and 2.
- *
- */
-
-enum { PRIMARY, NUMPAD, FUNCTION, FVWM }; // layers
-
-
-/**
- * To change your keyboard's layout from QWERTY to DVORAK or COLEMAK, comment out the line
- *
- * #define PRIMARY_KEYMAP_QWERTY
- *
- * by changing it to
- *
- * // #define PRIMARY_KEYMAP_QWERTY
- *
- * Then uncomment the line corresponding to the layout you want to use.
- *
- */
-
-#define PRIMARY_KEYMAP_QWERTY
-// #define PRIMARY_KEYMAP_DVORAK
-
#include "keymap-wrapper.h"
#include "color-themes.h"
@@ -141,11 +27,6 @@ enum { PRIMARY, NUMPAD, FUNCTION, FVWM }; // layers
static DakkarColor DakkarColorDark(color_keymaps,dark_colors);
static DakkarColor DakkarColorBright(color_keymaps,bright_colors);
-/** versionInfoMacro handles the 'firmware version info' macro
- * When a key bound to the macro is pressed, this macro
- * prints out the firmware build information as virtual keystrokes
- */
-
static void versionInfoMacro(uint8_t keyState) {
if (keyToggledOn(keyState)) {
Macros.type(PSTR("Keyboardio Model 01 - Kaleidoscope "));
@@ -153,14 +34,6 @@ static void versionInfoMacro(uint8_t keyState) {
}
}
-/** anyKeyMacro is used to provide the functionality of the 'Any' key.
- *
- * When the 'any key' macro is toggled on, a random alphanumeric key is
- * selected. While the key is held, the function generates a synthetic
- * keypress event repeating that randomly selected key.
- *
- */
-
static void anyKeyMacro(uint8_t keyState) {
static Key lastKey;
bool toggledOn = false;
@@ -173,19 +46,6 @@ static void anyKeyMacro(uint8_t keyState) {
kaleidoscope::hid::pressKey(lastKey, toggledOn);
}
-
-/** macroAction dispatches keymap events that are tied to a macro
- to that macro. It takes two uint8_t parameters.
-
- The first is the macro being called (the entry in the 'enum' earlier in this file).
- The second is the state of the keyswitch. You can use the keyswitch state to figure out
- if the key has just been toggled on, is currently pressed or if it's just been released.
-
- The 'switch' statement should have a 'case' for each entry of the macro enum.
- Each 'case' statement should call out to a function to handle the macro in question.
-
- */
-
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
switch (macroIndex) {
@@ -201,10 +61,6 @@ const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
}
-
-/** toggleLedsOnSuspendResume toggles the LEDs off when the host goes to sleep,
- * and turns them back on when it wakes up.
- */
void toggleLedsOnSuspendResume(kaleidoscope::plugin::HostPowerManagement::Event event) {
switch (event) {
case kaleidoscope::plugin::HostPowerManagement::Suspend:
@@ -221,125 +77,51 @@ void toggleLedsOnSuspendResume(kaleidoscope::plugin::HostPowerManagement::Event
}
}
-/** hostPowerManagementEventHandler dispatches power management events (suspend,
- * resume, and sleep) to other functions that perform action based on these
- * events.
- */
void hostPowerManagementEventHandler(kaleidoscope::plugin::HostPowerManagement::Event event) {
toggleLedsOnSuspendResume(event);
}
-/** This 'enum' is a list of all the magic combos used by the Model 01's
- * firmware The names aren't particularly important. What is important is that
- * each is unique.
- *
- * These are the names of your magic combos. They will be used by the
- * `USE_MAGIC_COMBOS` call below.
- */
enum {
// Toggle between Boot (6-key rollover; for BIOSes and early boot) and NKRO
// mode.
COMBO_TOGGLE_NKRO_MODE
};
-/** A tiny wrapper, to be used by MagicCombo.
- * This simply toggles the keyboard protocol via USBQuirks, and wraps it within
- * a function with an unused argument, to match what MagicCombo expects.
- */
static void toggleKeyboardProtocol(uint8_t combo_index) {
USBQuirks.toggleKeyboardProtocol();
}
-/** Magic combo list, a list of key combo and action pairs the firmware should
- * recognise.
- */
USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol,
// Left Fn + Esc + Shift
.keys = { R3C6, R2C6, R3C7 }
});
-// First, tell Kaleidoscope which plugins you want to use.
-// 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,
- // The hardware test mode, which can be invoked by tapping Prog, LED and the
- // left Fn button at the same time.
TestMode,
- // LEDControl provides support for other LED modes
LEDControl,
-
DakkarColorDark, DakkarColorBright,
- // The macros plugin adds support for macros
Macros,
-
- // The MouseKeys plugin lets you add keys to your keymap which move the mouse.
MouseKeys,
-
- // The HostPowerManagement plugin allows us to turn LEDs off when then host
- // goes to sleep, and resume them when it wakes up.
HostPowerManagement,
-
- // The MagicCombo plugin lets you use key combinations to trigger custom
- // actions - a bit like Macros, but triggered by pressing multiple keys at the
- // same time.
MagicCombo,
-
- // The USBQuirks plugin lets you do some things with USB that we aren't
- // comfortable - or able - to do automatically, but can be useful
- // nevertheless. Such as toggling the key report protocol between Boot (used
- // by BIOSes) and Report (NKRO).
USBQuirks
);
-/** The 'setup' function is one of the two standard Arduino sketch functions.
- * It's called when your keyboard first powers up. This is where you set up
- * Kaleidoscope and any plugins.
- */
void setup() {
- // First, call Kaleidoscope's internal setup function
Kaleidoscope.setup();
-
DakkarColorDark.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, or by using the
- // `keymap.onlyCustom` command to use EEPROM layers only.
- EEPROMKeymap.setup(5);
}
-/** loop is the second of the standard Arduino sketch functions.
- * As you might expect, it runs in a loop, never exiting.
- *
- * For Kaleidoscope-based keyboard firmware, you usually just want to
- * call Kaleidoscope.loop(); and not do anything custom here.
- */
-
void loop() {
Kaleidoscope.loop();
}
diff --git a/keymap-wrapper.h b/keymap-wrapper.h
index cc58545..82271a0 100644
--- a/keymap-wrapper.h
+++ b/keymap-wrapper.h
@@ -1,5 +1,10 @@
#pragma once
+enum { PRIMARY, NUMPAD, FUNCTION, FVWM }; // layers
+
+#define PRIMARY_KEYMAP_QWERTY
+// #define PRIMARY_KEYMAP_DVORAK
+
#define CK(k,c) k
#define ColorKeymaps(layers...) KEYMAPS(layers)