aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2020-06-01 20:44:17 -0400
committerBrian Cully <bjc@kublai.com>2020-06-01 22:16:10 -0400
commitc056b242816eaa3c992f6803857274c46f1a831b (patch)
treee629a1e2ed2100a54567f5d31e49b25a4224eb99
parent6d85253f59721509a4955f08a7aa93ac196efee4 (diff)
parent03bee4b8746aa79a0f1dcf5e5c0c2a1742b8162d (diff)
downloadModel01-Firmware-c056b242816eaa3c992f6803857274c46f1a831b.tar.gz
Model01-Firmware-c056b242816eaa3c992f6803857274c46f1a831b.zip
Update to newest kaleidoscope
-rw-r--r--Makefile19
-rw-r--r--Model01-Firmware.ino64
-rw-r--r--README.md4
-rwxr-xr-xbuild.sh12
4 files changed, 71 insertions, 28 deletions
diff --git a/Makefile b/Makefile
index 417a025..7682689 100644
--- a/Makefile
+++ b/Makefile
@@ -50,6 +50,23 @@ endif
BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware
-KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/
+KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/build-tools/makefiles/
+
+# If Kaleidoscope's Arduino libraries cannot be found, e.g. because
+# they reside outside of SKETCHBOOK_DIR, we fall back to assuming that
+# the hardware directory can be determined in relation to the position of
+# this Makefile.
+ifeq ("$(wildcard $(BOARD_HARDWARE_PATH)/keyboardio/build-tools/makefiles/rules.mk)","")
+ # Determine the path of this Makefile
+ MKFILE_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
+ BOARD_HARDWARE_PATH = $(MKFILE_DIR)/../../../..
+endif
+
+ifeq ("$(wildcard $(BOARD_HARDWARE_PATH)/keyboardio/build-tools/makefiles/rules.mk)","")
+$(info ***************************************************************************)
+$(info Unable to autodetect a proper BOARD_HARDWARE_PATH. Please define it manually.)
+$(info ***************************************************************************)
+$(info )
+endif
include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk
diff --git a/Model01-Firmware.ino b/Model01-Firmware.ino
index ea7d5be..9aa9899 100644
--- a/Model01-Firmware.ino
+++ b/Model01-Firmware.ino
@@ -8,7 +8,7 @@
#include <Kaleidoscope-Macros.h>
#include <Kaleidoscope-LEDControl.h>
#include <Kaleidoscope-NumPad.h>
-#include <Kaleidoscope-Model01-TestMode.h>
+#include <Kaleidoscope-HardwareTestMode.h>
#include <Kaleidoscope-HostPowerManagement.h>
#include <Kaleidoscope-MagicCombo.h>
#include <Kaleidoscope-Qukeys.h>
@@ -19,7 +19,7 @@
#include <Kaleidoscope-Syster.h>
#include <Kaleidoscope-Unicode.h>
#include <kaleidoscope/hid.h>
-#include <Kaleidoscope-MacrosOnTheFly.h>
+//#include <Kaleidoscope-MacrosOnTheFly.h>
#include <Kaleidoscope-LEDEffect-BootGreeting.h>
#include <Kaleidoscope-LEDEffect-Breathe.h>
#include <Kaleidoscope-IdleLEDs.h>
@@ -110,10 +110,10 @@ KEYMAPS(
___, ___, ___, ___,
___,
- M(MACRO_VERSION_INFO), ___, Key_Keypad7, Key_Keypad8, Key_Keypad9, Key_KeypadSubtract, ___,
- ___, ___, Key_Keypad4, Key_Keypad5, Key_Keypad6, Key_KeypadAdd, ___,
- ___, Key_Keypad1, Key_Keypad2, Key_Keypad3, Key_Equals, ___,
- ___, ___, Key_Keypad0, Key_KeypadDot, Key_KeypadMultiply, Key_KeypadDivide, Key_Enter,
+ M(MACRO_VERSION_INFO), ___, Key_7, Key_8, Key_9, Key_KeypadSubtract, ___,
+ ___, ___, Key_4, Key_5, Key_6, Key_KeypadAdd, ___,
+ ___, Key_1, Key_2, Key_3, Key_Equals, ___,
+ ___, ___, Key_0, Key_Period, Key_KeypadMultiply, Key_KeypadDivide, Key_Enter,
___, ___, ___, ___,
___),
@@ -160,12 +160,12 @@ static void anyKeyMacro(uint8_t keyState) {
static Key lastKey;
bool toggledOn = false;
if (keyToggledOn(keyState)) {
- lastKey.keyCode = Key_A.keyCode + (uint8_t)(millis() % 36);
+ lastKey.setKeyCode(Key_A.getKeyCode() + (uint8_t)(millis() % 36));
toggledOn = true;
}
if (keyIsPressed(keyState))
- kaleidoscope::hid::pressKey(lastKey, toggledOn);
+ Kaleidoscope.hid().keyboard().pressKey(lastKey, toggledOn);
}
const macro_t *emoteMacro(uint8_t macroIndex, uint8_t keyState) {
@@ -200,18 +200,15 @@ 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::HostPowerManagement::Event event) {
+void toggleLedsOnSuspendResume(kaleidoscope::plugin::HostPowerManagement::Event event) {
switch (event) {
- case kaleidoscope::HostPowerManagement::Suspend:
- LEDControl.paused = true;
- LEDControl.set_all_leds_to({0, 0, 0});
- LEDControl.syncLeds();
+ case kaleidoscope::plugin::HostPowerManagement::Suspend:
+ LEDControl.disable();
break;
- case kaleidoscope::HostPowerManagement::Resume:
- LEDControl.paused = false;
- LEDControl.refreshAll();
+ case kaleidoscope::plugin::HostPowerManagement::Resume:
+ LEDControl.enable();
break;
- case kaleidoscope::HostPowerManagement::Sleep:
+ case kaleidoscope::plugin::HostPowerManagement::Sleep:
break;
}
}
@@ -220,7 +217,7 @@ void toggleLedsOnSuspendResume(kaleidoscope::HostPowerManagement::Event event) {
* resume, and sleep) to other functions that perform action based on these
* events.
*/
-void hostPowerManagementEventHandler(kaleidoscope::HostPowerManagement::Event event) {
+void hostPowerManagementEventHandler(kaleidoscope::plugin::HostPowerManagement::Event event) {
toggleLedsOnSuspendResume(event);
}
@@ -234,10 +231,14 @@ void hostPowerManagementEventHandler(kaleidoscope::HostPowerManagement::Event ev
enum {
// Toggle between Boot (6-key rollover; for BIOSes and early boot) and NKRO
// mode.
- COMBO_TOGGLE_NKRO_MODE
+ COMBO_TOGGLE_NKRO_MODE,
+ // Enter test mode
+ COMBO_ENTER_TEST_MODE
};
-/** A tiny wrapper, to be used by MagicCombo.
+/** Wrappers, 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.
*/
@@ -245,12 +246,23 @@ static void toggleKeyboardProtocol(uint8_t combo_index) {
USBQuirks.toggleKeyboardProtocol();
}
+/**
+ * This enters the hardware test mode
+ */
+static void enterHardwareTestMode(uint8_t combo_index) {
+ HardwareTestMode.runTests();
+}
+
+
/** Magic combo list, a list of key combo and action pairs the firmware should
* recognise.
*/
-USE_MAGIC_COMBOS([COMBO_TOGGLE_NKRO_MODE] = {.action = toggleKeyboardProtocol,
- // Left Fn + Esc + Shift
- .keys = { R3C6, R2C6, R3C7 }});
+USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol,
+ // Left Fn + Esc + Shift
+ .keys = { R3C6, R2C6, R3C7 }},
+ {.action = enterHardwareTestMode,
+ // Left Fn + Prog + LED
+ .keys = { R3C6, R0C0, R0C6 }});
static LayerHighlighter emoteHighlighter(EMOTES);
@@ -342,9 +354,9 @@ void systerAction(kaleidoscope::plugin::Syster::action_t action, const char *sym
case kaleidoscope::plugin::Syster::EndAction:
handleKeyswitchEvent(Key_Backspace, UnknownKeyswitchLocation, IS_PRESSED | INJECTED);
- kaleidoscope::hid::sendKeyboardReport();
+ Kaleidoscope.hid().keyboard().sendReport();
handleKeyswitchEvent(Key_Backspace, UnknownKeyswitchLocation, WAS_PRESSED | INJECTED);
- kaleidoscope::hid::sendKeyboardReport();
+ Kaleidoscope.hid().keyboard().sendReport();
break;
case kaleidoscope::plugin::Syster::SymbolAction:
@@ -372,6 +384,8 @@ void systerAction(kaleidoscope::plugin::Syster::action_t action, const char *sym
Unicode.type(0x1f4af);
} else if (strcmp(symbol, "eye") == 0) {
Unicode.type(0x1f440);
+
+
} else if (strcmp(symbol, "heye") == 0) {
Unicode.type(0x1f60d);
} else if (strcmp(symbol, "think") == 0) {
diff --git a/README.md b/README.md
index 665961f..84d0dbf 100644
--- a/README.md
+++ b/README.md
@@ -97,14 +97,14 @@ After that, you'll want to update the Kaleidoscope libraries.
### MacOS
```sh
-cd $HOME/Documents/Arduino/hardware/keyboardio/avr
+cd $HOME/Documents/Arduino/hardware/keyboardio
make update-submodules
```
### Linux
```sh
-cd $HOME/Arduino/hardware/keyboardio/avr
+cd $HOME/Arduino/hardware/keyboardio
make update-submodules
```
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..cd592d4
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+ARDUINO_PATH=/usr/share/arduino
+export ARDUINO_PATH
+COMPILER_PATH=~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/
+export COMPILER_PATH
+AVRDUDE=/usr/bin/avrdude
+export AVRDUDE
+AVRDUDE_CONF=/etc/avrdude.conf
+export AVRDUDE_CONF
+
+make $@