From e6c6ce7ab7797bf132638d1dd7172a754461f799 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 27 Jun 2019 03:14:55 +0200 Subject: Add Magic Combol: Nav + LeftClick + RightClick = MiddleClick. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For some reason adding USE_MAGIC_COMBOS(…) to src/MagicCombo.cpp crashes the keyboard, so we move it to src/keymap.h instead. --- src/MagicCombo.cpp | 25 +++++++++++++++++++++++++ src/MagicCombo.h | 27 +++++++++++++++++++++++++++ src/keymap.h | 9 +++++++++ src/model01.ino | 2 ++ 4 files changed, 63 insertions(+) create mode 100644 src/MagicCombo.cpp create mode 100644 src/MagicCombo.h (limited to 'src') 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 + * + * 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 . + **********************************************************************/ + +#include +#include +#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 + * + * 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 . + **********************************************************************/ + +#pragma once + +#include + +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 #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 -- cgit v1.2.3