228 lines
9.0 KiB
C++
228 lines
9.0 KiB
C++
/* -*- mode: c++ -*-
|
|
* Atreus -- Chrysalis-enabled Sketch for the Keyboardio Atreus
|
|
* Copyright (C) 2018, 2019 Keyboard.io, Inc
|
|
*
|
|
* 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 2 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, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*/
|
|
|
|
/*
|
|
* https://colemakmods.github.io/mod-dh/keyboards.html#matrix-keyboards
|
|
* german base keys
|
|
* Umlauts via Qubit keys
|
|
* navigation with vim-like homerow
|
|
*/
|
|
|
|
#ifndef BUILD_INFORMATION
|
|
#define BUILD_INFORMATION "locally built on " __DATE__ " at " __TIME__
|
|
#endif
|
|
|
|
#include "Kaleidoscope.h"
|
|
#include "Kaleidoscope-EEPROM-Settings.h"
|
|
#include "Kaleidoscope-EEPROM-Keymap.h"
|
|
#include "Kaleidoscope-FocusSerial.h"
|
|
#include "Kaleidoscope-Macros.h"
|
|
#include "Kaleidoscope-MouseKeys.h"
|
|
#include "Kaleidoscope-OneShot.h"
|
|
#include "Kaleidoscope-Qukeys.h"
|
|
#include "Kaleidoscope-SpaceCadet.h"
|
|
#include "Kaleidoscope-Languages.h"
|
|
#include "kaleidoscope/lang/de-qwertz.h"
|
|
|
|
|
|
#define MO(n) ShiftToLayer(n)
|
|
#define TG(n) LockLayer(n)
|
|
|
|
enum {
|
|
MACRO_QWERTY,
|
|
MACRO_VERSION_INFO
|
|
};
|
|
|
|
/* TODO add QWERTZ layer for gaming (and colleagues) */
|
|
/* QWERTZ+Shift should be MOVED to (and back) still with ability to use SYMBOLS layer from there */
|
|
enum {
|
|
BASE, // Colemak-DHm: no modifiers
|
|
SHIFT, // Shifted: hold Shift like a sane person
|
|
SYMBOLS, // SUPER key
|
|
NAVI, // with FUN or Any key (below , and .)
|
|
MOUSE // while holding M key
|
|
};
|
|
|
|
/* *INDENT-OFF* */
|
|
KEYMAPS(
|
|
[BASE] = KEYMAP_STACKED
|
|
(
|
|
Key_de_Q ,Key_de_W ,Key_de_F ,Key_de_P ,Key_de_B
|
|
,Key_de_A ,Key_de_R ,Key_de_S ,Key_de_T ,Key_de_G
|
|
,Key_de_Y ,Key_de_X ,Key_de_C ,Key_de_D ,Key_de_V ,Key_de_Slash
|
|
,Key_de_LeftControl ,Key_de_Tab ,Key_LeftGui ,MO(SHIFT) ,Key_de_Spacebar ,Key_de_Escape
|
|
|
|
|
|
,Key_de_J ,Key_de_L ,Key_de_U ,Key_de_Z ,Key_de_Semicolon
|
|
,Key_de_M ,Key_de_N ,Key_de_E ,Key_de_I ,Key_de_O
|
|
,Key_de_Backslash ,Key_de_K ,Key_de_H ,Key_de_Comma ,Key_de_Period ,Key_de_Slash
|
|
,Key_de_LeftAlt ,MO(SYMBOLS) ,Key_de_Backspace ,MO(NAVI) ,MO(NAVI) ,Key_Enter
|
|
),
|
|
|
|
[SHIFT] = KEYMAP_STACKED
|
|
(
|
|
LSHIFT(Key_de_Q) ,LSHIFT(Key_de_W) ,LSHIFT(Key_de_F) ,LSHIFT(Key_de_P) ,LSHIFT(Key_de_B)
|
|
,LSHIFT(Key_de_A) ,LSHIFT(Key_de_R) ,LSHIFT(Key_de_S) ,LSHIFT(Key_de_T) ,LSHIFT(Key_de_G)
|
|
,LSHIFT(Key_de_Y) ,LSHIFT(Key_de_X) ,LSHIFT(Key_de_C) ,LSHIFT(Key_de_D) ,LSHIFT(Key_de_V) ,Key_de_LessThan
|
|
,___ ,LSHIFT(Key_de_Tab) ,___ ,___ ,___ ,___
|
|
|
|
|
|
,LSHIFT(Key_de_J) ,LSHIFT(Key_de_L) ,LSHIFT(Key_de_U) ,LSHIFT(Key_de_Z) ,LSHIFT(Key_de_W)
|
|
,LSHIFT(Key_de_M) ,LSHIFT(Key_de_N) ,LSHIFT(Key_de_E) ,LSHIFT(Key_de_I) ,LSHIFT(Key_de_O)
|
|
,LSHIFT(Key_de_LessThan) ,LSHIFT(Key_de_K) ,LSHIFT(Key_de_H) ,Key_de_Semicolon ,Key_de_Colon ,Key_de_Backslash
|
|
,___ ,___ ,Key_de_Delete ,___ ,___ ,___
|
|
),
|
|
|
|
[SYMBOLS] = KEYMAP_STACKED
|
|
(
|
|
Key_de_ExlamationMark ,Key_de_At ,Key_de_QuestionMark ,Key_de_Dollar ,Key_de_Percent
|
|
,Key_de_Tilde ,Key_de_LeftCurly ,Key_de_LeftParen ,Key_de_LeftBracket ,Key_de_Quote
|
|
,Key_de_Pipe ,Key_de_RightCurly ,Key_de_RightParen ,Key_de_RightBracket ,Key_de_DoubleQuote ,Key_de_LessThan
|
|
,___ ,Key_de_Insert ,___ ,Key_de_LeftShift ,Key_de_Spacebar ,Key_de_GreaterThan
|
|
|
|
|
|
,Key_de_Slash ,Key_de_7 ,Key_de_8 ,Key_de_9 ,Key_de_Plus
|
|
,Key_de_Asterisk ,Key_de_4 ,Key_de_5 ,Key_de_6 ,Key_de_Minus
|
|
,Key_de_GreaterThan ,Key_de_0 ,Key_de_1 ,Key_de_2 ,Key_de_3 ,Key_de_Slash
|
|
,Key_de_LeftAlt ,___ ,___ ,Key_de_Period ,Key_de_Comma ,Key_de_Equals
|
|
),
|
|
|
|
[NAVI] = KEYMAP_STACKED
|
|
(
|
|
Key_de_UpArrow ,Key_de_F7 ,Key_de_F8 ,Key_de_F9 ,Key_de_F10
|
|
,Key_de_DownArrow ,Key_de_F4 ,Key_de_F5 ,Key_de_F6 ,Key_de_F11
|
|
,___ ,Key_de_F1 ,Key_de_F2 ,Key_de_F3 ,Key_de_F12 ,___
|
|
,MoveToLayer(BASE) ,___ ,___ ,___ ,___ ,___
|
|
|
|
|
|
,Key_de_Insert ,Key_de_Home ,Key_de_UpArrow ,Key_de_End ,Key_de_PageUp
|
|
,Key_de_LeftArrow ,Key_de_DownArrow ,Key_de_UpArrow ,Key_de_RightArrow ,Key_de_PageDown
|
|
,___ ,Key_de_VolumeDown ,Key_de_VolumeUp ,Key_de_Mute ,___ ,Consumer_PlaySlashPause
|
|
,___ ,___ ,___ ,___ ,___ ,___
|
|
),
|
|
|
|
[MOUSE] = KEYMAP_STACKED
|
|
(
|
|
XXX, Key_mouseBtnP, Key_mouseUp, Key_mouseBtnN, XXX,
|
|
XXX, Key_mouseL, Key_mouseDn, Key_mouseR, XXX,
|
|
XXX, XXX, XXX, XXX, XXX, XXX,
|
|
XXX, XXX, XXX, Key_mouseBtnL, Key_mouseScrollUp, Key_mouseScrollL,
|
|
|
|
XXX, XXX, XXX, XXX, XXX,
|
|
XXX, XXX, XXX, XXX, XXX,
|
|
XXX, XXX, XXX, XXX, XXX, XXX,
|
|
Key_mouseScrollR, Key_mouseScrollDn, Key_mouseBtnR, XXX, XXX, XXX
|
|
),
|
|
)
|
|
/* *INDENT-ON* */
|
|
|
|
|
|
|
|
KALEIDOSCOPE_INIT_PLUGINS(
|
|
EEPROMSettings,
|
|
EEPROMKeymap,
|
|
Focus,
|
|
FocusEEPROMCommand,
|
|
FocusSettingsCommand,
|
|
Qukeys,
|
|
SpaceCadet,
|
|
OneShot,
|
|
Macros,
|
|
MouseKeys
|
|
);
|
|
|
|
const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
|
|
if (keyToggledOn(event.state)) {
|
|
switch (macro_id) {
|
|
case MACRO_QWERTY:
|
|
// This macro is currently unused, but is kept around for compatibility
|
|
// reasons. We used to use it in place of `MoveToLayer(QWERTY)`, but no
|
|
// longer do. We keep it so that if someone still has the old layout with
|
|
// the macro in EEPROM, it will keep working after a firmware update.
|
|
Layer.move(BASE);
|
|
break;
|
|
case MACRO_VERSION_INFO:
|
|
Macros.type(PSTR("Keyboardio Atreus - Kaleidoscope "));
|
|
Macros.type(PSTR(BUILD_INFORMATION));
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
return MACRO_NONE;
|
|
}
|
|
|
|
void setup() {
|
|
QUKEYS(
|
|
//Qukey(layer, key_addr, alternate_key)
|
|
|
|
//umlaute
|
|
kaleidoscope::plugin::Qukey(BASE, KeyAddr(1, 2), Key_de_SS), // s -> ß
|
|
kaleidoscope::plugin::Qukey(BASE, KeyAddr(1, 0), Key_de_AUml), // a -> ä
|
|
kaleidoscope::plugin::Qukey(SHIFT, KeyAddr(1, 0), LSHIFT(Key_de_AUml)), // A -> Ä
|
|
kaleidoscope::plugin::Qukey(BASE, KeyAddr(1, 11), Key_de_OUml), // o -> ö
|
|
kaleidoscope::plugin::Qukey(SHIFT, KeyAddr(1, 11), LSHIFT(Key_de_OUml)), // o -> Ö
|
|
kaleidoscope::plugin::Qukey(BASE, KeyAddr(0, 9), Key_de_UUml), // u -> ü
|
|
kaleidoscope::plugin::Qukey(SHIFT, KeyAddr(0, 9), LSHIFT(Key_de_UUml)), // U -> Ü
|
|
|
|
//common special characters
|
|
kaleidoscope::plugin::Qukey(BASE, KeyAddr(0, 0), Key_de_At), // q -> @
|
|
kaleidoscope::plugin::Qukey(BASE, KeyAddr(1, 9), Key_de_Euro), // e -> €
|
|
kaleidoscope::plugin::Qukey(BASE, KeyAddr(1, 8), Key_de_Tilde), // n -> ~
|
|
|
|
//layer shifts/switches
|
|
kaleidoscope::plugin::Qukey(BASE, KeyAddr(1, 7), MO(MOUSE)), // shift to mouse controls
|
|
|
|
//hold for "ctrl+" version of the key
|
|
// kaleidoscope::plugin::Qukey(BASE, KeyAddr(2, 2), LCTRL(Key_de_C)), // c copy
|
|
// kaleidoscope::plugin::Qukey(BASE, KeyAddr(2, 4), LCTRL(Key_de_V)), // v paste
|
|
// kaleidoscope::plugin::Qukey(BASE, KeyAddr(2, 1), LCTRL(Key_de_X)), // x cut
|
|
// kaleidoscope::plugin::Qukey(BASE, KeyAddr(2, 0), LCTRL(Key_de_Z)), // z undo
|
|
// kaleidoscope::plugin::Qukey(BASE, KeyAddr(0, 10), LCTRL(Key_de_Y)), // y redo
|
|
// kaleidoscope::plugin::Qukey(BASE, KeyAddr(1, 3), LCTRL(Key_de_F)), // f find
|
|
// kaleidoscope::plugin::Qukey(BASE, KeyAddr(0, 8), LCTRL(Key_de_L)), // l select address bar
|
|
// kaleidoscope::plugin::Qukey(BASE, KeyAddr(1, 1), LCTRL(Key_de_R)), // r reload page
|
|
|
|
//ease of use
|
|
// kaleidoscope::plugin::Qukey(BASE, KeyAddr(2, 9), Key_de_Semicolon), // semi-colon
|
|
// kaleidoscope::plugin::Qukey(BASE, KeyAddr(2, 10), Key_de_Colon), // colon
|
|
|
|
//other
|
|
// kaleidoscope::plugin::Qukey(BASE, KeyAddr(3, 11), Key_de_LeftAlt), // esc -> alt
|
|
|
|
/* todo:
|
|
* p = print
|
|
* s = save or leave ß
|
|
* t = new tab
|
|
* n = new page/browser window/doc or leave ~
|
|
*/
|
|
)
|
|
|
|
//Qukey settings
|
|
Qukeys.setHoldTimeout(250);
|
|
Qukeys.setOverlapThreshold(80);
|
|
Kaleidoscope.setup();
|
|
SpaceCadet.disable();
|
|
EEPROMKeymap.setup(10);
|
|
}
|
|
|
|
void loop() {
|
|
Kaleidoscope.loop();
|
|
}
|