Skip to content

Instantly share code, notes, and snippets.

@colinta
Created November 14, 2018 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colinta/614f615729f7af4925c989912d4934ef to your computer and use it in GitHub Desktop.
Save colinta/614f615729f7af4925c989912d4934ef to your computer and use it in GitHub Desktop.
Alan's DZ60 keymap in Mechy
#include <Mechy.h>
#include <Mechy/Wiring.h>
#include <Mechy/KeyPress.h>
#include <Mechy/MediaKey.h>
#include <Mechy/GotoLayer.h>
#include <Mechy/TapHold.h>
#include <Mechy/Receiver.h>
#include <Mechy/Hardware/DZ60.h>
#define QWERTY_LAYER 0
#define NAV_LAYER 1
#define MEDIA_LAYER 2
#define CONTROL_LAYER 3
#define SPC_FN LT(KC_SPC, GOTO(NAV_LAYER))
#define TAB_FN LT(KC_SPC, GOTO(MEDIA_LAYER))
#define FN_FN LT(KC_SPC, GOTO(CONTROL_LAYER))
#define CTRL_ESC LT(KC_ESC, KC_LCTL)
#define GUI_TAB KC(LGUI(KEY_TAB))
KBD mainKeys[] = LAYOUT_60(
KC_ESC , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_MINS, KC_EQL , KC_BSPC ,
TAB_FN , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_LBRC, KC_RBRC, KC_BSLS ,
CTRL_ESC , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT, KC_ENT ,
KC_LSFT , KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RSFT ,
KC_LCTL , KC_LALT , KC_LGUI , KC_SPC , KC_RGUI , KC_RALT , KC_RCTL , FN_FN
);
KBD navKeys[] = LAYOUT_60(
KC_GRV, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , KC_DEL ,
GUI_TAB, ____ , ____ , KC_LCBR, KC_RCBR, ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
____ , ____ , ____ , KC_LPRN, KC_RPRN, ____ , KC_LEFT, KC_DOWN, KC_UP , KC_RGHT, ____ , ____ , ____ ,
____ , ____ , ____ , KC_LBRC, KC_RBRC, ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
____ , ____ , ____ , ____ , ____ , ____ , ____ , ____
);
KBD mediaKeys[] = LAYOUT_60(
____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
____ , KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY, KC_MNXT, ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
____ , ____ , ____ , ____ , ____ , ____ , KC_HOME, KC_PGDN, KC_PGUP, KC_END , ____ , ____ , ____ ,
____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
____ , ____ , ____ , ____ , ____ , ____ , ____ , ____
);
KBD controlKeys[] = LAYOUT_60(
____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
____ , ____ , ____ , ____ , ____ , ____ , ____ , ____
);
#if (__has_include("secrets.h"))
#include "secrets.h"
const char* macros[7] = {M0, M1, M2, M3, M4, M5, M6};
#else
const char* macros[7] = {"", "", "", "", "", "", ""};
#endif
Layout layout = Layout(ROWS, COLS, mainKeys, navKeys, mediaKeys);
Scanner scanner = Scanner(&layout, pinRows, pinCols, ROWS, COLS);
Mechy mechy = Mechy();
Hardware hardware = Hardware(&mechy);
void setup() {
Wiring::pinMode(_D5, INPUT);
Wiring::pinMode(_B0, INPUT);
mechy.add(new KeyPress());
mechy.add(new MediaKey());
mechy.add(new GotoLayer());
mechy.add(new TapHold());
mechy.attach(&scanner);
mechy.begin();
hardware.begin();
}
void loop() {
mechy.tick();
hardware.tick();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment