aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2019-06-25 13:57:33 +0200
committerGuilhem Moulin <guilhem@fripost.org>2019-06-26 01:04:35 +0200
commit3f2c2fdaa542cf9a0a170d56d2dc1bd16144f6b8 (patch)
tree847b52e1ccaaa29ce7a112690e3526f3d6cd8bbf /src
Initial commit.
Inspired by the reference firmware https://github.com/keyboardio/Model01-Firmware and algernon's fork https://git.madhouse-project.org/algernon/Model01-Sketch
Diffstat (limited to 'src')
-rw-r--r--src/TapDance.cpp40
-rw-r--r--src/TapDance.h31
-rw-r--r--src/keymap.h103
-rw-r--r--src/model01.ino68
4 files changed, 242 insertions, 0 deletions
diff --git a/src/TapDance.cpp b/src/TapDance.cpp
new file mode 100644
index 0000000..e5f870d
--- /dev/null
+++ b/src/TapDance.cpp
@@ -0,0 +1,40 @@
+/***********************************************************************
+ * A firmware Sketch for the Keyboardio Model 01
+ * Copyright © 2016, 2017, 2018 Gergely Nagy
+ * Copyright © 2019 Guilhem Moulin <guilhem@fripost.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **********************************************************************/
+
+#include "TapDance.h"
+
+bool cancelOneShot = false;
+void tapDanceAction(uint8_t tapDanceIndex, byte row, byte col, uint8_t tapCount,
+ kaleidoscope::plugin::TapDance::ActionType tapDanceAction) {
+ /* Cancel any pending on-shot effects when a tap-dance key is released */
+ if (tapDanceAction == kaleidoscope::plugin::TapDance::Release)
+ cancelOneShot = true;
+
+ switch (tapDanceIndex) {
+ case COLON:
+ return tapDanceActionKeys(tapCount, tapDanceAction,
+ LSHIFT(Key_Semicolon), Key_Semicolon);
+ case LPB:
+ return tapDanceActionKeys(tapCount, tapDanceAction,
+ Key_LeftBracket, Key_LeftParen);
+ case RPB:
+ return tapDanceActionKeys(tapCount, tapDanceAction,
+ Key_RightBracket, Key_RightParen);
+ }
+}
diff --git a/src/TapDance.h b/src/TapDance.h
new file mode 100644
index 0000000..ff90f5e
--- /dev/null
+++ b/src/TapDance.h
@@ -0,0 +1,31 @@
+/***********************************************************************
+ * A firmware Sketch for the Keyboardio Model 01
+ * Copyright © 2019 Guilhem Moulin <guilhem@fripost.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **********************************************************************/
+
+#pragma once
+
+#include <Kaleidoscope-TapDance.h>
+
+enum {
+ COLON
+ , LPB
+ , RPB
+};
+
+extern bool cancelOneShot;
+extern void tapDanceAction(uint8_t tapDanceIndex, byte row, byte col, uint8_t tapCount,
+ kaleidoscope::plugin::TapDance::ActionType tapDanceAction);
diff --git a/src/keymap.h b/src/keymap.h
new file mode 100644
index 0000000..2f4d5bd
--- /dev/null
+++ b/src/keymap.h
@@ -0,0 +1,103 @@
+/***********************************************************************
+ * A firmware Sketch for the Keyboardio Model 01 -- keymap
+ * Copyright © 2016, 2017, 2018 Gergely Nagy
+ * Copyright © 2019 Guilhem Moulin <guilhem@fripost.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **********************************************************************/
+
+#pragma once
+
+/* Layers */
+enum {
+ DVORAK
+ , NAV
+ , NUM
+
+ , LAYER_MAX = NUM
+};
+
+#define Key_AT LSHIFT(Key_2)
+#define Key_STAR LSHIFT(Key_8)
+#define Key_DOLLR LSHIFT(Key_4)
+#define Key_CARET LSHIFT(Key_6)
+#define Key_PRCNT LSHIFT(Key_5)
+#define Key_EXCLM LSHIFT(Key_1)
+#define Key_HASH LSHIFT(Key_3)
+#define Key_AND LSHIFT(Key_7)
+#define Key_LCB LSHIFT(Key_LeftBracket)
+#define Key_RCB LSHIFT(Key_RightBracket)
+#define Key_Plus LSHIFT(Key_Equals)
+
+#define Key_PlayPause Consumer_PlaySlashPause
+#define Key_Underscore LSHIFT(Key_Minus)
+
+/* Keymaps */
+KEYMAPS(
+ [DVORAK] = KEYMAP_STACKED(
+ ___, Key_LCB, Key_AT, Key_STAR, Key_DOLLR, Key_CARET, ___
+ , Key_Backtick, Key_Quote, Key_Comma, Key_Period, Key_P, Key_Y, TD(LPB)
+ , Key_Tab, Key_A, Key_O, Key_E, Key_U, Key_I
+ , Key_Menu, Key_Slash, Key_Q, Key_J, Key_K, Key_X, TD(COLON)
+
+ , OSM(LeftControl), Key_Backspace, OSM(LeftShift), Key_Escape
+ , OSL(NAV)
+
+ , ___, Key_PRCNT, Key_EXCLM, Key_HASH, Key_AND, Key_RCB, ___
+ , TD(RPB), Key_F, Key_G, Key_C, Key_R, Key_L, Key_Backslash
+ , Key_D, Key_H, Key_T, Key_N, Key_S, Key_Minus
+ , Key_Equals, Key_B, Key_M, Key_W, Key_V, Key_Z, ___
+
+ , ___, Key_Enter, Key_Spacebar, OSM(RightAlt)
+ , OSL(NUM)
+ )
+
+
+ , [NAV] = KEYMAP_STACKED(
+ ___, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_PrintScreen
+ , XXX, Key_mouseScrollL, Key_mouseWarpNW, Key_mouseUp, Key_mouseWarpNE, Key_mouseScrollUp, Key_mouseWarpEnd
+ , XXX, Key_mouseScrollR, Key_mouseL, Key_mouseDn, Key_mouseR, Key_mouseScrollDn
+ , ___, XXX, Key_mouseWarpSW, XXX, Key_mouseWarpSE, XXX, Key_mouseBtnL
+
+ , ___, Key_Delete, ___, ___
+ , ___
+
+ , ___, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10, Key_F11
+ , Key_PlayPause, Key_PageUp, Key_Home, Key_UpArrow, Key_End, XXX, Key_F12
+ , Key_PageDown, Key_LeftArrow, Key_DownArrow, Key_RightArrow, XXX, XXX
+ , Key_mouseBtnR, XXX, XXX, XXX, XXX, XXX, Key_Insert
+
+ , ___, ___, Key_Enter, ___
+ , ___
+ )
+
+
+ , [NUM] = KEYMAP_STACKED(
+ ___, ___, ___, ___, ___, ___, ___
+ , ___, ___, ___, ___, ___, ___, ___
+ , ___, ___, ___, ___, ___, ___
+ , ___, ___, ___, ___, ___, ___, ___
+
+ , ___, ___, ___, ___
+ , ___
+
+ , XXX, XXX, XXX, XXX, XXX, XXX, XXX
+ , XXX, XXX, Key_1, Key_2, Key_3, XXX, Key_Equals
+ , Key_0, Key_4, Key_5, Key_6, Key_Minus, Key_Plus
+ , Key_Underscore, Key_Period, Key_7, Key_8, Key_9, XXX, XXX
+
+ , ___, ___, ___, ___
+ , ___
+ )
+)
diff --git a/src/model01.ino b/src/model01.ino
new file mode 100644
index 0000000..3a714d7
--- /dev/null
+++ b/src/model01.ino
@@ -0,0 +1,68 @@
+/***********************************************************************
+ * A firmware Sketch for the Keyboardio Model 01
+ * Copyright © 2019 Guilhem Moulin <guilhem@fripost.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **********************************************************************/
+
+#include <Kaleidoscope.h>
+#include <Kaleidoscope-Colormap.h>
+#include <Kaleidoscope-EEPROM-Settings.h>
+#include <Kaleidoscope-Escape-OneShot.h>
+#include <Kaleidoscope-IdleLEDs.h>
+#include <Kaleidoscope-LEDControl.h>
+#include <Kaleidoscope-LED-ActiveModColor.h>
+#include <Kaleidoscope-LED-Palette-Theme.h>
+#include <Kaleidoscope-OneShot.h>
+#include <Kaleidoscope-MouseKeys.h>
+#include <Kaleidoscope-Unicode.h>
+
+#include "TapDance.h"
+#include "keymap.h"
+
+
+KALEIDOSCOPE_INIT_PLUGINS(
+ EEPROMSettings
+ , TapDance
+ , LEDControl
+ , IdleLEDs
+ , LEDPaletteTheme
+ , ColormapEffect
+ , MouseKeys
+ , OneShot
+ , EscapeOneShot
+ , ActiveModColorEffect
+);
+
+void setup() {
+ Kaleidoscope.setup();
+
+ ColormapEffect.max_layers(LAYER_MAX+1);
+ ColormapEffect.activate();
+
+ MouseWrapper.speedLimit = 64;
+ MouseKeys.speed = 15;
+ MouseKeys.accelDelay = 35;
+
+ IdleLEDs.idle_time_limit = 60;
+}
+
+void loop() {
+ Kaleidoscope.loop();
+
+ if (cancelOneShot) {
+ OneShot.cancel();
+ cancelOneShot = false;
+ }
+}