From cda23c754e4d16438e2b42d86b4ce9a1eadc03d7 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Mon, 24 Aug 2015 19:31:12 -0400 Subject: [PATCH] midi working --- keyboard/atomic/Makefile | 2 +- keyboard/planck/Makefile | 10 +- keyboard/planck/config.h | 6 +- keyboard/planck/keymap_common.c | 10 +- keyboard/planck/keymap_common.h | 1 + keyboard/planck/keymap_midi.c | 29 +++ keyboard/planck/keymap_midi.h | 211 ++++++++++++++++++ .../planck/keymaps/keymap_angerthosenear.c | 50 +++++ keyboard/planck/keymaps/keymap_austin.c | 50 +++++ keyboard/planck/keymaps/keymap_charlie.c | 54 +++++ keyboard/planck/keymaps/keymap_daniel.c | 48 ++++ keyboard/planck/keymaps/keymap_david.c | 76 +++++++ keyboard/planck/keymaps/keymap_default.c | 4 +- keyboard/planck/keymaps/keymap_dzobert.c | 49 ++++ keyboard/planck/keymaps/keymap_jack.c | 50 +++++ keyboard/planck/keymaps/keymap_joe.c | 88 ++++++++ keyboard/planck/keymaps/keymap_kyle.c | 49 ++++ keyboard/planck/keymaps/keymap_leo.c | 46 ++++ keyboard/planck/keymaps/keymap_lock.c | 72 ++++++ keyboard/planck/keymaps/keymap_max.c | 49 ++++ keyboard/planck/keymaps/keymap_numpad.c | 26 +++ .../extended_keymap_default.c | 5 + protocol/lufa.mk | 17 +- protocol/lufa/descriptor.c | 10 +- protocol/lufa/descriptor.h | 27 ++- protocol/lufa/lufa.c | 103 +++++++-- protocol/lufa/lufa.h | 11 +- 27 files changed, 1095 insertions(+), 58 deletions(-) create mode 100644 keyboard/planck/keymap_midi.c create mode 100644 keyboard/planck/keymap_midi.h create mode 100644 keyboard/planck/keymaps/keymap_angerthosenear.c create mode 100644 keyboard/planck/keymaps/keymap_austin.c create mode 100644 keyboard/planck/keymaps/keymap_charlie.c create mode 100644 keyboard/planck/keymaps/keymap_daniel.c create mode 100644 keyboard/planck/keymaps/keymap_david.c create mode 100644 keyboard/planck/keymaps/keymap_dzobert.c create mode 100644 keyboard/planck/keymaps/keymap_jack.c create mode 100644 keyboard/planck/keymaps/keymap_joe.c create mode 100644 keyboard/planck/keymaps/keymap_kyle.c create mode 100644 keyboard/planck/keymaps/keymap_leo.c create mode 100644 keyboard/planck/keymaps/keymap_lock.c create mode 100644 keyboard/planck/keymaps/keymap_max.c create mode 100644 keyboard/planck/keymaps/keymap_numpad.c diff --git a/keyboard/atomic/Makefile b/keyboard/atomic/Makefile index ed1d331766..02153214f3 100644 --- a/keyboard/atomic/Makefile +++ b/keyboard/atomic/Makefile @@ -39,7 +39,7 @@ #---------------------------------------------------------------------------- # Target file name (without extension). -TARGET = planck_lufa +TARGET = atomic_lufa # Directory common source filess exist TOP_DIR = ../.. diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile index 9f7634d993..8c357f4b0a 100644 --- a/keyboard/planck/Makefile +++ b/keyboard/planck/Makefile @@ -116,17 +116,21 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 # comment out to disable the options. # BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +# MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) CONSOLE_ENABLE = yes # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE #SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend -NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA +# NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -#MIDI_ENABLE = YES # MIDI controls +# MIDI_ENABLE = YES # MIDI controls BACKLIGHT_ENABLE = yes +ifdef MIDI_ENABLE + SRC += keymap_midi.c +endif + # Optimize size but this may cause error "relocation truncated to fit" #EXTRALDFLAGS = -Wl,--relax diff --git a/keyboard/planck/config.h b/keyboard/planck/config.h index 47cf39a903..bf783728fb 100644 --- a/keyboard/planck/config.h +++ b/keyboard/planck/config.h @@ -22,7 +22,7 @@ along with this program. If not, see . /* USB Device descriptor parameter */ #define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x6060 +#define PRODUCT_ID 0x6061 #define DEVICE_VER 0x0001 #define MANUFACTURER Ortholinear Keyboards #define PRODUCT The Planck Keyboard @@ -61,10 +61,10 @@ along with this program. If not, see . */ /* disable debug print */ -#define NO_DEBUG +// #define NO_DEBUG /* disable print */ -#define NO_PRINT +// #define NO_PRINT /* disable action features */ //#define NO_ACTION_LAYER diff --git a/keyboard/planck/keymap_common.c b/keyboard/planck/keymap_common.c index 1ce4500973..886bfe23c4 100644 --- a/keyboard/planck/keymap_common.c +++ b/keyboard/planck/keymap_common.c @@ -23,6 +23,7 @@ along with this program. If not, see . #include "action_macro.h" #include "debug.h" #include "backlight.h" +#include "keymap_midi.h" static action_t keycode_to_action(uint16_t keycode); @@ -69,9 +70,14 @@ action_t action_for_key(uint8_t layer, keypos_t key) } else if (keycode == RESET) { bootloader_jump(); return; - } else if (keycode > RESET) { - // MIDI + } else if (keycode == DEBUG) { + print("\nDEBUG: enabled.\n"); + debug_enable = true; return; + } else if (keycode >= 0x6000 && keycode < 0x7000) { + action_t action; + action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8); + return action; } switch (keycode) { diff --git a/keyboard/planck/keymap_common.h b/keyboard/planck/keymap_common.h index e6a7dac5b5..7ccfa1b039 100644 --- a/keyboard/planck/keymap_common.h +++ b/keyboard/planck/keymap_common.h @@ -174,6 +174,7 @@ extern const uint16_t fn_actions[]; #define BL_STEP 0x4013 #define RESET 0x5000 +#define DEBUG 0x5001 #define MIDI(n) n | 0x6000 diff --git a/keyboard/planck/keymap_midi.c b/keyboard/planck/keymap_midi.c new file mode 100644 index 0000000000..81f84bcd76 --- /dev/null +++ b/keyboard/planck/keymap_midi.c @@ -0,0 +1,29 @@ +/* +Copyright 2015 Jack Humbert + +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, see . +*/ + +#include "keymap_common.h" +#include "keymap_midi.h" +#include + +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + if (record->event.pressed) { + midi_send_noteon(&midi_device, opt, (id & 0xFF), 127); + } else { + midi_send_noteoff(&midi_device, opt, (id & 0xFF), 127); + } +} \ No newline at end of file diff --git a/keyboard/planck/keymap_midi.h b/keyboard/planck/keymap_midi.h new file mode 100644 index 0000000000..b4c874eee9 --- /dev/null +++ b/keyboard/planck/keymap_midi.h @@ -0,0 +1,211 @@ +/* +Copyright 2015 Jack Humbert + +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, see . +*/ + +#ifndef KEYMAP_MIDI_H +#define KEYMAP_MIDI_H + +#define CHNL(note, channel) (note + (channel << 8)) + +#define N_CN1 (0x600C + (12 * -1) + 0 ) +#define N_CN1S (0x600C + (12 * -1) + 1 ) +#define N_DN1F (0x600C + (12 * -1) + 1 ) +#define N_DN1 (0x600C + (12 * -1) + 2 ) +#define N_DN1S (0x600C + (12 * -1) + 3 ) +#define N_EN1F (0x600C + (12 * -1) + 3 ) +#define N_EN1 (0x600C + (12 * -1) + 4 ) +#define N_FN1 (0x600C + (12 * -1) + 5 ) +#define N_FN1S (0x600C + (12 * -1) + 6 ) +#define N_GN1F (0x600C + (12 * -1) + 6 ) +#define N_GN1 (0x600C + (12 * -1) + 7 ) +#define N_GN1S (0x600C + (12 * -1) + 8 ) +#define N_AN1F (0x600C + (12 * -1) + 8 ) +#define N_AN1 (0x600C + (12 * -1) + 9 ) +#define N_AN1S (0x600C + (12 * -1) + 10) +#define N_BN1F (0x600C + (12 * -1) + 10) +#define N_BN1 (0x600C + (12 * -1) + 11) +#define N_C0 (0x600C + (12 * 0) + 0 ) +#define N_C0S (0x600C + (12 * 0) + 1 ) +#define N_D0F (0x600C + (12 * 0) + 1 ) +#define N_D0 (0x600C + (12 * 0) + 2 ) +#define N_D0S (0x600C + (12 * 0) + 3 ) +#define N_E0F (0x600C + (12 * 0) + 3 ) +#define N_E0 (0x600C + (12 * 0) + 4 ) +#define N_F0 (0x600C + (12 * 0) + 5 ) +#define N_F0S (0x600C + (12 * 0) + 6 ) +#define N_G0F (0x600C + (12 * 0) + 6 ) +#define N_G0 (0x600C + (12 * 0) + 7 ) +#define N_G0S (0x600C + (12 * 0) + 8 ) +#define N_A0F (0x600C + (12 * 0) + 8 ) +#define N_A0 (0x600C + (12 * 0) + 9 ) +#define N_A0S (0x600C + (12 * 0) + 10) +#define N_B0F (0x600C + (12 * 0) + 10) +#define N_B0 (0x600C + (12 * 0) + 11) +#define N_C1 (0x600C + (12 * 1) + 0 ) +#define N_C1S (0x600C + (12 * 1) + 1 ) +#define N_D1F (0x600C + (12 * 1) + 1 ) +#define N_D1 (0x600C + (12 * 1) + 2 ) +#define N_D1S (0x600C + (12 * 1) + 3 ) +#define N_E1F (0x600C + (12 * 1) + 3 ) +#define N_E1 (0x600C + (12 * 1) + 4 ) +#define N_F1 (0x600C + (12 * 1) + 5 ) +#define N_F1S (0x600C + (12 * 1) + 6 ) +#define N_G1F (0x600C + (12 * 1) + 6 ) +#define N_G1 (0x600C + (12 * 1) + 7 ) +#define N_G1S (0x600C + (12 * 1) + 8 ) +#define N_A1F (0x600C + (12 * 1) + 8 ) +#define N_A1 (0x600C + (12 * 1) + 9 ) +#define N_A1S (0x600C + (12 * 1) + 10) +#define N_B1F (0x600C + (12 * 1) + 10) +#define N_B1 (0x600C + (12 * 1) + 11) +#define N_C2 (0x600C + (12 * 2) + 0 ) +#define N_C2S (0x600C + (12 * 2) + 1 ) +#define N_D2F (0x600C + (12 * 2) + 1 ) +#define N_D2 (0x600C + (12 * 2) + 2 ) +#define N_D2S (0x600C + (12 * 2) + 3 ) +#define N_E2F (0x600C + (12 * 2) + 3 ) +#define N_E2 (0x600C + (12 * 2) + 4 ) +#define N_F2 (0x600C + (12 * 2) + 5 ) +#define N_F2S (0x600C + (12 * 2) + 6 ) +#define N_G2F (0x600C + (12 * 2) + 6 ) +#define N_G2 (0x600C + (12 * 2) + 7 ) +#define N_G2S (0x600C + (12 * 2) + 8 ) +#define N_A2F (0x600C + (12 * 2) + 8 ) +#define N_A2 (0x600C + (12 * 2) + 9 ) +#define N_A2S (0x600C + (12 * 2) + 10) +#define N_B2F (0x600C + (12 * 2) + 10) +#define N_B2 (0x600C + (12 * 2) + 11) +#define N_C3 (0x600C + (12 * 3) + 0 ) +#define N_C3S (0x600C + (12 * 3) + 1 ) +#define N_D3F (0x600C + (12 * 3) + 1 ) +#define N_D3 (0x600C + (12 * 3) + 2 ) +#define N_D3S (0x600C + (12 * 3) + 3 ) +#define N_E3F (0x600C + (12 * 3) + 3 ) +#define N_E3 (0x600C + (12 * 3) + 4 ) +#define N_F3 (0x600C + (12 * 3) + 5 ) +#define N_F3S (0x600C + (12 * 3) + 6 ) +#define N_G3F (0x600C + (12 * 3) + 6 ) +#define N_G3 (0x600C + (12 * 3) + 7 ) +#define N_G3S (0x600C + (12 * 3) + 8 ) +#define N_A3F (0x600C + (12 * 3) + 8 ) +#define N_A3 (0x600C + (12 * 3) + 9 ) +#define N_A3S (0x600C + (12 * 3) + 10) +#define N_B3F (0x600C + (12 * 3) + 10) +#define N_B3 (0x600C + (12 * 3) + 11) +#define N_C4 (0x600C + (12 * 4) + 0 ) +#define N_C4S (0x600C + (12 * 4) + 1 ) +#define N_D4F (0x600C + (12 * 4) + 1 ) +#define N_D4 (0x600C + (12 * 4) + 2 ) +#define N_D4S (0x600C + (12 * 4) + 3 ) +#define N_E4F (0x600C + (12 * 4) + 3 ) +#define N_E4 (0x600C + (12 * 4) + 4 ) +#define N_F4 (0x600C + (12 * 4) + 5 ) +#define N_F4S (0x600C + (12 * 4) + 6 ) +#define N_G4F (0x600C + (12 * 4) + 6 ) +#define N_G4 (0x600C + (12 * 4) + 7 ) +#define N_G4S (0x600C + (12 * 4) + 8 ) +#define N_A4F (0x600C + (12 * 4) + 8 ) +#define N_A4 (0x600C + (12 * 4) + 9 ) +#define N_A4S (0x600C + (12 * 4) + 10) +#define N_B4F (0x600C + (12 * 4) + 10) +#define N_B4 (0x600C + (12 * 4) + 11) +#define N_C5 (0x600C + (12 * 5) + 0 ) +#define N_C5S (0x600C + (12 * 5) + 1 ) +#define N_D5F (0x600C + (12 * 5) + 1 ) +#define N_D5 (0x600C + (12 * 5) + 2 ) +#define N_D5S (0x600C + (12 * 5) + 3 ) +#define N_E5F (0x600C + (12 * 5) + 3 ) +#define N_E5 (0x600C + (12 * 5) + 4 ) +#define N_F5 (0x600C + (12 * 5) + 5 ) +#define N_F5S (0x600C + (12 * 5) + 6 ) +#define N_G5F (0x600C + (12 * 5) + 6 ) +#define N_G5 (0x600C + (12 * 5) + 7 ) +#define N_G5S (0x600C + (12 * 5) + 8 ) +#define N_A5F (0x600C + (12 * 5) + 8 ) +#define N_A5 (0x600C + (12 * 5) + 9 ) +#define N_A5S (0x600C + (12 * 5) + 10) +#define N_B5F (0x600C + (12 * 5) + 10) +#define N_B5 (0x600C + (12 * 5) + 11) +#define N_C6 (0x600C + (12 * 6) + 0 ) +#define N_C6S (0x600C + (12 * 6) + 1 ) +#define N_D6F (0x600C + (12 * 6) + 1 ) +#define N_D6 (0x600C + (12 * 6) + 2 ) +#define N_D6S (0x600C + (12 * 6) + 3 ) +#define N_E6F (0x600C + (12 * 6) + 3 ) +#define N_E6 (0x600C + (12 * 6) + 4 ) +#define N_F6 (0x600C + (12 * 6) + 5 ) +#define N_F6S (0x600C + (12 * 6) + 6 ) +#define N_G6F (0x600C + (12 * 6) + 6 ) +#define N_G6 (0x600C + (12 * 6) + 7 ) +#define N_G6S (0x600C + (12 * 6) + 8 ) +#define N_A6F (0x600C + (12 * 6) + 8 ) +#define N_A6 (0x600C + (12 * 6) + 9 ) +#define N_A6S (0x600C + (12 * 6) + 10) +#define N_B6F (0x600C + (12 * 6) + 10) +#define N_B6 (0x600C + (12 * 6) + 11) +#define N_C7 (0x600C + (12 * 7) + 0 ) +#define N_C7S (0x600C + (12 * 7) + 1 ) +#define N_D7F (0x600C + (12 * 7) + 1 ) +#define N_D7 (0x600C + (12 * 7) + 2 ) +#define N_D7S (0x600C + (12 * 7) + 3 ) +#define N_E7F (0x600C + (12 * 7) + 3 ) +#define N_E7 (0x600C + (12 * 7) + 4 ) +#define N_F7 (0x600C + (12 * 7) + 5 ) +#define N_F7S (0x600C + (12 * 7) + 6 ) +#define N_G7F (0x600C + (12 * 7) + 6 ) +#define N_G7 (0x600C + (12 * 7) + 7 ) +#define N_G7S (0x600C + (12 * 7) + 8 ) +#define N_A7F (0x600C + (12 * 7) + 8 ) +#define N_A7 (0x600C + (12 * 7) + 9 ) +#define N_A7S (0x600C + (12 * 7) + 10) +#define N_B7F (0x600C + (12 * 7) + 10) +#define N_B7 (0x600C + (12 * 7) + 11) +#define N_C8 (0x600C + (12 * 8) + 0 ) +#define N_C8S (0x600C + (12 * 8) + 1 ) +#define N_D8F (0x600C + (12 * 8) + 1 ) +#define N_D8 (0x600C + (12 * 8) + 2 ) +#define N_D8S (0x600C + (12 * 8) + 3 ) +#define N_E8F (0x600C + (12 * 8) + 3 ) +#define N_E8 (0x600C + (12 * 8) + 4 ) +#define N_F8 (0x600C + (12 * 8) + 5 ) +#define N_F8S (0x600C + (12 * 8) + 6 ) +#define N_G8F (0x600C + (12 * 8) + 6 ) +#define N_G8 (0x600C + (12 * 8) + 7 ) +#define N_G8S (0x600C + (12 * 8) + 8 ) +#define N_A8F (0x600C + (12 * 8) + 8 ) +#define N_A8 (0x600C + (12 * 8) + 9 ) +#define N_A8S (0x600C + (12 * 8) + 10) +#define N_B8F (0x600C + (12 * 8) + 10) +#define N_B8 (0x600C + (12 * 8) + 11) +#define N_C8 (0x600C + (12 * 8) + 0 ) +#define N_C8S (0x600C + (12 * 8) + 1 ) +#define N_D8F (0x600C + (12 * 8) + 1 ) +#define N_D8 (0x600C + (12 * 8) + 2 ) +#define N_D8S (0x600C + (12 * 8) + 3 ) +#define N_E8F (0x600C + (12 * 8) + 3 ) +#define N_E8 (0x600C + (12 * 8) + 4 ) +#define N_F8 (0x600C + (12 * 8) + 5 ) +#define N_F8S (0x600C + (12 * 8) + 6 ) +#define N_G8F (0x600C + (12 * 8) + 6 ) +#define N_G8 (0x600C + (12 * 8) + 7 ) +#define N_G8S (0x600C + (12 * 8) + 8 ) +#define N_A8F (0x600C + (12 * 8) + 8 ) +#define N_A8 (0x600C + (12 * 8) + 9 ) +#define N_A8S (0x600C + (12 * 8) + 10) +#define N_B8F (0x600C + (12 * 8) + 10) +#define N_B8 (0x600C + (12 * 8) + 11) + +#endif \ No newline at end of file diff --git a/keyboard/planck/keymaps/keymap_angerthosenear.c b/keyboard/planck/keymaps/keymap_angerthosenear.c new file mode 100644 index 0000000000..cdf60632e4 --- /dev/null +++ b/keyboard/planck/keymaps/keymap_angerthosenear.c @@ -0,0 +1,50 @@ +#include "keymap_common.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* Qwerty */ + {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, 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_QUOT}, + {KC_LCTL, KC_LGUI, KC_LALT, BL_STEP, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + // Space is repeated to accommadate for both spacebar wiring positions +}, +[1] = { /* WASD + NumPad */ + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P7, KC_P8, KC_P9, KC_PSLS, KC_PMNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P4, KC_P5, KC_P6, KC_PAST, KC_PPLS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PDOT, KC_PENT, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_SPC, KC_P0, FUNC(1), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, +[2] = { /* RAISE */ + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS}, + {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, +[3] = { /* LOWER */ + {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_DEL}, + {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, + {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END} +} +}; + + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE + [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER + + [3] = ACTION_DEFAULT_LAYER_SET(0), + [4] = ACTION_DEFAULT_LAYER_SET(1), + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + return MACRODOWN(T(CM_T), END); + break; + } + return MACRO_NONE; +}; diff --git a/keyboard/planck/keymaps/keymap_austin.c b/keyboard/planck/keymaps/keymap_austin.c new file mode 100644 index 0000000000..49fc98a587 --- /dev/null +++ b/keyboard/planck/keymaps/keymap_austin.c @@ -0,0 +1,50 @@ +#include "keymap_common.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* Qwerty */ + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {BL_STEP, KC_LGUI, KC_LALT, KC_LCTL, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + // Space is repeated to accommadate for both spacebar wiring positions +}, +[1] = { /* Colemak */ + {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, + {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {KC_FN3, KC_LGUI, KC_LALT, KC_LCTL, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, +[2] = { /* RAISE */ + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, +[3] = { /* LOWER */ + {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, + {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +} +}; + + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE + [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER + + [3] = ACTION_DEFAULT_LAYER_SET(0), + [4] = ACTION_DEFAULT_LAYER_SET(1), + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + return MACRODOWN(T(CM_T), END); + break; + } + return MACRO_NONE; +}; diff --git a/keyboard/planck/keymaps/keymap_charlie.c b/keyboard/planck/keymaps/keymap_charlie.c new file mode 100644 index 0000000000..88f454d789 --- /dev/null +++ b/keyboard/planck/keymaps/keymap_charlie.c @@ -0,0 +1,54 @@ +#include "keymap_common.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = { /* Native */ + {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, FUNC(2)}, + {KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {KC_TAB, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {KC_DEL, KC_LCTL, KC_NO, KC_LSFT, KC_LALT, KC_SPC, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + [1] = { /* QWERTY->PHOTOSHOP */ + {KC_DELETE, KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, FUNC(1)}, + {KC_O, KC_G, KC_S, KC_U, KC_T, FUNC(27), KC_F21, KC_F10, KC_F11, KC_F7, KC_F8, KC_F9}, + {KC_TAB, FUNC(4), FUNC(5), FUNC(6), KC_F1, FUNC(7), KC_F18, KC_F19, KC_F23, KC_F20, KC_F22, FUNC(9)}, + {KC_COMM, KC_DOT, KC_R, FUNC(11), FUNC(3), KC_SPC, FUNC(12), KC_F2, FUNC(8), KC_F3, KC_F14} + }, + [2] = { /* 2: FUNC(3 PHOTOSHOP */ + {KC_ESC, FUNC(25), FUNC(26), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, FUNC(19), FUNC(20), FUNC(21)}, + {KC_C, KC_NO, FUNC(22), FUNC(5), KC_NO, FUNC(23), KC_NO, KC_NO, KC_NO, KC_NO, FUNC(13), KC_NO}, + {FUNC(14), FUNC(15), FUNC(16), FUNC(17), FUNC(3), KC_SPC, FUNC(18), KC_NO, KC_NO, KC_F24, KC_NO} + } +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_DEFAULT_LAYER_SET(0), // set Qwerty layout + [2] = ACTION_DEFAULT_LAYER_SET(1), // set Photoshop presets + [3] = ACTION_LAYER_MOMENTARY(2), // Photoshop function layer + + [4] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F9), // photo folder AHK + [5] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_I), // select inverse + [6] = ACTION_MODS_KEY(MOD_LSFT, KC_M), // marquee select + [7] = ACTION_MODS_KEY(MOD_LALT, KC_BSPC), // fill + [8] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_X), // warp + [9] = ACTION_MODS_KEY(MOD_LCTL | MOD_LALT | MOD_LSFT, KC_F12), // merge all new layer + [10] = ACTION_MODS_KEY(MOD_LCTL, KC_MINS), // zoom out + [11] = ACTION_MODS_KEY(MOD_LCTL, KC_H), // RBG sliders + [12] = ACTION_MODS_KEY(MOD_LCTL, KC_S), // save + [13] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_F5), // layer mask from transparancy + [14] = ACTION_MODS_KEY(MOD_LCTL, KC_F2), // stroke + [15] = ACTION_MODS_KEY(MOD_LCTL | MOD_LSFT, KC_F2), // stroke layer + [16] = ACTION_MODS_KEY(MOD_LCTL, KC_0), // zoom 0 + [17] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_H), // HSV sliders + [18] = ACTION_MODS_KEY(MOD_LCTL | MOD_LSFT, KC_S), // save as + [19] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F7), // gaussian blur + [20] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F8), // motion blur + [21] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_X), // liquify filter + [22] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS), // prev layer blending + [23] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_BSPC), // KC_NOrmal layer blending + [24] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL), // next layer blending + [25] = ACTION_MODS_KEY(MOD_LCTL, KC_Z), // step back + [26] = ACTION_MODS_KEY(MOD_LCTL, KC_Y), // step forward + [27] = ACTION_MODS_KEY(MOD_LCTL, KC_R), // rasterize + +}; diff --git a/keyboard/planck/keymaps/keymap_daniel.c b/keyboard/planck/keymaps/keymap_daniel.c new file mode 100644 index 0000000000..234e48ff4a --- /dev/null +++ b/keyboard/planck/keymaps/keymap_daniel.c @@ -0,0 +1,48 @@ +#include "keymap_common.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* Qwerty */ + {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT}, + {FUNC(3), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + // Space is repeated to accommadate for both spacebar wiring positions +}, +[1] = { /* RAISE */ + {KC_GRV, S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_EQL}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LBRC, KC_RBRC}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, S(KC_MINS), KC_BSLS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, +[2] = { /* LOWER */ + {S(KC_GRV), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, S(KC_EQL)}, + {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_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_ENT}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, +[3] = { /* Qwerty */ + {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL}, + {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {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_TRNS, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + // Space is repeated to accommadate for both spacebar wiring positions +} +}; + + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(1), // to RAISE + [2] = ACTION_LAYER_MOMENTARY(2), // to LOWER + [3] = ACTION_LAYER_MOMENTARY(3) // to LOWER +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + return MACRODOWN(T(CM_T), END); + break; + } + return MACRO_NONE; +}; diff --git a/keyboard/planck/keymaps/keymap_david.c b/keyboard/planck/keymaps/keymap_david.c new file mode 100644 index 0000000000..f483084801 --- /dev/null +++ b/keyboard/planck/keymaps/keymap_david.c @@ -0,0 +1,76 @@ +#include "keymap_common.h" +#include "beeps.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* Qwerty */ + {KC_Q, KC_W, KC_E, KC_R, KC_T, KC_BSPC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {KC_A, KC_S, KC_D, KC_F, KC_G, KC_ENT, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {KC_Z, KC_X, KC_C, KC_V, KC_B, KC_ESC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {M(10), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + // Space is repeated to accommadate for both spacebar wiring positions +}, +[1] = { /* Colemak */ + {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, + {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, +[2] = { /* RAISE */ + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), RESET, M(0), M(1), M(2), KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_TRNS, KC_F11, KC_F12, M(0), M(1), M(2), M(3), M(4), M(5), M(6), M(7), KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, +[3] = { /* LOWER */ + {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), RESET, M(0), M(1), M(2), S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, + {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +} +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE + [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER + + [3] = ACTION_DEFAULT_LAYER_SET(0), + [4] = ACTION_DEFAULT_LAYER_SET(1), + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + if (record->event.pressed) { + switch(id) { + case 0: + true_note(12, 12, 20); + break; + case 1: + true_note(14, 14, 20); + break; + case 2: + true_note(16, 16, 20); + break; + case 3: + true_note(17, 17, 20); + break; + case 4: + true_note(19, 19, 20); + break; + case 5: + true_note(21, 21, 20); + break; + case 6: + true_note(23, 23, 20); + break; + case 7: + true_note(24, 24, 20); + break; + case 10: + + break; + } + } + return MACRO_NONE; +}; diff --git a/keyboard/planck/keymaps/keymap_default.c b/keyboard/planck/keymaps/keymap_default.c index 7eb81b2027..f34cd9721f 100644 --- a/keyboard/planck/keymaps/keymap_default.c +++ b/keyboard/planck/keymaps/keymap_default.c @@ -18,13 +18,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }, [2] = { /* RAISE */ {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, - {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_TRNS, FUNC(3), FUNC(4), RESET, DEBUG, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, {KC_TRNS, KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} }, [3] = { /* LOWER */ {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, - {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, + {KC_TRNS, FUNC(3), FUNC(4), RESET, DEBUG, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} }, diff --git a/keyboard/planck/keymaps/keymap_dzobert.c b/keyboard/planck/keymaps/keymap_dzobert.c new file mode 100644 index 0000000000..665e9c20b6 --- /dev/null +++ b/keyboard/planck/keymaps/keymap_dzobert.c @@ -0,0 +1,49 @@ +#include "keymap_common.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* Qwerty */ + {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_TAB}, + {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_BSPC}, + {KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {KC_FN4, KC_RSFT, KC_LGUI, KC_LSFT, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + // Space is repeated to accommadate for both spacebar wiring positions +}, +[1] = { /* Colemak */ + {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_TAB}, + {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_BSPC}, + {KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {KC_FN3, KC_RSFT, KC_LGUI, KC_LSFT, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, +[2] = { /* RAISE */ + {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_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_DEL}, + {KC_TRNS, KC_GRV, KC_MINS, KC_EQL, KC_QUOT, S(KC_QUOT), S(KC_LBRC), S(KC_RBRC), KC_LBRC, KC_RBRC, KC_BSLS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_HOME, KC_PGUP, KC_PGDN, KC_END} +}, +[3] = { /* LOWER */ + {KC_POWER,KC_PSCR, KC_SLCK, KC_PAUSE, KC_NLCK, KC_EXECUTE, KC_MENU, KC_APP, KC_7, KC_8, KC_9, KC_KP_SLASH}, + {KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_CAPS, KC_CANCEL, KC_UNDO, KC_AGAIN, KC_4, KC_5, KC_6, KC_KP_ASTERISK}, + {KC_TRNS, KC_INSERT,KC_CUT, KC_COPY, KC_PASTE, KC_BSLS, KC_9, KC_0, KC_1, KC_2, KC_3, KC_KP_MINUS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_0, KC_KP_DOT, KC_KP_ENTER, KC_KP_PLUS} +} +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE + [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER + + [3] = ACTION_DEFAULT_LAYER_SET(0), + [4] = ACTION_DEFAULT_LAYER_SET(1), + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + return MACRODOWN(T(CM_T), END); + break; + } + return MACRO_NONE; +}; \ No newline at end of file diff --git a/keyboard/planck/keymaps/keymap_jack.c b/keyboard/planck/keymaps/keymap_jack.c new file mode 100644 index 0000000000..0b93bba33f --- /dev/null +++ b/keyboard/planck/keymaps/keymap_jack.c @@ -0,0 +1,50 @@ +#include "keymap_common.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* Jack soft-coded colemak */ + {KC_TAB, CM_Q, CM_W, CM_F, CM_P, CM_G, CM_J, CM_L, CM_U, CM_Y, CM_SCLN, KC_BSPC}, + {KC_ESC, CM_A, CM_R, CM_S, CM_T, CM_D, CM_H, CM_N, CM_E, CM_I, CM_O, KC_QUOT}, + {KC_LSFT, CM_Z, CM_X, CM_C, CM_V, CM_B, CM_K, CM_M, CM_COMM, CM_DOT, CM_SLSH, KC_ENT}, + {BL_STEP, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + // Space is repeated to accommadate for both spacebar wiring positions +}, +[1] = { /* Jack hard-coded colemak */ + {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, + {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, +[2] = { /* Jack RAISE */ + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, +[3] = { /* Jack LOWER */ + {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, + {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +} +}; + + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(2), // to Fn overlay + [2] = ACTION_LAYER_MOMENTARY(3), // to Fn overlay + + [3] = ACTION_DEFAULT_LAYER_SET(0), + [4] = ACTION_DEFAULT_LAYER_SET(1), + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + return MACRODOWN(T(CM_T), END); + break; + } + return MACRO_NONE; +}; diff --git a/keyboard/planck/keymaps/keymap_joe.c b/keyboard/planck/keymaps/keymap_joe.c new file mode 100644 index 0000000000..157f940869 --- /dev/null +++ b/keyboard/planck/keymaps/keymap_joe.c @@ -0,0 +1,88 @@ +#include "keymap_common.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = { /* Joe colemak */ + {F(3), KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS}, + {KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT }, + {F(15), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT}, + {KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, F(1), KC_SPC, KC_SPC, F(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + }, + [1] = { /* Joe soft Colemak */ + {F(3), CM_Q, CM_W, CM_F, CM_P, CM_G, CM_J, CM_L, CM_U, CM_Y, CM_SCLN, KC_MINS}, + {KC_BSPC, CM_A, CM_R, CM_S, CM_T, CM_D, CM_H, CM_N, CM_E, CM_I, CM_O, KC_ENT }, + {F(15), CM_Z, CM_X, CM_C, CM_V, CM_B, CM_K, CM_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT}, + {KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, F(1), KC_SPC, KC_SPC, F(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + }, + [2] = { /* Joe NUMPAD */ + {F(3), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, LSFT(KC_9), LSFT(KC_0), KC_P7, KC_P8, KC_P9, KC_PSLS}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, LSFT(KC_5), KC_PEQL, KC_P4, KC_P5, KC_P6, KC_PAST}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_PCMM, KC_P1, KC_P2, KC_P3, KC_PMNS}, + {KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, F(1), KC_TRNS, KC_TRNS, F(2), KC_P0, KC_PDOT, KC_PENT, KC_PPLS} + }, + [3] = { /* Joe 1337 haxOr5*/ + {F(3), KC_Q, KC_W, KC_F, KC_P, KC_6, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS}, + {KC_BSPC, KC_4, KC_R, KC_5, KC_7, KC_D, KC_H, KC_N, KC_3, KC_1, KC_0, KC_ENT }, + {F(15), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT}, + {KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, F(1), KC_SPC, KC_SPC, F(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + }, + [4] = { /* Joe LOWER fn1 */ + {KC_GRV, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, M(3), M(2), M(1), M(0) }, + {KC_BSPC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS}, + {KC_BSLS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LBRC, KC_RBRC, KC_EQL }, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(1), KC_TRNS, KC_TRNS, F(2), KC_HOME, KC_PGDN, KC_PGUP, KC_END } + }, + [5] = { /* Joe UPPER fn2 */ + {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, KC_BTN1, KC_MS_U, KC_BTN2, KC_BTN3, KC_WH_U, KC_BTN4, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO }, + {KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_L, KC_WH_D, KC_WH_R, KC_NO, KC_NO, KC_NO, LCTL(KC_PGUP), LCTL(KC_PGDN) }, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(1), KC_NO, KC_NO, F(2), LCTL(LALT(KC_LEFT)), LCTL(LALT(KC_DOWN)), LCTL(LALT(KC_UP)), LCTL(LALT(KC_RGHT))} + }, + [6] = { /* Joe SPECIAL fn3 */ + {KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, + {KC_NO, KC_MPLY, KC_MPRV, KC_MNXT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RESET }, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, + {F(6), F(7), F(8), F(9), F(1), KC_TRNS, KC_TRNS, F(2), KC_POWER, KC_WAKE, KC_SLEP, LCTL(LALT(KC_L))} + } +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(4), // fn1 + [2] = ACTION_LAYER_MOMENTARY(5), // fn2 + + /* ESC on tap, fn3 on hold */ + [3] = ACTION_LAYER_TAP_KEY(6, KC_ESC), + + /* toggle layers */ + [6] = ACTION_DEFAULT_LAYER_SET(0), + [7] = ACTION_DEFAULT_LAYER_SET(1), + [8] = ACTION_DEFAULT_LAYER_SET(2), + [9] = ACTION_DEFAULT_LAYER_SET(3), + + /* tab on tap, shift on hold */ + [15] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_TAB), +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + switch (id) { + case 0: + /* :) */ + return MACRODOWN( DOWN(KC_LSFT), TYPE(KC_SCLN), TYPE(KC_0), UP(KC_LSFT), END ); + break; + case 1: + /* :( */ + return MACRODOWN( DOWN(KC_LSFT), TYPE(KC_SCLN), TYPE(KC_9), UP(KC_LSFT), END ); + break; + case 2: + /* (: | :) */ + return MACRODOWN( DOWN(KC_LSFT), TYPE(KC_9), TYPE(KC_SCLN), TYPE(KC_SPC), TYPE(KC_SPC), TYPE(KC_SCLN), TYPE(KC_0), UP(KC_LSFT), TYPE(KC_LEFT), TYPE(KC_LEFT), TYPE(KC_LEFT), END ); + break; + case 3: + /* :( | ): */ + return MACRODOWN( DOWN(KC_LSFT), TYPE(KC_SCLN), TYPE(KC_9), TYPE(KC_SPC), TYPE(KC_SPC), TYPE(KC_0), TYPE(KC_SCLN), UP(KC_LSFT), TYPE(KC_LEFT), TYPE(KC_LEFT), TYPE(KC_LEFT), END ); + break; + default: + break; + } + return MACRO_NONE; +} diff --git a/keyboard/planck/keymaps/keymap_kyle.c b/keyboard/planck/keymaps/keymap_kyle.c new file mode 100644 index 0000000000..da32b74f96 --- /dev/null +++ b/keyboard/planck/keymaps/keymap_kyle.c @@ -0,0 +1,49 @@ +#include "keymap_common.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* Qwerty */ + {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {KC_RCTL, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + // Space is repeated to accommadate for both spacebar wiring positions +}, +[1] = { /* Colemak */ + {KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, + {KC_TAB, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, +[2] = { /* RAISE */ + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, +[3] = { /* LOWER */ + {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), LSFT(RSFT(KC_D)), KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, + {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, + {BL_STEP, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +} +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE + [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER + + [3] = ACTION_DEFAULT_LAYER_SET(0), + [4] = ACTION_DEFAULT_LAYER_SET(1), + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + return MACRODOWN(T(CM_T), END); + break; + } + return MACRO_NONE; +}; diff --git a/keyboard/planck/keymaps/keymap_leo.c b/keyboard/planck/keymaps/keymap_leo.c new file mode 100644 index 0000000000..6d66441822 --- /dev/null +++ b/keyboard/planck/keymaps/keymap_leo.c @@ -0,0 +1,46 @@ +#include "keymap_common.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* BASE */ + {KC_ESC, KC_LBRC, KC_QUOT, KC_SCLN, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, + {KC_TAB, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENT}, + {KC_LSFT, KC_DOT, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_COMM}, + {KC_LCTL, KC_LALT, KC_LGUI, FUNC(3), FUNC(2), KC_SPC, KC_SPC, FUNC(1), FUNC(3), KC_RGUI, KC_RALT, KC_RCTL} +}, +[2] = { /* RAISE */ + {RALT(KC_RBRC), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, S(KC_RBRC)}, + {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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, +[3] = { /* LOWER */ + {S(KC_EQL),S(KC_1),S(KC_2),S(KC_3),RALT(KC_5),S(KC_5), S(KC_6), S(KC_7),RALT(KC_7),RALT(KC_0),S(KC_0), KC_MINS}, + {KC_TRNS,RALT(KC_2),S(KC_SLSH),KC_NUBS,S(KC_NUBS),RALT(KC_MINS),RALT(KC_NUBS), KC_NUHS, S(KC_8), S(KC_9), S(KC_MINS), KC_SLSH}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RALT(KC_8), RALT(KC_9), KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, +[4] = { /* META */ + {KC_TRNS, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_DEL}, + {KC_TRNS, KC_RGHT, KC_DOWN, KC_LEFT, KC_PGUP, KC_TRNS, KC_PGUP, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGDN, KC_TRNS, KC_PGDN, KC_TRNS, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +} +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE + [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER + [3] = ACTION_LAYER_MOMENTARY(4), // to META + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + return MACRODOWN(T(CM_T), END); + break; + } + return MACRO_NONE; +}; diff --git a/keyboard/planck/keymaps/keymap_lock.c b/keyboard/planck/keymaps/keymap_lock.c new file mode 100644 index 0000000000..689670ccab --- /dev/null +++ b/keyboard/planck/keymaps/keymap_lock.c @@ -0,0 +1,72 @@ +#include "keymap_common.h" +#include "backlight.h" +#include "action_layer.h" +#include "keymap_midi.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* Qwerty */ + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {M(0), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + // Space is repeated to accommadate for both spacebar wiring positions +}, +[1] = { /* Colemak */ + {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, + {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, +[2] = { /* RAISE */ + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_TRNS, KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, +[3] = { /* LOWER */ + {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, + {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, +[4] = { /* TENKEY */ + {KC_TAB, N_C5, N_D5, N_E5, N_F5, N_G5, N_A5, KC_KP_7, KC_KP_8, KC_KP_9, KC_P, KC_BSPC}, + {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_KP_4, KC_KP_5, KC_KP_6, KC_SCLN, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_KP_1, KC_KP_2, KC_KP_3, KC_SLSH, KC_ENT}, + {KC_TRNS, KC_LCTL, KC_LALT, KC_LGUI, KC_TRNS, KC_SPC, KC_SPC, KC_KP_0, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, +[5] = { /* MIDI */ + {CHNL(N_C5, 0), CHNL(N_D5, 0),CHNL(N_E5, 0),CHNL(N_F5, 0),CHNL(N_G5, 0),CHNL(N_A5, 0),CHNL(N_B5, 0),CHNL(N_C6, 0), CHNL(N_D6, 0), CHNL(N_E6, 0), CHNL(N_F6, 0),CHNL(N_G6, 0)}, + {CHNL(N_C5, 2), CHNL(N_D5, 2),CHNL(N_E5, 2),CHNL(N_F5, 2),CHNL(N_G5, 2),CHNL(N_A5, 2),CHNL(N_B5, 2),CHNL(N_C6, 2), CHNL(N_D6, 2), CHNL(N_E6, 2), CHNL(N_F6, 2),CHNL(N_G6, 2)}, + {CHNL(N_C5, 4), CHNL(N_D5, 4),CHNL(N_E5, 4),CHNL(N_F5, 4),CHNL(N_G5, 4),CHNL(N_A5, 4),CHNL(N_B5, 4),CHNL(N_C6, 4), CHNL(N_D6, 4), CHNL(N_E6, 4), CHNL(N_F6, 4),CHNL(N_G6, 4)}, + {KC_TRNS, KC_LCTL, KC_LALT, KC_LGUI, KC_TRNS, KC_SPC, KC_SPC, KC_KP_0, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +} +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE + [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER + + [3] = ACTION_DEFAULT_LAYER_SET(0), + [4] = ACTION_DEFAULT_LAYER_SET(1), + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + // register_code(KC_RSFT); + backlight_set(BACKLIGHT_LEVELS); + layer_on(5); + } else { + // unregister_code(KC_RSFT); + backlight_set(0); + layer_clear(); + } + break; + } + return MACRO_NONE; +}; diff --git a/keyboard/planck/keymaps/keymap_max.c b/keyboard/planck/keymaps/keymap_max.c new file mode 100644 index 0000000000..7fb29bc7a4 --- /dev/null +++ b/keyboard/planck/keymaps/keymap_max.c @@ -0,0 +1,49 @@ +#include "keymap_common.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* Qwerty */ + {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, 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_QUOT}, + {KC_LCTL, BL_STEP, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + // Space is repeated to accommadate for both spacebar wiring positions +}, +[1] = { /* Colemak */ + {KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, + {KC_TAB, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT }, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT}, + {KC_LCTL, BL_STEP, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, +[2] = { /* RAISE */ + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_TRNS}, + {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_BSLS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, +[3] = { /* LOWER */ + {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), KC_TRNS}, + {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, S(KC_BSLS)}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +} +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE + [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER + + [3] = ACTION_DEFAULT_LAYER_SET(0), + [4] = ACTION_DEFAULT_LAYER_SET(1), + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + return MACRODOWN(T(CM_T), END); + break; + } + return MACRO_NONE; +}; diff --git a/keyboard/planck/keymaps/keymap_numpad.c b/keyboard/planck/keymaps/keymap_numpad.c new file mode 100644 index 0000000000..7de4372ab0 --- /dev/null +++ b/keyboard/planck/keymaps/keymap_numpad.c @@ -0,0 +1,26 @@ +#include "keymap_common.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* Qwerty */ + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_KP_MINUS, KC_KP_PLUS, KC_KP_PLUS, KC_KP_ENTER, KC_KP_ENTER}, + {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_KP_ASTERISK, KC_KP_9, KC_KP_6, KC_KP_3, KC_KP_DOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_KP_SLASH, KC_KP_8, KC_KP_5, KC_KP_2, KC_KP_0}, + {BL_STEP, KC_LCTL, KC_LALT, KC_LGUI, KC_NO, KC_SPC, KC_SPC, KC_NUMLOCK, KC_KP_7, KC_KP_4, KC_KP_1, KC_KP_0} + // Space is repeated to accommadate for both spacebar wiring positions +} +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + return MACRODOWN(T(CM_T), END); + break; + } + return MACRO_NONE; +}; \ No newline at end of file diff --git a/keyboard/preonic/extended_keymaps/extended_keymap_default.c b/keyboard/preonic/extended_keymaps/extended_keymap_default.c index c75144bf4a..b52f60fd08 100644 --- a/keyboard/preonic/extended_keymaps/extended_keymap_default.c +++ b/keyboard/preonic/extended_keymaps/extended_keymap_default.c @@ -5,6 +5,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = { /* Qwerty */ + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL}, {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, @@ -12,24 +13,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Space is repeated to accommadate for both spacebar wiring positions }, [1] = { /* Colemak */ + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL}, {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, {KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, [2] = { /* RAISE */ + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL}, {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, {KC_TRNS, KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} }, [3] = { /* LOWER */ + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL}, {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} }, [4] = { /* TENKEY */ + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL}, {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_KP_7, KC_KP_8, KC_KP_9, KC_P, KC_BSPC}, {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_KP_4, KC_KP_5, KC_KP_6, KC_SCLN, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_KP_1, KC_KP_2, KC_KP_3, KC_SLSH, KC_ENT}, diff --git a/protocol/lufa.mk b/protocol/lufa.mk index 561c505c22..088fd377e0 100644 --- a/protocol/lufa.mk +++ b/protocol/lufa.mk @@ -1,11 +1,11 @@ LUFA_DIR = protocol/lufa # Path to the LUFA library -ifeq (, $(wildcard $(TOP_DIR)/$(LUFA_DIR)/LUFA-git/LUFA/Version.h)) - LUFA_PATH ?= $(LUFA_DIR)/LUFA-120730 -else +#ifeq (, $(wildcard $(TOP_DIR)/$(LUFA_DIR)/LUFA-git/LUFA/Version.h)) +# LUFA_PATH ?= $(LUFA_DIR)/LUFA-120730 +#else LUFA_PATH ?= $(LUFA_DIR)/LUFA-git -endif +#endif # Create the LUFA source path variables by including the LUFA makefile @@ -19,14 +19,15 @@ endif LUFA_SRC = $(LUFA_DIR)/lufa.c \ $(LUFA_DIR)/descriptor.c \ - $(LUFA_SRC_USB) \ - $(LUFA_DIR)/midi/midi.c \ + $(LUFA_SRC_USB) + +ifdef MIDI_ENABLE + LUFA_SRC += $(LUFA_DIR)/midi/midi.c \ $(LUFA_DIR)/midi/midi_device.c \ $(LUFA_DIR)/midi/bytequeue/bytequeue.c \ $(LUFA_DIR)/midi/bytequeue/interrupt_setting.c \ - $(LUFA_SRC_USB) \ $(LUFA_SRC_USBCLASS) - +endif SRC += $(LUFA_SRC) diff --git a/protocol/lufa/descriptor.c b/protocol/lufa/descriptor.c index 8a14c5e09f..5454926b18 100644 --- a/protocol/lufa/descriptor.c +++ b/protocol/lufa/descriptor.c @@ -492,7 +492,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = MIDI_INTERFACE, + .InterfaceNumber = AC_INTERFACE, .AlternateSetting = 0, .TotalEndpoints = 0, @@ -513,14 +513,14 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .TotalLength = sizeof(USB_Audio_Descriptor_Interface_AC_t), .InCollection = 1, - .InterfaceNumber = MIDI2_INTERFACE, + .InterfaceNumber = AS_INTERFACE, }, .Audio_StreamInterface = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - .InterfaceNumber = MIDI2_INTERFACE, + .InterfaceNumber = AS_INTERFACE, .AlternateSetting = 0, .TotalEndpoints = 2, @@ -601,7 +601,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint}, - .EndpointAddress = (ENDPOINT_DIR_IN | MIDI_STREAM_IN_EPNUM), + .EndpointAddress = MIDI_STREAM_OUT_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = MIDI_STREAM_EPSIZE, .PollingIntervalMS = 0x05 @@ -626,7 +626,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint}, - .EndpointAddress = (ENDPOINT_DIR_OUT | MIDI_STREAM_OUT_EPNUM), + .EndpointAddress = MIDI_STREAM_IN_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = MIDI_STREAM_EPSIZE, .PollingIntervalMS = 0x05 diff --git a/protocol/lufa/descriptor.h b/protocol/lufa/descriptor.h index 0471ef31de..4fd81a0e87 100644 --- a/protocol/lufa/descriptor.h +++ b/protocol/lufa/descriptor.h @@ -135,14 +135,14 @@ typedef struct #endif #ifdef MIDI_ENABLE -# define MIDI_INTERFACE (NKRO_INTERFACE + 1) -# define MIDI2_INTERFACE (NKRO_INTERFACE + 2) +# define AC_INTERFACE (NKRO_INTERFACE + 1) +# define AS_INTERFACE (NKRO_INTERFACE + 2) #else -# define MIDI2_INTERFACE NKRO_INTERFACE +# define AS_INTERFACE NKRO_INTERFACE #endif /* nubmer of interfaces */ -#define TOTAL_INTERFACES MIDI2_INTERFACE + 1 +#define TOTAL_INTERFACES AS_INTERFACE + 1 // Endopoint number and size @@ -170,20 +170,23 @@ typedef struct #ifdef NKRO_ENABLE # define NKRO_IN_EPNUM (CONSOLE_OUT_EPNUM + 1) -# if defined(__AVR_ATmega32U2__) && NKRO_IN_EPNUM > 4 -# error "Endpoints are not available enough to support all functions. Remove some in Makefile.(MOUSEKEY, EXTRAKEY, CONSOLE, NKRO)" -# endif +#else +# define NKRO_IN_EPNUM CONSOLE_OUT_EPNUM #endif #ifdef MIDI_ENABLE -# define MIDI_STREAM_IN_EPNUM (NKRO_IN_EPNUM + 1) -# define MIDI_STREAM_OUT_EPNUM (NKRO_IN_EPNUM + 1) -#else -# define MIDI_STREAM_IN_EPNUM NKRO_IN_EPNUM -# define MIDI_STREAM_OUT_EPNUM NKRO_IN_EPNUM +# define MIDI_STREAM_IN_EPNUM (NKRO_IN_EPNUM + 1) +// # define MIDI_STREAM_OUT_EPNUM (NKRO_IN_EPNUM + 1) +# define MIDI_STREAM_OUT_EPNUM (NKRO_IN_EPNUM + 2) +# define MIDI_STREAM_IN_EPADDR (ENDPOINT_DIR_IN | MIDI_STREAM_IN_EPNUM) +# define MIDI_STREAM_OUT_EPADDR (ENDPOINT_DIR_OUT | MIDI_STREAM_OUT_EPNUM) #endif +#if defined(__AVR_ATmega32U2__) && MIDI_STREAM_OUT_EPADDR > 4 +# error "Endpoints are not available enough to support all functions. Remove some in Makefile.(MOUSEKEY, EXTRAKEY, CONSOLE, NKRO, MIDI)" +#endif + #define KEYBOARD_EPSIZE 8 #define MOUSE_EPSIZE 8 #define EXTRAKEY_EPSIZE 8 diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c index 78ed6cfe20..e9f335a632 100644 --- a/protocol/lufa/lufa.c +++ b/protocol/lufa/lufa.c @@ -92,20 +92,21 @@ host_driver_t lufa_driver = { void SetupHardware(void); +#ifdef MIDI_ENABLE USB_ClassInfo_MIDI_Device_t USB_MIDI_Interface = { .Config = { - .StreamingInterfaceNumber = MIDI2_INTERFACE, + .StreamingInterfaceNumber = AS_INTERFACE, .DataINEndpoint = { - .Address = (ENDPOINT_DIR_IN | MIDI_STREAM_IN_EPNUM), + .Address = MIDI_STREAM_IN_EPADDR, .Size = MIDI_STREAM_EPSIZE, .Banks = 1, }, .DataOUTEndpoint = { - .Address = (ENDPOINT_DIR_OUT | MIDI_STREAM_OUT_EPNUM), + .Address = MIDI_STREAM_OUT_EPADDR, .Size = MIDI_STREAM_EPSIZE, .Banks = 1, }, @@ -120,7 +121,7 @@ USB_ClassInfo_MIDI_Device_t USB_MIDI_Interface = #define SYS_COMMON_1 0x50 #define SYS_COMMON_2 0x20 #define SYS_COMMON_3 0x30 - +#endif /******************************************************************************* @@ -291,12 +292,10 @@ void EVENT_USB_Device_ConfigurationChanged(void) #endif #ifdef MIDI_ENABLE - ConfigSuccess &= MIDI_Device_ConfigureEndpoints(&USB_MIDI_Interface); - - // ConfigSuccess &= ENDPOINT_CONFIG(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN, - // MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE); - // ConfigSuccess &= ENDPOINT_CONFIG(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT, - // MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE); + ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPADDR, EP_TYPE_BULK, MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE); + ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPADDR, EP_TYPE_BULK, MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE); + // ConfigSuccess &= MIDI_Device_ConfigureEndpoints(&USB_MIDI_Interface); + #endif } @@ -324,7 +323,7 @@ void EVENT_USB_Device_ControlRequest(void) uint8_t* ReportData = NULL; uint8_t ReportSize = 0; - MIDI_Device_ProcessControlRequest(&USB_MIDI_Interface); + // MIDI_Device_ProcessControlRequest(&USB_MIDI_Interface); /* Handle HID Class specific requests */ switch (USB_ControlRequest.bRequest) @@ -706,6 +705,74 @@ void midi_usb_init(MidiDevice * device){ SetupHardware(); sei(); } + +void MIDI_Task(void) +{ + + /* Device must be connected and configured for the task to run */ + dprint("in MIDI_TASK\n"); + if (USB_DeviceState != DEVICE_STATE_Configured) + return; + dprint("continuing in MIDI_TASK\n"); + + Endpoint_SelectEndpoint(MIDI_STREAM_IN_EPADDR); + + if (Endpoint_IsINReady()) + { + + dprint("Endpoint is ready\n"); + + uint8_t MIDICommand = 0; + uint8_t MIDIPitch; + + /* Get board button status - if pressed use channel 10 (percussion), otherwise use channel 1 */ + uint8_t Channel = MIDI_CHANNEL(1); + + MIDICommand = MIDI_COMMAND_NOTE_ON; + MIDIPitch = 0x3E; + + /* Check if a MIDI command is to be sent */ + if (MIDICommand) + { + dprint("Command exists\n"); + MIDI_EventPacket_t MIDIEvent = (MIDI_EventPacket_t) + { + .Event = MIDI_EVENT(0, MIDICommand), + + .Data1 = MIDICommand | Channel, + .Data2 = MIDIPitch, + .Data3 = MIDI_STANDARD_VELOCITY, + }; + + /* Write the MIDI event packet to the endpoint */ + Endpoint_Write_Stream_LE(&MIDIEvent, sizeof(MIDIEvent), NULL); + + /* Send the data in the endpoint to the host */ + Endpoint_ClearIN(); + } + } + + + /* Select the MIDI OUT stream */ + Endpoint_SelectEndpoint(MIDI_STREAM_OUT_EPADDR); + + /* Check if a MIDI command has been received */ + if (Endpoint_IsOUTReceived()) + { + MIDI_EventPacket_t MIDIEvent; + + /* Read the MIDI event packet from the endpoint */ + Endpoint_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent), NULL); + + /* If the endpoint is now empty, clear the bank */ + if (!(Endpoint_BytesInEndpoint())) + { + /* Clear the endpoint ready for new packet */ + Endpoint_ClearOUT(); + } + } +} + #endif @@ -761,10 +828,10 @@ int main(void) midi_register_cc_callback(&midi_device, cc_callback); midi_register_sysex_callback(&midi_device, sysex_callback); - midi_send_cc(&midi_device, 0, 1, 2); - midi_send_cc(&midi_device, 15, 1, 0); - midi_send_noteon(&midi_device, 0, 64, 127); - midi_send_noteoff(&midi_device, 0, 64, 127); + // midi_send_cc(&midi_device, 0, 1, 2); + // midi_send_cc(&midi_device, 15, 1, 0); + // midi_send_noteon(&midi_device, 0, 64, 127); + // midi_send_noteoff(&midi_device, 0, 64, 127); #endif @@ -795,12 +862,14 @@ int main(void) } } - keyboard_task(); - #ifdef MIDI_ENABLE midi_device_process(&midi_device); + // MIDI_Task(); #endif + keyboard_task(); + + #if !defined(INTERRUPT_CONTROL_ENDPOINT) USB_USBTask(); #endif diff --git a/protocol/lufa/lufa.h b/protocol/lufa/lufa.h index 554d82ae5f..8bcd8503a6 100644 --- a/protocol/lufa/lufa.h +++ b/protocol/lufa/lufa.h @@ -68,17 +68,18 @@ typedef struct { } __attribute__ ((packed)) report_extra_t; #ifdef MIDI_ENABLE +void MIDI_Task(void); MidiDevice midi_device; #endif -#if LUFA_VERSION_INTEGER < 0x120730 - /* old API 120219 */ - #define ENDPOINT_CONFIG(epnum, eptype, epdir, epsize, epbank) Endpoint_ConfigureEndpoint(epnum, eptype, epdir, epsize, epbank) -#else +// #if LUFA_VERSION_INTEGER < 0x120730 +// /* old API 120219 */ +// #define ENDPOINT_CONFIG(epnum, eptype, epdir, epsize, epbank) Endpoint_ConfigureEndpoint(epnum, eptype, epdir, epsize, epbank) +// #else /* new API >= 120730 */ #define ENDPOINT_BANK_SINGLE 1 #define ENDPOINT_BANK_DOUBLE 2 #define ENDPOINT_CONFIG(epnum, eptype, epdir, epsize, epbank) Endpoint_ConfigureEndpoint((epdir) | (epnum) , eptype, epsize, epbank) -#endif +// #endif #endif