aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2019-06-27 03:14:55 +0200
committerGuilhem Moulin <guilhem@fripost.org>2019-06-27 03:42:31 +0200
commite6c6ce7ab7797bf132638d1dd7172a754461f799 (patch)
treefad5fc4424fd0dd400fec2c96207a65ec3e07ac0
parent9d538b467cd0ef7db5b149ff66b1cfc89af5032e (diff)
Add Magic Combol: Nav + LeftClick + RightClick = MiddleClick.HEADmaster
For some reason adding USE_MAGIC_COMBOS(…) to src/MagicCombo.cpp crashes the keyboard, so we move it to src/keymap.h instead.
-rw-r--r--src/MagicCombo.cpp25
-rw-r--r--src/MagicCombo.h27
-rw-r--r--src/keymap.h9
-rw-r--r--src/model01.ino2
4 files changed, 63 insertions, 0 deletions
diff --git a/src/MagicCombo.cpp b/src/MagicCombo.cpp
new file mode 100644
index 0000000..a67566e
--- /dev/null
+++ b/src/MagicCombo.cpp
@@ -0,0 +1,25 @@
+/***********************************************************************
+ * 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-Macros.h>
+#include <Kaleidoscope-MouseKeys.h>
+#include "MagicCombo.h"
+
+void comboMiddleClick(uint8_t combo_index) {
+ ::Macros.play(MACRO(T(mouseBtnM)));
+}
diff --git a/src/MagicCombo.h b/src/MagicCombo.h
new file mode 100644
index 0000000..1546790
--- /dev/null
+++ b/src/MagicCombo.h
@@ -0,0 +1,27 @@
+/***********************************************************************
+ * 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-MagicCombo.h>
+
+enum {
+ MIDDLE_CLICK
+};
+
+extern void comboMiddleClick(uint8_t combo_index);
diff --git a/src/keymap.h b/src/keymap.h
index a15f725..80f4330 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -92,3 +92,12 @@ KEYMAPS(
, ___
)
)
+
+/* Magic Combos */
+USE_MAGIC_COMBOS(
+ [MIDDLE_CLICK] = {
+ .action = comboMiddleClick
+ /* Nav + LeftClick + RightClick */
+ , .keys = {R3C6, R2C6, R2C9}
+ }
+)
diff --git a/src/model01.ino b/src/model01.ino
index 61f0871..8d33fba 100644
--- a/src/model01.ino
+++ b/src/model01.ino
@@ -31,6 +31,7 @@
#include <Kaleidoscope-OneShot.h>
#include "Macros.h"
+#include "MagicCombo.h"
#include "TapDance.h"
#include "keymap.h"
@@ -46,6 +47,7 @@ KALEIDOSCOPE_INIT_PLUGINS(
, EscapeOneShot
, ActiveModColorEffect
, Macros
+ , MagicCombo
#ifdef ENABLE_SERIAL
, Focus
#endif