From ccaacde4d663f50b04fcd67d1477db7e0bd46091 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Wed, 17 Jan 2018 11:28:23 -0800 Subject: [PATCH 001/173] Update to drashna keymaps (#2281) * Move faux clicky into userspace * Get Audio and RGB enabled on Orthodox-rev1 * Add faux click to userspace * Add Orthodox Rev3 check to macros * Hack Orthodox Name for drashna keymap * No more One Shots * Ergodox product name hack * Enable Audio on Orthodox by default --- keyboards/ergodox_ez/keymaps/drashna/config.h | 3 ++ keyboards/ergodox_ez/keymaps/drashna/keymap.c | 8 ++--- keyboards/orthodox/keymaps/drashna/config.h | 8 ++++- keyboards/orthodox/keymaps/drashna/keymap.c | 22 +++--------- keyboards/orthodox/keymaps/drashna/rules.mk | 10 ++++-- users/drashna/drashna.c | 35 +++++++++++++++---- users/drashna/drashna.h | 9 +++++ 7 files changed, 63 insertions(+), 32 deletions(-) diff --git a/keyboards/ergodox_ez/keymaps/drashna/config.h b/keyboards/ergodox_ez/keymaps/drashna/config.h index c0286f16..2f5422b1 100644 --- a/keyboards/ergodox_ez/keymaps/drashna/config.h +++ b/keyboards/ergodox_ez/keymaps/drashna/config.h @@ -20,4 +20,7 @@ #define IGNORE_MOD_TAP_INTERRUPT // this makes it possible to do rolling combos (zx) with keys that convert to other keys on hold (z becomes ctrl when you hold it, and when this option isn't enabled, z rapidly followed by x actually sends Ctrl-x. That's bad.) #define ONESHOT_TAP_TOGGLE 2 +#undef PRODUCT +#define PRODUCT DrashnaDox - Hacked ErgoDox EZ Shine + #endif diff --git a/keyboards/ergodox_ez/keymaps/drashna/keymap.c b/keyboards/ergodox_ez/keymaps/drashna/keymap.c index c7939de3..0d0e1fba 100644 --- a/keyboards/ergodox_ez/keymaps/drashna/keymap.c +++ b/keyboards/ergodox_ez/keymaps/drashna/keymap.c @@ -52,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_EQUAL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(_MOUS), KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(_DIABLO), KC_BSPACE, KC_A, KC_S, KC_D, KC_F, KC_G, - OSM(MOD_LSFT), LCTL_T(KC_Z),KC_X, KC_C, KC_V, KC_B, TG(_GAMEPAD), + KC_LSFT, LCTL_T(KC_Z),KC_X, KC_C, KC_V, KC_B, TG(_GAMEPAD), LT(_SYMB,KC_GRAVE),KC_QUOTE, KC_LGUI, KC_LBRACKET,KC_RBRACKET, ALT_T(KC_APPLICATION), KC_LGUI, @@ -96,7 +96,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(_MOUS), KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, TG(_DIABLO), KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, - OSM(MOD_LSFT), LCTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, TG(_GAMEPAD), + KC_LSFT, LCTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, TG(_GAMEPAD), LT(_SYMB,KC_GRV),KC_QUOT, KC_LGUI, KC_LBRACKET,KC_RBRACKET, ALT_T(KC_APP), KC_LGUI, KC_HOME, @@ -139,7 +139,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(_MOUS), KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, TG(_DIABLO), KC_BSPC, KC_A, KC_O, KC_E, KC_U, KC_I, - OSM(MOD_LSFT), LCTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, TG(_GAMEPAD), + KC_LSFT, LCTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, TG(_GAMEPAD), LT(_SYMB,KC_GRV),KC_QUOT, KC_LGUI, KC_LBRACKET, KC_RBRACKET, ALT_T(KC_APP), KC_LEAD, KC_HOME, @@ -182,7 +182,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(_MOUS), KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, TG(_DIABLO), KC_BSPC, KC_A, KC_S, KC_H, KC_T, KC_G, - OSM(MOD_LSFT), LCTL_T(KC_Z), KC_X, KC_M, KC_C, KC_V, TG(_GAMEPAD), + KC_LSFT, LCTL_T(KC_Z), KC_X, KC_M, KC_C, KC_V, TG(_GAMEPAD), LT(_SYMB,KC_GRV),KC_QUOT, KC_LGUI, KC_LBRACKET,KC_RBRACKET, ALT_T(KC_APP), KC_LEAD, KC_HOME, diff --git a/keyboards/orthodox/keymaps/drashna/config.h b/keyboards/orthodox/keymaps/drashna/config.h index f39c34e7..d83b7792 100644 --- a/keyboards/orthodox/keymaps/drashna/config.h +++ b/keyboards/orthodox/keymaps/drashna/config.h @@ -27,7 +27,7 @@ along with this program. If not, see . /* Use I2C or Serial, not both */ #define USE_SERIAL -// #define USE_I2C +#undef USE_I2C /* Select hand configuration */ @@ -71,4 +71,10 @@ along with this program. If not, see . #define STARTUP_SONG SONG(ZELDA_TREASURE) #endif +#undef PRODUCT +#ifdef KEYBOARD_orthodox_rev1 +#define PRODUCT Drashna Hacked Orthodox Rev.1 +#elif KEYBOARD_orthodox_rev3 +#define PRODUCT Drashna Hacked Orthodox Rev.3 +#endif #endif diff --git a/keyboards/orthodox/keymaps/drashna/keymap.c b/keyboards/orthodox/keymaps/drashna/keymap.c index af235f55..f74b39ae 100644 --- a/keyboards/orthodox/keymaps/drashna/keymap.c +++ b/keyboards/orthodox/keymaps/drashna/keymap.c @@ -32,42 +32,30 @@ along with this program. If not, see . #define _______ KC_TRNS #define XXXXXXX KC_NO -#ifdef FAUXCLICKY_ENABLE -float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A6, 2); // (_D4, 0.25); -float fauxclicky_released_note[2] = MUSICAL_NOTE(_A6, 2); // (_C4, 0.125); -float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C6, 2); // (_C4, 0.25); -#define AUD_ON FC_ON -#define AUD_OFF FC_OFF -#else -#define AUD_ON AU_ON -#define AUD_OFF AU_OFF - -#endif - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_QWERTY] = KEYMAP(\ 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_UP, KC_DOWN, KC_LEFT, KC_RIGHT, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ - OSM(MOD_LSFT),CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH), KC_LGUI \ + KC_LSFT,CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH), KC_LGUI \ ), [_COLEMAK] = KEYMAP(\ 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_UP, KC_DOWN, KC_LEFT, KC_RIGHT, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ - OSM(MOD_LSFT), CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_K, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH), KC_LGUI \ + KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_K, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH), KC_LGUI \ ), [_DVORAK] = KEYMAP(\ KC_ESC, KC_QUOT, KC_COMM, KC_DOT, 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_UP, KC_DOWN, KC_LEFT, KC_RIGHT, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, \ - OSM(MOD_LSFT), CTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z), KC_LGUI \ + KC_LSFT, CTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z), KC_LGUI \ ), [_WORKMAN] = KEYMAP(\ KC_ESC, KC_QUOT, KC_COMM, KC_DOT, 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_UP, KC_DOWN, KC_LEFT, KC_RIGHT, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, \ - OSM(MOD_LSFT), CTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z), KC_LGUI \ + KC_LSFT,CTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z), KC_LGUI \ ), [_LOWER] = KEYMAP(\ @@ -84,7 +72,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_ADJUST] = KEYMAP(\ KC_MAKE,KC_RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - RGB_SMOD,RGB_HUI, _______, AUD_ON, AUD_OFF, AG_NORM, _______, _______, _______, _______, AG_SWAP, KC_QWERTY, KC_COLEMAK, KC_DVORAK, KC_WORKMAN, _______, \ + RGB_SMOD,RGB_HUI, KC_FXCL, AUD_ON, AUD_OFF, AG_NORM, _______, _______, _______, _______, AG_SWAP, KC_QWERTY, KC_COLEMAK, KC_DVORAK, KC_WORKMAN, _______, \ KC_RGB_T,RGB_HUD, MU_ON, MU_OFF, MU_TOG, MU_MOD, _______, _______, _______, _______, _______, _______, MAGIC_TOGGLE_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY \ ) diff --git a/keyboards/orthodox/keymaps/drashna/rules.mk b/keyboards/orthodox/keymaps/drashna/rules.mk index 53a44424..c4cf6629 100644 --- a/keyboards/orthodox/keymaps/drashna/rules.mk +++ b/keyboards/orthodox/keymaps/drashna/rules.mk @@ -1,7 +1,11 @@ -CONSOLE_ENABLE = no +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration TAP_DANCE_ENABLE = no RGBLIGHT_ENABLE = yes -AUDIO_ENABLE = no -MOUSEKEY_ENABLE = no +AUDIO_ENABLE = yes NKRO_ENABLE = yes FAUXCLICKY_ENABLE = no +USE_I2C = no diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 2ac0257b..a07d7440 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -30,6 +30,15 @@ PROGMEM const char secret[][64] = { }; #endif +#ifdef FAUXCLICKY_ENABLE +float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A6, 2); // (_D4, 0.25); +float fauxclicky_released_note[2] = MUSICAL_NOTE(_A6, 2); // (_C4, 0.125); +#else +float fauxclicky_pressed[][2] = SONG(E__NOTE(_A6)); // change to your tastes +float fauxclicky_released[][2] = SONG(E__NOTE(_A6)); // change to your tastes +#endif +bool faux_click_enabled = true; + #ifdef TAP_DANCE_ENABLE //define diablo macro timer variables static uint16_t diablo_timer[4]; @@ -222,11 +231,22 @@ void persistent_default_layer_set(uint16_t default_layer) { // Defines actions tor my global custom keycodes. Defined in drashna.h file // Then runs the _keymap's recod handier if not processed here bool process_record_user(uint16_t keycode, keyrecord_t *record) { - + #ifdef CONSOLE_ENABLE xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed); #endif +#ifdef AUDIO_ENABLE + if (faux_click_enabled) { + if (record->event.pressed) { + PLAY_SONG(fauxclicky_pressed); + } else { + stop_note(NOTE_A6); + PLAY_SONG(fauxclicky_released); + } + } +#endif + switch (keycode) { case KC_QWERTY: if (record->event.pressed) { @@ -295,7 +315,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; -#if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_ergodox_ez)) +#if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez)) case KC_OVERWATCH: if (record->event.pressed) { is_overwatch = !is_overwatch; @@ -460,11 +480,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { " AUDIO_ENABLE=yes" #else " AUDIO_ENABLE=no" -#endif -#ifdef FAUXCLICKY_ENABLE - " FAUXCLICKY_ENABLE=yes" -#else - " FAUXCLICKY_ENABLE=no" #endif SS_TAP(X_ENTER)); } @@ -499,6 +514,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; + case KC_FXCL: + if (!record->event.pressed) { + faux_click_enabled = !faux_click_enabled; + } + return false; + break; case KC_RGB_T: // Because I want the option to go back to normal RGB mode rather than always layer indication #ifdef RGBLIGHT_ENABLE if (record->event.pressed) { diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index 2475c99d..aa9c8308 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -101,6 +101,7 @@ enum userspace_custom_keycodes { KC_SECRET_3, KC_SECRET_4, KC_SECRET_5, + KC_FXCL, NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes }; @@ -133,4 +134,12 @@ enum { #define IGNORE_MOD_TAP_INTERRUPT // this makes it possible to do rolling combos (zx) with keys that convert to other keys on hold (z becomes ctrl when you hold it, and when this option isn't enabled, z rapidly followed by x actually sends Ctrl-x. That's bad.) +#ifdef FAUXCLICKY_ENABLE +#define AUD_ON FC_ON +#define AUD_OFF FC_OFF +#else +#define AUD_ON AU_ON +#define AUD_OFF AU_OFF +#endif + #endif From c776c1ce82b5323011d73f6dc958d8e48c721ba7 Mon Sep 17 00:00:00 2001 From: stephengrier Date: Wed, 17 Jan 2018 19:44:12 +0000 Subject: [PATCH 002/173] Adding stephengrier keymap for the tada68 keyboard. (#2269) --- .../tada68/keymaps/stephengrier/config.h | 3 ++ .../tada68/keymaps/stephengrier/keymap.c | 52 +++++++++++++++++++ .../tada68/keymaps/stephengrier/readme.md | 15 ++++++ .../tada68/keymaps/stephengrier/rules.mk | 21 ++++++++ 4 files changed, 91 insertions(+) create mode 100755 keyboards/tada68/keymaps/stephengrier/config.h create mode 100755 keyboards/tada68/keymaps/stephengrier/keymap.c create mode 100755 keyboards/tada68/keymaps/stephengrier/readme.md create mode 100644 keyboards/tada68/keymaps/stephengrier/rules.mk diff --git a/keyboards/tada68/keymaps/stephengrier/config.h b/keyboards/tada68/keymaps/stephengrier/config.h new file mode 100755 index 00000000..56c5996d --- /dev/null +++ b/keyboards/tada68/keymaps/stephengrier/config.h @@ -0,0 +1,3 @@ +#include "../../config.h" + +#define BACKLIGHT_BREATHING diff --git a/keyboards/tada68/keymaps/stephengrier/keymap.c b/keyboards/tada68/keymaps/stephengrier/keymap.c new file mode 100755 index 00000000..ee9054e0 --- /dev/null +++ b/keyboards/tada68/keymaps/stephengrier/keymap.c @@ -0,0 +1,52 @@ +#include "tada68.h" + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _BL 0 +#define _FL 1 + +#define _______ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap _BL: (Base Layer) Default Layer + * ,----------------------------------------------------------------. + * |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |~ ` | + * |----------------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |Del | + * |----------------------------------------------------------------| + * |FN | A| S| D| F| G| H| J| K| L| ;| '|Return |PgUp| + * |----------------------------------------------------------------| + * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | Up|PgDn| + * |----------------------------------------------------------------| + * |Ctrl|Win |Alt | Space |Alt| FN|Ctrl|Lef|Dow|Rig | + * `----------------------------------------------------------------' + */ +[_BL] = KEYMAP_ANSI( + 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,KC_GRV, \ + KC_TAB, 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,KC_DEL, \ + MO(_FL), 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_PGUP, \ + 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_UP,KC_PGDN, \ + KC_LCTL, KC_LALT,KC_LGUI, KC_SPC, KC_RALT,MO(_FL),KC_RCTRL, KC_LEFT,KC_DOWN,KC_RGHT), + + /* Keymap _FL: Function Layer + * ,----------------------------------------------------------------. + * | | F1|F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Del |Ins | + * |----------------------------------------------------------------| + * | | |Up | | | | | |UP | | | | | |Hme | + * |----------------------------------------------------------------| + * | |<- |Dn | ->| | | |<- |Dn | ->| | | |End | + * |----------------------------------------------------------------| + * | | |BR |Bl-|BL |BL+| |VU-|VU+|MUT| | McL|MsU|McR | + * |----------------------------------------------------------------| + * | | | | | | | |MsL|MsD|MsR | + * `----------------------------------------------------------------' + */ +[_FL] = KEYMAP_ANSI( + _______, 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_INS , \ + _______,_______, KC_UP,_______,_______, _______,_______,_______, KC_UP,_______,_______,_______,_______, _______,KC_HOME, \ + _______,KC_LEFT,KC_DOWN,KC_RIGHT,_______,_______,_______,KC_LEFT,KC_DOWN,KC_RIGHT,_______,_______, _______,KC_END, \ + _______,_______,BL_BRTG,BL_DEC, BL_TOGG,BL_INC, _______,KC_VOLD,KC_VOLU,KC_MUTE,_______,KC_BTN1, KC_MS_U, KC_BTN2, \ + _______,_______,_______, _______, _______,_______,_______,KC_MS_L,KC_MS_D, KC_MS_R), +}; diff --git a/keyboards/tada68/keymaps/stephengrier/readme.md b/keyboards/tada68/keymaps/stephengrier/readme.md new file mode 100755 index 00000000..f10f4ebd --- /dev/null +++ b/keyboards/tada68/keymaps/stephengrier/readme.md @@ -0,0 +1,15 @@ +# stephengrier's TADA68 layout + +This layout mostly replicates the default ANSI layout of the TADA68 but with a +few modifications to suit my tastes. + +The modifications from the default keymap are: + +* Replaced capslock with a second function key +* Swapped the left ALT and Win keys to be more like the Mac layout +* Added an arrow key cluster on the IJKL keys +* Fn+x toggles backlight breathing mode + +With this keymap backlight breathing mode can be enabled/disabled with Fn+x. +This is not supported at all in the default keymap. + diff --git a/keyboards/tada68/keymaps/stephengrier/rules.mk b/keyboards/tada68/keymaps/stephengrier/rules.mk new file mode 100644 index 00000000..2a7ff277 --- /dev/null +++ b/keyboards/tada68/keymaps/stephengrier/rules.mk @@ -0,0 +1,21 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif From 5b22ddf5262af8860373ce7a3847f912d5947071 Mon Sep 17 00:00:00 2001 From: amanda flagg Date: Wed, 17 Jan 2018 15:13:52 -0800 Subject: [PATCH 003/173] add dz60 map with arrow keys (#2270) --- .../dz60/keymaps/60_plus_arrows/keymap.c | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 keyboards/dz60/keymaps/60_plus_arrows/keymap.c diff --git a/keyboards/dz60/keymaps/60_plus_arrows/keymap.c b/keyboards/dz60/keymaps/60_plus_arrows/keymap.c new file mode 100644 index 00000000..6b857e3f --- /dev/null +++ b/keyboards/dz60/keymaps/60_plus_arrows/keymap.c @@ -0,0 +1,86 @@ +#include "dz60.h" + +#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) + +#define ______ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------------. + * | ` ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | Bkspc | + * |-----------------------------------------------------------------------------------------+ + * | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | + * |-----------------------------------------------------------------------------------------+ + * | Caps | A | S | D | F | G | H | J | K | L | ; | ' | Enter | + * |-----------------------------------------------------------------------------------------+ + * | Shift | Z | X | C | V | B | N | M | , | . | / | RSh | U | FN | + * |-----------------------------------------------------------------------------------------+ + * | Ctrl | Alt | Cmd | Space | Cmd | RAlt | L | D | R | + * `-----------------------------------------------------------------------------------------' + */ + + KEYMAP_2_SHIFTS( + KC_GRV, 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, + KC_TAB, 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, + KC_CAPS, 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_UP, MO(1), + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_SPC, KC_RGUI, KC_RALT, KC_LEFT, KC_DOWN, KC_RIGHT + ), + +/* FN Layer + * ,-----------------------------------------------------------------------------------------. + * | Esc | BL- | BL+ | BL | | | |RESET| | | | | | | + * |-----------------------------------------------------------------------------------------+ + * | |RBGM | | | | | | | | | | Val+ | Val- |RBGTOG| + * |-----------------------------------------------------------------------------------------+ + * | | Hue+| Hue-| Sat+| Sat-| | | | | | | | | + * |-----------------------------------------------------------------------------------------+ + * | | | | | | | | | | | | | Ctrl| | + * |-----------------------------------------------------------------------------------------+ + * | | | | | | | | | | + * `-----------------------------------------------------------------------------------------' + */ + + KEYMAP_DIRECTIONAL( + KC_ESC, BL_TOGG, BL_STEP, BL_DEC, BL_INC, ______, ______, RESET, ______, ______, ______, ______, ______, ______, ______, + ______, RGB_MOD, ______, ______, ______, ______, ______, ______, ______, ______, ______, RGB_VAI, RGB_VAD, RGB_TOG, + ______, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, ______, ______, ______, ______, ______, ______, ______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, KC_RCTL, ______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______ + ), +}; + +enum function_id { + SHIFT_ESC, +}; + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_FUNCTION(SHIFT_ESC), +}; + +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { + static uint8_t shift_esc_shift_mask; + switch (id) { + case SHIFT_ESC: + shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK; + if (record->event.pressed) { + if (shift_esc_shift_mask) { + add_key(KC_GRV); + send_keyboard_report(); + } else { + add_key(KC_ESC); + send_keyboard_report(); + } + } else { + if (shift_esc_shift_mask) { + del_key(KC_GRV); + send_keyboard_report(); + } else { + del_key(KC_ESC); + send_keyboard_report(); + } + } + break; + } +} \ No newline at end of file From 365b86357825ebed7012377a5684269760326fd2 Mon Sep 17 00:00:00 2001 From: Kenneth Aloysius Date: Fri, 19 Jan 2018 08:02:32 +1100 Subject: [PATCH 004/173] Backlighting for JJ40 and underglow initialisation code (#2260) * Cleanup Mechmini keymap. Once the custom RGB function is defined, there is no need to manually handle RGB code. * Change default to KEYMAP_MIT, not KEYMAP_OFFSET * Add custom RGB code for JJ40 * Reset Mechmini advertised power draw to 500. Will have to test actual maximum power draw later. * RGB working on JJ40. * Fix: saturation increase/decrease flipped * Add new directory for my custom keymap with RGB keycodes * Swap LAlt and LGUI * Update JJ40 max power draw with measured value * Update: fun40 rules.mk to enable underglow; earlier failed Travis CI * Fix: init RGB LEDs on boot. Also added HHKB-like keymap for XD60. * Super rudimentary backlight test, init RGB LEDs on boot * Backlighting works - stays on for now * Toggling working * Now can override backlight.c functions. Problem was functions in backlight.c weren't called before due to a lack of matrix_scan_quantum() in matrix.c * Timers not working * Delete global.h * Cleanup * Compiles * Good sign: LEDs stop working again * Handle timer1 overflow * Progress: fix: forgot to init * Backlighting fully working now except breathing. * Revert keymap to original keycodes * Update XD60 keymap README * Update JJ40 keymap with backlight toggles * Breathing working just fine. * Update references * Add backlight_set() call * Cleanup code to disable backlight * Fix: does not compile * Fix: missing call to rgblight_task. * Testing with BACKLIGHT_BREATHING * Cleanup * Cleanup comments * More commenting cleanup. * Do not enable BACKLIGHT_BREATHING by default --- common_features.mk | 3 + keyboards/jj40/backlight.c | 212 ++++++++++++++++++++ keyboards/jj40/backlight_custom.h | 15 ++ keyboards/jj40/breathing_custom.h | 140 +++++++++++++ keyboards/jj40/config.h | 6 +- keyboards/jj40/jj40.c | 42 +++- keyboards/jj40/jj40.h | 2 + keyboards/jj40/keymaps/default/keymap.c | 17 -- keyboards/jj40/keymaps/krusli/config.h | 8 + keyboards/jj40/keymaps/krusli/keymap.c | 23 +-- keyboards/jj40/matrix.c | 36 ++-- keyboards/jj40/rules.mk | 8 +- keyboards/jj40/usbconfig.h | 2 +- keyboards/xd60/keymaps/krusli/HHKB-like.txt | 0 keyboards/xd60/keymaps/krusli/keymap.c | 62 ++++++ keyboards/xd60/keymaps/krusli/readme.md | 2 + quantum/quantum.c | 12 +- tmk_core/common/backlight.c | 2 +- 18 files changed, 528 insertions(+), 64 deletions(-) create mode 100644 keyboards/jj40/backlight.c create mode 100644 keyboards/jj40/backlight_custom.h create mode 100644 keyboards/jj40/breathing_custom.h create mode 100644 keyboards/jj40/keymaps/krusli/config.h create mode 100644 keyboards/xd60/keymaps/krusli/HHKB-like.txt create mode 100644 keyboards/xd60/keymaps/krusli/keymap.c create mode 100644 keyboards/xd60/keymaps/krusli/readme.md diff --git a/common_features.mk b/common_features.mk index a67cf230..1c0b3546 100644 --- a/common_features.mk +++ b/common_features.mk @@ -155,6 +155,9 @@ endif ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) ifeq ($(strip $(VISUALIZER_ENABLE)), yes) CIE1931_CURVE = yes + endif + ifeq ($(strip $(BACKLIGHT_CUSTOM_DRIVER)), yes) + OPT_DEFS += -DBACKLIGHT_CUSTOM_DRIVER endif endif diff --git a/keyboards/jj40/backlight.c b/keyboards/jj40/backlight.c new file mode 100644 index 00000000..079c410f --- /dev/null +++ b/keyboards/jj40/backlight.c @@ -0,0 +1,212 @@ +/** + * Backlighting code for PS2AVRGB boards (ATMEGA32A) + * Kenneth A. (github.com/krusli | krusli.me) + */ + +#include "backlight.h" +#include "quantum.h" + +#include +#include + +#include "backlight_custom.h" +#include "breathing_custom.h" + +// DEBUG +#include +#include + +// Port D: digital pins of the AVR chipset +#define NUMLOCK_PORT (1 << 1) // 1st pin of Port D (digital) +#define CAPSLOCK_PORT (1 << 2) // 2nd pin +#define BACKLIGHT_PORT (1 << 4) // 4th pin +#define SCROLLLOCK_PORT (1 << 6) // 6th pin + +#define TIMER_CLK_DIV64 0x03 ///< Timer clocked at F_CPU/64 +#define TIMER1PRESCALE TIMER_CLK_DIV64 ///< timer 1 prescaler default + +#define TIMER_PRESCALE_MASK 0x07 ///< Timer Prescaler Bit-Mask + +#define PWM_MAX 0xFF +#define TIMER_TOP 255 // 8 bit PWM + +extern backlight_config_t backlight_config; + +/** + * References + * Port Registers: https://www.arduino.cc/en/Reference/PortManipulation + * TCCR1A: https://electronics.stackexchange.com/questions/92350/what-is-the-difference-between-tccr1a-and-tccr1b + * Timers: http://www.avrbeginners.net/architecture/timers/timers.html + * 16-bit timer setup: http://sculland.com/ATmega168/Interrupts-And-Timers/16-Bit-Timer-Setup/ + * PS2AVRGB firmware: https://github.com/showjean/ps2avrU/tree/master/firmware + */ + +// @Override +// turn LEDs on and off depending on USB caps/num/scroll lock states. +void led_set_user(uint8_t usb_led) { + if (usb_led & (1 << USB_LED_NUM_LOCK)) { + // turn on + DDRD |= NUMLOCK_PORT; + PORTD |= NUMLOCK_PORT; + } else { + // turn off + DDRD &= ~NUMLOCK_PORT; + PORTD &= ~NUMLOCK_PORT; + } + + if (usb_led & (1 << USB_LED_CAPS_LOCK)) { + DDRD |= CAPSLOCK_PORT; + PORTD |= CAPSLOCK_PORT; + } else { + DDRD &= ~CAPSLOCK_PORT; + PORTD &= ~CAPSLOCK_PORT; + } + + if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { + DDRD |= SCROLLLOCK_PORT; + PORTD |= SCROLLLOCK_PORT; + } else { + DDRD &= ~SCROLLLOCK_PORT; + PORTD &= ~SCROLLLOCK_PORT; + } +} + +#ifdef BACKLIGHT_ENABLE + +// sets up Timer 1 for 8-bit PWM +void timer1PWMSetup(void) { // NOTE ONLY CALL THIS ONCE + // default 8 bit mode + TCCR1A &= ~(1 << 1); // cbi(TCCR1A,PWM11); <- set PWM11 bit to HIGH + TCCR1A |= (1 << 0); // sbi(TCCR1A,PWM10); <- set PWM10 bit to LOW + + // clear output compare value A + // outb(OCR1AH, 0); + // outb(OCR1AL, 0); + + // clear output comparator registers for B + OCR1BH = 0; // outb(OCR1BH, 0); + OCR1BL = 0; // outb(OCR1BL, 0); +} + +bool is_init = false; +void timer1Init(void) { + // timer1SetPrescaler(TIMER1PRESCALE) + // set to DIV/64 + (TCCR1B) = ((TCCR1B) & ~TIMER_PRESCALE_MASK) | TIMER1PRESCALE; + + // reset TCNT1 + TCNT1H = 0; // outb(TCNT1H, 0); + TCNT1L = 0; // outb(TCNT1L, 0); + + // TOIE1: Timer Overflow Interrupt Enable (Timer 1); + TIMSK |= _BV(TOIE1); // sbi(TIMSK, TOIE1); + + is_init = true; +} + +void timer1UnInit(void) { + // set prescaler back to NONE + (TCCR1B) = ((TCCR1B) & ~TIMER_PRESCALE_MASK) | 0x00; // TIMERRTC_CLK_STOP + + // disable timer overflow interrupt + TIMSK &= ~_BV(TOIE1); // overflow bit? + + setPWM(0); + + is_init = false; +} + + +// handle TCNT1 overflow +//! Interrupt handler for tcnt1 overflow interrupt +ISR(TIMER1_OVF_vect, ISR_NOBLOCK) +{ + // sei(); + // handle breathing here + #ifdef BACKLIGHT_BREATHING + if (is_breathing()) { + custom_breathing_handler(); + } + #endif + + // TODO call user defined function +} + +// enable timer 1 PWM +// timer1PWMBOn() +void timer1PWMBEnable(void) { + // turn on channel B (OC1B) PWM output + // set OC1B as non-inverted PWM + TCCR1A |= _BV(COM1B1); + TCCR1A &= ~_BV(COM1B0); +} + +// disable timer 1 PWM +// timer1PWMBOff() +void timer1PWMBDisable(void) { + TCCR1A &= ~_BV(COM1B1); + TCCR1A &= ~_BV(COM1B0); +} + +void enableBacklight(void) { + DDRD |= BACKLIGHT_PORT; // set digital pin 4 as output + PORTD |= BACKLIGHT_PORT; // set digital pin 4 to high +} + +void disableBacklight(void) { + // DDRD &= ~BACKLIGHT_PORT; // set digital pin 4 as input + PORTD &= ~BACKLIGHT_PORT; // set digital pin 4 to low +} + +void startPWM(void) { + timer1Init(); + timer1PWMBEnable(); + enableBacklight(); +} + +void stopPWM(void) { + timer1UnInit(); + disableBacklight(); + timer1PWMBDisable(); +} + +void b_led_init_ports(void) { + /* turn backlight on/off depending on user preference */ + #if BACKLIGHT_ON_STATE == 0 + // DDRx register: sets the direction of Port D + // DDRD &= ~BACKLIGHT_PORT; // set digital pin 4 as input + PORTD &= ~BACKLIGHT_PORT; // set digital pin 4 to low + #else + DDRD |= BACKLIGHT_PORT; // set digital pin 4 as output + PORTD |= BACKLIGHT_PORT; // set digital pin 4 to high + #endif + + timer1PWMSetup(); + startPWM(); + + #ifdef BACKLIGHT_BREATHING + breathing_enable(); + #endif +} + +void b_led_set(uint8_t level) { + if (level > BACKLIGHT_LEVELS) { + level = BACKLIGHT_LEVELS; + } + + setPWM((int)(TIMER_TOP * (float) level / BACKLIGHT_LEVELS)); +} + +// called every matrix scan +void b_led_task(void) { + // do nothing for now +} + +void setPWM(uint16_t xValue) { + if (xValue > TIMER_TOP) { + xValue = TIMER_TOP; + } + OCR1B = xValue; // timer1PWMBSet(xValue); +} + +#endif // BACKLIGHT_ENABLE diff --git a/keyboards/jj40/backlight_custom.h b/keyboards/jj40/backlight_custom.h new file mode 100644 index 00000000..7210be84 --- /dev/null +++ b/keyboards/jj40/backlight_custom.h @@ -0,0 +1,15 @@ +/** + * Backlighting code for PS2AVRGB boards (ATMEGA32A) + * Kenneth A. (github.com/krusli | krusli.me) + */ + +#ifndef BACKLIGHT_CUSTOM_H +#define BACKLIGHT_CUSTOM_H + +#include +void b_led_init_ports(void); +void b_led_set(uint8_t level); +void b_led_task(void); +void setPWM(uint16_t xValue); + +#endif // BACKLIGHT_CUSTOM_H diff --git a/keyboards/jj40/breathing_custom.h b/keyboards/jj40/breathing_custom.h new file mode 100644 index 00000000..71416b1b --- /dev/null +++ b/keyboards/jj40/breathing_custom.h @@ -0,0 +1,140 @@ +/** + * Breathing effect code for PS2AVRGB boards (ATMEGA32A) + * Works in conjunction with `backlight.c`. + * + * Code adapted from `quantum.c` to register with the existing TIMER1 overflow + * handler in `backlight.c` instead of setting up its own timer. + * Kenneth A. (github.com/krusli | krusli.me) + */ + +#ifdef BACKLIGHT_ENABLE +#ifdef BACKLIGHT_BREATHING + +#include "backlight_custom.h" + +#ifndef BREATHING_PERIOD +#define BREATHING_PERIOD 6 +#endif + +#define breathing_min() do {breathing_counter = 0;} while (0) +#define breathing_max() do {breathing_counter = breathing_period * 244 / 2;} while (0) + +// TODO make this share code with quantum.c + +#define BREATHING_NO_HALT 0 +#define BREATHING_HALT_OFF 1 +#define BREATHING_HALT_ON 2 +#define BREATHING_STEPS 128 + +static uint8_t breathing_period = BREATHING_PERIOD; +static uint8_t breathing_halt = BREATHING_NO_HALT; +static uint16_t breathing_counter = 0; + +static bool breathing = false; + +bool is_breathing(void) { + return breathing; +} + +// See http://jared.geek.nz/2013/feb/linear-led-pwm +static uint16_t cie_lightness(uint16_t v) { + if (v <= 5243) // if below 8% of max + return v / 9; // same as dividing by 900% + else { + uint32_t y = (((uint32_t) v + 10486) << 8) / (10486 + 0xFFFFUL); // add 16% of max and compare + // to get a useful result with integer division, we shift left in the expression above + // and revert what we've done again after squaring. + y = y * y * y >> 8; + if (y > 0xFFFFUL) // prevent overflow + return 0xFFFFU; + else + return (uint16_t) y; + } +} + +void breathing_enable(void) { + breathing = true; + breathing_counter = 0; + breathing_halt = BREATHING_NO_HALT; + // interrupt already registered +} + +void breathing_pulse(void) { + if (get_backlight_level() == 0) + breathing_min(); + else + breathing_max(); + breathing_halt = BREATHING_HALT_ON; + // breathing_interrupt_enable(); + breathing = true; +} + +void breathing_disable(void) { + breathing = false; + // backlight_set(get_backlight_level()); + b_led_set(get_backlight_level()); // custom implementation of backlight_set() +} + +void breathing_self_disable(void) +{ + if (get_backlight_level() == 0) + breathing_halt = BREATHING_HALT_OFF; + else + breathing_halt = BREATHING_HALT_ON; +} + +void breathing_toggle(void) { + if (is_breathing()) + breathing_disable(); + else + breathing_enable(); +} + +void breathing_period_set(uint8_t value) +{ + if (!value) + value = 1; + breathing_period = value; +} + +void breathing_period_default(void) { + breathing_period_set(BREATHING_PERIOD); +} + +void breathing_period_inc(void) +{ + breathing_period_set(breathing_period+1); +} + +void breathing_period_dec(void) +{ + breathing_period_set(breathing_period-1); +} + +/* To generate breathing curve in python: + * from math import sin, pi; [int(sin(x/128.0*pi)**4*255) for x in range(128)] + */ +static const uint8_t breathing_table[BREATHING_STEPS] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 17, 20, 24, 28, 32, 36, 41, 46, 51, 57, 63, 70, 76, 83, 91, 98, 106, 113, 121, 129, 138, 146, 154, 162, 170, 178, 185, 193, 200, 207, 213, 220, 225, 231, 235, 240, 244, 247, 250, 252, 253, 254, 255, 254, 253, 252, 250, 247, 244, 240, 235, 231, 225, 220, 213, 207, 200, 193, 185, 178, 170, 162, 154, 146, 138, 129, 121, 113, 106, 98, 91, 83, 76, 70, 63, 57, 51, 46, 41, 36, 32, 28, 24, 20, 17, 15, 12, 10, 8, 6, 5, 4, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + +// Use this before the cie_lightness function. +static inline uint16_t scale_backlight(uint16_t v) { + return v / BACKLIGHT_LEVELS * get_backlight_level(); +} + +void custom_breathing_handler(void) { + uint16_t interval = (uint16_t) breathing_period * 244 / BREATHING_STEPS; + // resetting after one period to prevent ugly reset at overflow. + breathing_counter = (breathing_counter + 1) % (breathing_period * 244); + uint8_t index = breathing_counter / interval % BREATHING_STEPS; + + if (((breathing_halt == BREATHING_HALT_ON) && (index == BREATHING_STEPS / 2)) || + ((breathing_halt == BREATHING_HALT_OFF) && (index == BREATHING_STEPS - 1))) + { + // breathing_interrupt_disable(); + } + + setPWM(cie_lightness(scale_backlight((uint16_t) pgm_read_byte(&breathing_table[index]) * 0x0101U))); +} + +#endif // BACKLIGHT_BREATHING +#endif // BACKLIGHT_ENABLE diff --git a/keyboards/jj40/config.h b/keyboards/jj40/config.h index 3152f22b..7fac1ed5 100644 --- a/keyboards/jj40/config.h +++ b/keyboards/jj40/config.h @@ -34,8 +34,8 @@ along with this program. If not, see . /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW -#define BACKLIGHT_PIN B6 -#define BACKLIGHT_LEVELS 3 +#define BACKLIGHT_LEVELS 12 +// #define BACKLIGHT_BREATHING // works, but BL_TOGG might not work #define TAPPING_TOGGLE 3 @@ -45,7 +45,7 @@ along with this program. If not, see . // The RGB_DI_PIN value seems to be shared between all PS2AVRGB boards. // The same pin is used on the JJ40, at least. #define RGBLED_NUM 5 -#define RGB_DI_PIN E2 +#define RGB_DI_PIN E2 // NOTE: for PS2AVRGB boards, underglow commands are sent via I2C to 0xB0. #define RGBLIGHT_ANIMATIONS /* key combination for command */ diff --git a/keyboards/jj40/jj40.c b/keyboards/jj40/jj40.c index 6044e83f..9c1775d6 100644 --- a/keyboards/jj40/jj40.c +++ b/keyboards/jj40/jj40.c @@ -1,5 +1,6 @@ /* Copyright 2017 Luiz Ribeiro +Modified 2018 Kenneth A. 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 @@ -24,8 +25,34 @@ along with this program. If not, see . #include "i2c.h" -// custom RGB driver +#include "backlight.h" +#include "backlight_custom.h" + extern rgblight_config_t rgblight_config; + +// for keyboard subdirectory level init functions +// @Override +void matrix_init_kb(void) { + // call user level keymaps, if any + // matrix_init_user(); +} + +#ifdef BACKLIGHT_ENABLE +/// Overrides functions in `quantum.c` +void backlight_init_ports(void) { + b_led_init_ports(); +} + +void backlight_task(void) { + b_led_task(); +} + +void backlight_set(uint8_t level) { + b_led_set(level); +} +#endif + +// custom RGB driver void rgblight_set(void) { if (!rgblight_config.enable) { for (uint8_t i=0; i. #include "keycode.h" #include "action.h" +void matrix_init_user(void); // TODO port this to other PS2AVRGB boards + #define KEYMAP_GRID( \ K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, \ K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, \ diff --git a/keyboards/jj40/keymaps/default/keymap.c b/keyboards/jj40/keymaps/default/keymap.c index 480486a1..e02dd902 100644 --- a/keyboards/jj40/keymaps/default/keymap.c +++ b/keyboards/jj40/keymaps/default/keymap.c @@ -1,20 +1,3 @@ -/* -Copyright 2017 Luiz Ribeiro - -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 "jj40.h" #include "action_layer.h" diff --git a/keyboards/jj40/keymaps/krusli/config.h b/keyboards/jj40/keymaps/krusli/config.h new file mode 100644 index 00000000..11cafbef --- /dev/null +++ b/keyboards/jj40/keymaps/krusli/config.h @@ -0,0 +1,8 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#define PREVENT_STUCK_MODIFIERS + +#endif diff --git a/keyboards/jj40/keymaps/krusli/keymap.c b/keyboards/jj40/keymaps/krusli/keymap.c index 59e3988e..5a985199 100644 --- a/keyboards/jj40/keymaps/krusli/keymap.c +++ b/keyboards/jj40/keymaps/krusli/keymap.c @@ -1,20 +1,3 @@ -/* -Copyright 2017 Luiz Ribeiro - -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 "jj40.h" #include "action_layer.h" @@ -62,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,_______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + BL_TOGG, BL_STEP, BL_BRTG, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ ), /* Raise @@ -73,13 +56,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------|------+------+------+------+------+------| * | | F7 | F8 | F9 | F10 | F11 | F12 | RGB | RGB | RGB | RGB |Enter | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | RGB | RGB | RGB | RGB | | | Next | Vol- | Vol+ | Play | + * | RGB | RGB | RGB | RGB | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------------------------------------------------' */ [_RAISE] = KEYMAP( \ 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_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, RGB_TOG, RGB_MOD, RGB_VAD, RGB_VAI, _______, \ - _______, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ ) }; diff --git a/keyboards/jj40/matrix.c b/keyboards/jj40/matrix.c index 14002601..a9e9cb53 100644 --- a/keyboards/jj40/matrix.c +++ b/keyboards/jj40/matrix.c @@ -29,6 +29,9 @@ static uint8_t debouncing = DEBOUNCE; static matrix_row_t matrix[MATRIX_ROWS]; static matrix_row_t matrix_debouncing[MATRIX_ROWS]; +void matrix_set_row_status(uint8_t row); +uint8_t bit_reverse(uint8_t x); + void matrix_init(void) { // all outputs for rows high DDRB = 0xFF; @@ -47,18 +50,8 @@ void matrix_init(void) { matrix[row] = 0x00; matrix_debouncing[row] = 0x00; } -} -void matrix_set_row_status(uint8_t row) { - DDRB = (1 << row); - PORTB = ~(1 << row); -} - -uint8_t bit_reverse(uint8_t x) { - x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa); - x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc); - x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0); - return x; + matrix_init_quantum(); // missing from original port by Luiz } uint8_t matrix_scan(void) { @@ -93,11 +86,30 @@ uint8_t matrix_scan(void) { } } - matrix_scan_user(); + matrix_scan_quantum(); // also missing in original PS2AVRGB implementation return 1; } +void matrix_scan_kb(void) { + // Looping keyboard code goes here + // This runs every cycle (a lot) + matrix_scan_user(); +}; + +// declarations +void matrix_set_row_status(uint8_t row) { + DDRB = (1 << row); + PORTB = ~(1 << row); +} + +uint8_t bit_reverse(uint8_t x) { + x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa); + x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc); + x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0); + return x; +} + inline matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; } diff --git a/keyboards/jj40/rules.mk b/keyboards/jj40/rules.mk index cdc898c0..670967fb 100644 --- a/keyboards/jj40/rules.mk +++ b/keyboards/jj40/rules.mk @@ -36,11 +36,13 @@ MOUSEKEY_ENABLE = no EXTRAKEY_ENABLE = yes CONSOLE_ENABLE = no COMMAND_ENABLE = yes -BACKLIGHT_ENABLE = no + +BACKLIGHT_ENABLE = yes +BACKLIGHT_CUSTOM_DRIVER = yes RGBLIGHT_ENABLE = yes RGBLIGHT_CUSTOM_DRIVER = yes -DISABLE_WS2812 = yes # TODO check if this is necessary +# DISABLE_WS2812 = no KEY_LOCK_ENABLE = yes @@ -51,7 +53,7 @@ OPT_DEFS = -DDEBUG_LEVEL=0 # custom matrix setup CUSTOM_MATRIX = yes -SRC = matrix.c i2c.c +SRC = matrix.c i2c.c backlight.c # programming options PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex diff --git a/keyboards/jj40/usbconfig.h b/keyboards/jj40/usbconfig.h index 520d08f6..ad97e7f0 100644 --- a/keyboards/jj40/usbconfig.h +++ b/keyboards/jj40/usbconfig.h @@ -119,7 +119,7 @@ section at the end of this file). * device is powered from the USB bus. */ // max power draw with maxed white underglow measured at 120 mA (peaks) -#define USB_CFG_MAX_BUS_POWER 150 +#define USB_CFG_MAX_BUS_POWER 100 /* Set this variable to the maximum USB bus power consumption of your device. * The value is in milliamperes. [It will be divided by two since USB * communicates power requirements in units of 2 mA.] diff --git a/keyboards/xd60/keymaps/krusli/HHKB-like.txt b/keyboards/xd60/keymaps/krusli/HHKB-like.txt new file mode 100644 index 00000000..e69de29b diff --git a/keyboards/xd60/keymaps/krusli/keymap.c b/keyboards/xd60/keymaps/krusli/keymap.c new file mode 100644 index 00000000..71f6e3c2 --- /dev/null +++ b/keyboards/xd60/keymaps/krusli/keymap.c @@ -0,0 +1,62 @@ +#include "xd60.h" +#include "action_layer.h" + +/* HHKB-like layout for standard 60% layout with split RShift and split backspace */ + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + // 0: Base Layer + KEYMAP( + 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_BSLS, KC_GRV, \ + KC_TAB, 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_BSPC, \ + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_ENT, \ + KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, F(0), \ + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, F(0), KC_RCTL, KC_RCTL), + + // 1: Function Layer + /* Layer HHKB: HHKB mode (HHKB Fn) + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + | Pwr | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | Ins | Del | + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + | Caps | | | | | | | | Psc | Slk | Pus | Up | | Backs | | + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + | | VoD | VoU | Mut | | | * | / | Hom | PgU | Lef | Rig | Enter | | | + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + | | | | | | | + | - | End | PgD | Dow | | | | | + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + + |------+------+----------------------+------+------+ + | **** | **** | ******************** | **** | **** | + |------+------+----------------------+------+------+ + */ + KEYMAP( + RESET, 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_F13, KC_F14, \ + KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_BSPC, \ + KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_NO, KC_ENT, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(0), KC_TRNS, KC_TRNS), +}; + +// Custom Actions +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_MOMENTARY(1), // to Fn overlay +}; + +// Macros +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); } + else { unregister_code(KC_RSFT); } + break; + } + + return MACRO_NONE; +}; + +// Loop +void matrix_scan_user(void) { + // Empty +}; diff --git a/keyboards/xd60/keymaps/krusli/readme.md b/keyboards/xd60/keymaps/krusli/readme.md new file mode 100644 index 00000000..7b6bce9c --- /dev/null +++ b/keyboards/xd60/keymaps/krusli/readme.md @@ -0,0 +1,2 @@ +# krusli's HHKB-style keymap for the XD60 +HHKB-style keymap for the XD60. The board was not built with split backspace but still has Backspace and |\\ swapped. diff --git a/quantum/quantum.c b/quantum/quantum.c index 88617412..65fa2596 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -138,13 +138,13 @@ void reset_keyboard(void) { clear_keyboard(); #if defined(MIDI_ENABLE) && defined(MIDI_BASIC) process_midi_all_notes_off(); -#endif +#endif #if defined(AUDIO_ENABLE) music_all_notes_off(); uint16_t timer_start = timer_read(); PLAY_SONG(goodbye_song); shutdown_user(); - while(timer_elapsed(timer_start) < 250) + while(timer_elapsed(timer_start) < 250) wait_ms(1); stop_all_notes(); #else @@ -885,6 +885,7 @@ void backlight_set(uint8_t level) {} uint8_t backlight_tick = 0; +#ifndef BACKLIGHT_CUSTOM_DRIVER void backlight_task(void) { if ((0xFFFF >> ((BACKLIGHT_LEVELS - get_backlight_level()) * ((BACKLIGHT_LEVELS + 1) / 2))) & (1 << backlight_tick)) { #if BACKLIGHT_ON_STATE == 0 @@ -905,9 +906,12 @@ void backlight_task(void) { } backlight_tick = backlight_tick + 1 % 16; } +#endif #ifdef BACKLIGHT_BREATHING -#error "Backlight breathing only available with hardware PWM. Please disable." + #ifndef BACKLIGHT_CUSTOM_DRIVER + #error "Backlight breathing only available with hardware PWM. Please disable." + #endif #endif #else // pwm through timer @@ -935,6 +939,7 @@ static inline void set_pwm(uint16_t val) { OCR1x = val; } +#ifndef BACKLIGHT_CUSTOM_DRIVER __attribute__ ((weak)) void backlight_set(uint8_t level) { if (level > BACKLIGHT_LEVELS) @@ -952,6 +957,7 @@ void backlight_set(uint8_t level) { } void backlight_task(void) {} +#endif // BACKLIGHT_CUSTOM_DRIVER #ifdef BACKLIGHT_BREATHING diff --git a/tmk_core/common/backlight.c b/tmk_core/common/backlight.c index 4d2491b9..12f75b38 100644 --- a/tmk_core/common/backlight.c +++ b/tmk_core/common/backlight.c @@ -94,4 +94,4 @@ void backlight_level(uint8_t level) uint8_t get_backlight_level(void) { return backlight_config.level; -} \ No newline at end of file +} From 2018df1a61136f5db5032fc7f0ecb6dff05c6351 Mon Sep 17 00:00:00 2001 From: skullY Date: Fri, 19 Jan 2018 11:58:19 -0800 Subject: [PATCH 005/173] Clarify the format for layout names --- docs/feature_layouts.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/feature_layouts.md b/docs/feature_layouts.md index 24c42c09..bfae9204 100644 --- a/docs/feature_layouts.md +++ b/docs/feature_layouts.md @@ -35,10 +35,12 @@ New names should try to stick to the standards set by existing layouts, and can ## Supporting a Layout -For a keyboard to support a layout, the variable (`[a-z0-9_]`) must be defined in it's `.h`, and match the number of arguments/keys (and preferably the physical layout): +For a keyboard to support a layout, the variable must be defined in it's `.h`, and match the number of arguments/keys (and preferably the physical layout): #define LAYOUT_60_ansi KEYMAP_ANSI +The name of the layout must match this regex: `[a-z0-9_]+` + The folder name must be added to the keyboard's `rules.mk`: LAYOUTS = 60_ansi From 510a8d33394780a0713b26a0c516ecab1b140bc2 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 21 Jan 2018 10:55:40 +0200 Subject: [PATCH 006/173] Fix compiler settings for MCUs with floating point --- tmk_core/chibios.mk | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index 4fa9fac2..cb0482d7 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk @@ -26,7 +26,7 @@ endif # Imported source files and paths CHIBIOS = $(TOP_DIR)/lib/chibios CHIBIOS_CONTRIB = $(TOP_DIR)/lib/chibios-contrib -# Startup files. Try a few different locations, for compability with old versions and +# Startup files. Try a few different locations, for compability with old versions and # for things hardware in the contrib repository STARTUP_MK = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_$(MCU_STARTUP).mk ifeq ("$(wildcard $(STARTUP_MK))","") @@ -46,7 +46,7 @@ endif include $(PLATFORM_MK) -BOARD_MK := +BOARD_MK := ifneq ("$(wildcard $(KEYBOARD_PATH_5)/boards/$(BOARD)/board.mk)","") BOARD_PATH = $(KEYBOARD_PATH_5) @@ -115,14 +115,14 @@ CHIBISRC = $(STARTUPSRC) \ $(STREAMSSRC) \ $(STARTUPASM) \ $(PORTASM) \ - $(OSALASM) + $(OSALASM) CHIBISRC := $(patsubst $(TOP_DIR)/%,%,$(CHIBISRC)) - + EXTRAINCDIRS += $(CHIBIOS)/os/license \ $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(STREAMSINC) $(CHIBIOS)/os/various + $(STREAMSINC) $(CHIBIOS)/os/various # # Project, sources and paths @@ -139,17 +139,17 @@ SIZE = arm-none-eabi-size AR = arm-none-eabi-ar NM = arm-none-eabi-nm HEX = $(OBJCOPY) -O $(FORMAT) -EEP = +EEP = BIN = $(OBJCOPY) -O binary -THUMBFLAGS = -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -mthumb -DTHUMB +THUMBFLAGS = -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -mthumb -DTHUMB -COMPILEFLAGS += -fomit-frame-pointer +COMPILEFLAGS += -fomit-frame-pointer COMPILEFLAGS += -falign-functions=16 COMPILEFLAGS += -ffunction-sections COMPILEFLAGS += -fdata-sections COMPILEFLAGS += -fno-common -COMPILEFLAGS += $(THUMBFLAGS) +COMPILEFLAGS += $(THUMBFLAGS) CFLAGS += $(COMPILEFLAGS) @@ -168,6 +168,22 @@ OPT_DEFS += -DPROTOCOL_CHIBIOS MCUFLAGS = -mcpu=$(MCU) +# FPU options default (Cortex-M4 and Cortex-M7 single precision). +ifeq ($(USE_FPU_OPT),) + USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 -fsingle-precision-constant +endif + +# FPU-related options +ifeq ($(USE_FPU),) + USE_FPU = no +endif +ifneq ($(USE_FPU),no) + OPT += $(USE_FPU_OPT) + OPT_DEFS += -DCORTEX_USE_FPU=TRUE +else + OPT_DEFS += -DCORTEX_USE_FPU=FALSE +endif + DEBUG = gdb DFU_ARGS ?= From a14d539ad67a59d297908f2eb1589cb68d990194 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 21 Jan 2018 10:56:41 +0200 Subject: [PATCH 007/173] Revert back to normal sleeping wait behaviour for STM32 --- tmk_core/common/wait.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tmk_core/common/wait.h b/tmk_core/common/wait.h index 553f5243..a7cded94 100644 --- a/tmk_core/common/wait.h +++ b/tmk_core/common/wait.h @@ -13,13 +13,8 @@ extern "C" { # define wait_us(us) _delay_us(us) #elif defined PROTOCOL_CHIBIOS # include "ch.h" -# if defined(STM32F3xx_MCUCONF) -# define wait_ms(ms) chSysPolledDelayX(MS2RTC(STM32_HCLK, (ms))) -# define wait_us(us) chSysPolledDelayX(US2RTC(STM32_HCLK, (us))) -# else -# define wait_ms(ms) chThdSleepMilliseconds(ms) -# define wait_us(us) chThdSleepMicroseconds(us) -# endif +# define wait_ms(ms) chThdSleepMilliseconds(ms) +# define wait_us(us) chThdSleepMicroseconds(us) #elif defined(__arm__) # include "wait_api.h" #else // Unit tests From 894fa0902fb27ed87a17d6c665959647883cbbce Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 21 Jan 2018 10:57:25 +0200 Subject: [PATCH 008/173] Enable FPU on Clueboard60 --- keyboards/clueboard/60/rules.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/keyboards/clueboard/60/rules.mk b/keyboards/clueboard/60/rules.mk index 93e6019a..e0c4b850 100644 --- a/keyboards/clueboard/60/rules.mk +++ b/keyboards/clueboard/60/rules.mk @@ -28,11 +28,13 @@ MCU = cortex-m4 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 ARMV = 7 +USE_FPU = yes + # Vector table for application # 0x00000000-0x00001000 area is occupied by bootlaoder.*/ # The CORTEX_VTOR... is needed only for MCHCK/Infinity KB # OPT_DEFS = -DCORTEX_VTOR_INIT=0x08005000 -OPT_DEFS = +OPT_DEFS = # Options to pass to dfu-util when flashing DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000 -R From 7d8a20b07f31309bc41de69583839058040c55b9 Mon Sep 17 00:00:00 2001 From: "U-LANDSRAAD\\drashna" Date: Tue, 26 Dec 2017 18:06:27 -0800 Subject: [PATCH 009/173] Disable MIDI on Planck so all revisions compile without compilition size errors --- keyboards/planck/rev5/rules.mk | 1 - keyboards/planck/rules.mk | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/keyboards/planck/rev5/rules.mk b/keyboards/planck/rev5/rules.mk index 2ca882a0..7e64e7ed 100644 --- a/keyboards/planck/rev5/rules.mk +++ b/keyboards/planck/rev5/rules.mk @@ -1,2 +1 @@ AUDIO_ENABLE = yes # Audio output on port C6 -MIDI_ENABLE = no diff --git a/keyboards/planck/rules.mk b/keyboards/planck/rules.mk index 439f7db6..4d882d0b 100644 --- a/keyboards/planck/rules.mk +++ b/keyboards/planck/rules.mk @@ -65,7 +65,7 @@ CONSOLE_ENABLE = yes # Console for debug(+400) COMMAND_ENABLE = no # Commands for debug and configuration NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -MIDI_ENABLE = yes # MIDI controls +MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = yes # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID From ac642de9d7560fdd994790288a81163a410a601e Mon Sep 17 00:00:00 2001 From: Joe DeVivo Date: Fri, 29 Dec 2017 09:09:54 -0700 Subject: [PATCH 010/173] Iris send backlight info over i2c --- keyboards/iris/matrix.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/keyboards/iris/matrix.c b/keyboards/iris/matrix.c index b83311ce..3d8d2adb 100644 --- a/keyboards/iris/matrix.c +++ b/keyboards/iris/matrix.c @@ -208,6 +208,15 @@ int i2c_transaction(void) { err = i2c_master_write(0x00); if (err) goto i2c_error; +#ifdef BACKLIGHT_ENABLE + // Write backlight level for slave to read + err = i2c_master_write(get_backlight_level()); +#else + // Write zero, so our byte index is the same + err = i2c_master_write(0x00); +#endif + if (err) goto i2c_error; + // Start read err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); if (err) goto i2c_error; @@ -285,8 +294,12 @@ void matrix_slave_scan(void) { int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; #ifdef USE_I2C +#ifdef BACKLIGHT_ENABLE + // Read backlight level sent from master and update level on slave + backlight_set(i2c_slave_buffer[0]); +#endif for (int i = 0; i < ROWS_PER_HAND; ++i) { - i2c_slave_buffer[i] = matrix[offset+i]; + i2c_slave_buffer[i+1] = matrix[offset+i]; } #else // USE_SERIAL for (int i = 0; i < ROWS_PER_HAND; ++i) { From c73514a2b7284df51b8c6acd416e3fcb01dcbdc7 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Thu, 18 Jan 2018 14:51:16 -0500 Subject: [PATCH 011/173] Update pinout for Rev. 1.0 Iris without LED --- keyboards/iris/iris.h | 2 + keyboards/iris/keymaps/default/config.h | 2 +- keyboards/iris/keymaps/hexwire/config.h | 2 +- keyboards/iris/keymaps/lewisridden/config.h | 2 +- keyboards/iris/rev1/config.h | 6 +- keyboards/iris/rev1_led/config.h | 90 +++++++++++++++++++++ keyboards/iris/rev1_led/rev1_led.c | 22 +++++ keyboards/iris/rev1_led/rev1_led.h | 40 +++++++++ keyboards/iris/rev1_led/rules.mk | 1 + keyboards/iris/rev2/config.h | 2 +- keyboards/iris/rev2/rev2.h | 4 +- 11 files changed, 164 insertions(+), 9 deletions(-) create mode 100644 keyboards/iris/rev1_led/config.h create mode 100644 keyboards/iris/rev1_led/rev1_led.c create mode 100644 keyboards/iris/rev1_led/rev1_led.h create mode 100644 keyboards/iris/rev1_led/rules.mk diff --git a/keyboards/iris/iris.h b/keyboards/iris/iris.h index ec2aabab..a0df746f 100644 --- a/keyboards/iris/iris.h +++ b/keyboards/iris/iris.h @@ -3,6 +3,8 @@ #ifdef KEYBOARD_iris_rev1 #include "rev1.h" +#elif KEYBOARD_iris_rev1_led + #include "rev1_led.h" #else #include "rev2.h" #endif diff --git a/keyboards/iris/keymaps/default/config.h b/keyboards/iris/keymaps/default/config.h index c4604af4..72e35c47 100644 --- a/keyboards/iris/keymaps/default/config.h +++ b/keyboards/iris/keymaps/default/config.h @@ -1,5 +1,5 @@ /* -Copyright 2017 Danny Nguyen +Copyright 2017 Danny Nguyen 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 diff --git a/keyboards/iris/keymaps/hexwire/config.h b/keyboards/iris/keymaps/hexwire/config.h index 81df2e91..53b00d24 100644 --- a/keyboards/iris/keymaps/hexwire/config.h +++ b/keyboards/iris/keymaps/hexwire/config.h @@ -1,5 +1,5 @@ /* -Copyright 2017 Danny Nguyen +Copyright 2017 Danny Nguyen 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 diff --git a/keyboards/iris/keymaps/lewisridden/config.h b/keyboards/iris/keymaps/lewisridden/config.h index 259efc8d..6d96b31b 100644 --- a/keyboards/iris/keymaps/lewisridden/config.h +++ b/keyboards/iris/keymaps/lewisridden/config.h @@ -1,5 +1,5 @@ /* -Copyright 2017 Danny Nguyen +Copyright 2017 Danny Nguyen 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 diff --git a/keyboards/iris/rev1/config.h b/keyboards/iris/rev1/config.h index c9bc6252..c22d49b2 100644 --- a/keyboards/iris/rev1/config.h +++ b/keyboards/iris/rev1/config.h @@ -1,5 +1,5 @@ /* -Copyright 2017 Danny Nguyen +Copyright 2017 Danny Nguyen 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 @@ -35,7 +35,7 @@ along with this program. If not, see . // wiring of each half #define MATRIX_ROW_PINS { D7, E6, B4, B5, D4 } -#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, F4 } +#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 } /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW @@ -59,7 +59,7 @@ along with this program. If not, see . keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ ) -#define BACKLIGHT_PIN B6 +#define BACKLIGHT_PIN D2 #define BACKLIGHT_LEVELS 5 /* ws2812 RGB LED */ diff --git a/keyboards/iris/rev1_led/config.h b/keyboards/iris/rev1_led/config.h new file mode 100644 index 00000000..95777602 --- /dev/null +++ b/keyboards/iris/rev1_led/config.h @@ -0,0 +1,90 @@ +/* +Copyright 2017 Danny Nguyen + +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 REV1_CONFIG_H +#define REV1_CONFIG_H + +#include QMK_KEYBOARD_CONFIG_H + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xCEEB +#define PRODUCT_ID 0x1256 +#define DEVICE_VER 0x0100 +#define MANUFACTURER Keebio +#define PRODUCT Iris Keyboard +#define DESCRIPTION Split 50 percent ergonomic keyboard + +/* key matrix size */ +// Rows are doubled-up +#define MATRIX_ROWS 10 +#define MATRIX_COLS 6 + +// wiring of each half +#define MATRIX_ROW_PINS { D7, E6, B4, B5, D4 } +#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, F4 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +// #define BACKLIGHT_LEVELS 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +#define BACKLIGHT_PIN B6 +#define BACKLIGHT_LEVELS 5 + +/* ws2812 RGB LED */ +#define RGB_DI_PIN D3 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 12 // Number of LEDs +#define ws2812_PORTREG PORTD +#define ws2812_DDRREG DDRD + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +// #define NO_DEBUG + +/* disable print */ +// #define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +#endif diff --git a/keyboards/iris/rev1_led/rev1_led.c b/keyboards/iris/rev1_led/rev1_led.c new file mode 100644 index 00000000..7a4c8748 --- /dev/null +++ b/keyboards/iris/rev1_led/rev1_led.c @@ -0,0 +1,22 @@ +#include "rev1_led.h" + + +#ifdef SSD1306OLED +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + led_set_user(usb_led); +} +#endif + +void matrix_init_kb(void) { + + // // green led on + // DDRD |= (1<<5); + // PORTD &= ~(1<<5); + + // // orange led on + // DDRB |= (1<<0); + // PORTB &= ~(1<<0); + + matrix_init_user(); +}; diff --git a/keyboards/iris/rev1_led/rev1_led.h b/keyboards/iris/rev1_led/rev1_led.h new file mode 100644 index 00000000..82aa01eb --- /dev/null +++ b/keyboards/iris/rev1_led/rev1_led.h @@ -0,0 +1,40 @@ +#ifndef REV1_LED_H +#define REV1_LED_H + +#include "iris.h" + +//void promicro_bootloader_jmp(bool program); +#include "quantum.h" + + +#ifdef USE_I2C +#include +#ifdef __AVR__ + #include + #include +#endif +#endif + +//void promicro_bootloader_jmp(bool program); + +#define KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, LT4, RT4, R30, R31, R32, R33, R34, R35, \ + LT1, LT2, LT3, RT3, RT2, RT1 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05 }, \ + { L10, L11, L12, L13, L14, L15 }, \ + { L20, L21, L22, L23, L24, L25 }, \ + { L30, L31, L32, L33, L34, L35 }, \ + { KC_NO, KC_NO, LT4, LT1, LT2, LT3 }, \ + { R05, R04, R03, R02, R01, R00 }, \ + { R15, R14, R13, R12, R11, R10 }, \ + { R25, R24, R23, R22, R21, R20 }, \ + { R35, R34, R33, R32, R31, R30 }, \ + { KC_NO, KC_NO, RT4, RT1, RT2, RT3 } \ + } + +#endif diff --git a/keyboards/iris/rev1_led/rules.mk b/keyboards/iris/rev1_led/rules.mk new file mode 100644 index 00000000..7b30c0be --- /dev/null +++ b/keyboards/iris/rev1_led/rules.mk @@ -0,0 +1 @@ +BACKLIGHT_ENABLE = no diff --git a/keyboards/iris/rev2/config.h b/keyboards/iris/rev2/config.h index 290fba45..4aa8cda1 100644 --- a/keyboards/iris/rev2/config.h +++ b/keyboards/iris/rev2/config.h @@ -1,5 +1,5 @@ /* -Copyright 2017 Danny Nguyen +Copyright 2017 Danny Nguyen 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 diff --git a/keyboards/iris/rev2/rev2.h b/keyboards/iris/rev2/rev2.h index 6d205365..e0230673 100644 --- a/keyboards/iris/rev2/rev2.h +++ b/keyboards/iris/rev2/rev2.h @@ -1,5 +1,5 @@ -#ifndef REV1_H -#define REV1_H +#ifndef REV2_H +#define REV2_H #include "iris.h" From 9a91b42e922ed152cb548c529233cf7f2b6d5183 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Wed, 20 Dec 2017 10:58:28 -0500 Subject: [PATCH 012/173] Add Chocopad keyboard --- keyboards/chocopad/README.md | 14 +++++ keyboards/chocopad/chocopad.c | 1 + keyboards/chocopad/chocopad.h | 32 +++++++++++ keyboards/chocopad/config.h | 59 ++++++++++++++++++++ keyboards/chocopad/keymaps/default/config.h | 6 ++ keyboards/chocopad/keymaps/default/keymap.c | 61 +++++++++++++++++++++ keyboards/chocopad/keymaps/default/rules.mk | 5 ++ keyboards/chocopad/rules.mk | 56 +++++++++++++++++++ 8 files changed, 234 insertions(+) create mode 100644 keyboards/chocopad/README.md create mode 100644 keyboards/chocopad/chocopad.c create mode 100644 keyboards/chocopad/chocopad.h create mode 100644 keyboards/chocopad/config.h create mode 100644 keyboards/chocopad/keymaps/default/config.h create mode 100644 keyboards/chocopad/keymaps/default/keymap.c create mode 100644 keyboards/chocopad/keymaps/default/rules.mk create mode 100644 keyboards/chocopad/rules.mk diff --git a/keyboards/chocopad/README.md b/keyboards/chocopad/README.md new file mode 100644 index 00000000..ad0f6b35 --- /dev/null +++ b/keyboards/chocopad/README.md @@ -0,0 +1,14 @@ +Chocopad +======== + +A 4x4 macropad keyboard using Kailh PG1350 Lower Profile Choc switches. + +Keyboard Maintainer: Keebio +Hardware Supported: Chocopad PCB, Arduino Pro Micro +Hardware Availability: [Keebio](https://keeb.io) + +Make example for this keyboard (after setting up your build environment): + + make chocopad:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. diff --git a/keyboards/chocopad/chocopad.c b/keyboards/chocopad/chocopad.c new file mode 100644 index 00000000..f54753af --- /dev/null +++ b/keyboards/chocopad/chocopad.c @@ -0,0 +1 @@ +#include "chocopad.h" diff --git a/keyboards/chocopad/chocopad.h b/keyboards/chocopad/chocopad.h new file mode 100644 index 00000000..329e2d56 --- /dev/null +++ b/keyboards/chocopad/chocopad.h @@ -0,0 +1,32 @@ +#ifndef CHOCOPAD_H +#define CHOCOPAD_H + +#include "quantum.h" + +#define KEYMAP( \ + A1, A2, A3, A4, \ + B1, B2, B3, B4, \ + C1, C2, C3, C4, \ + D1, D2, D3, D4 \ +) { \ + { A1, A2, A3, A4 }, \ + { B1, B2, B3, B4 }, \ + { C1, C2, C3, C4 }, \ + { D1, D2, D3, D4 } \ +} + +// Used to create a keymap using only KC_ prefixed keys +#define KC_KEYMAP( \ + A1, A2, A3, A4, \ + B1, B2, B3, B4, \ + C1, C2, C3, C4, \ + D1, D2, D3, D4 \ +) \ + KEYMAP( \ + KC_##A1, KC_##A2, KC_##A3, KC_##A4, \ + KC_##B1, KC_##B2, KC_##B3, KC_##B4, \ + KC_##C1, KC_##C2, KC_##C3, KC_##C4, \ + KC_##D1, KC_##D2, KC_##D3, KC_##D4 \ + ) + +#endif diff --git a/keyboards/chocopad/config.h b/keyboards/chocopad/config.h new file mode 100644 index 00000000..bf861ccd --- /dev/null +++ b/keyboards/chocopad/config.h @@ -0,0 +1,59 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xCEEB +#define PRODUCT_ID 0x1144 +#define DEVICE_VER 0x0100 +#define MANUFACTURER Keebio +#define PRODUCT Chocopad +#define DESCRIPTION 4x4 macropad using Kailh Choc low-profile switches + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 4 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { D7, E6, B3, B2 } +#define MATRIX_COL_PINS { D2, D4, F6, F5 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* number of backlight levels */ +#define BACKLIGHT_PIN B5 +#define BACKLIGHT_LEVELS 6 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE + +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* prevent stuck modifiers */ +#define PREVENT_STUCK_MODIFIERS + + +#ifdef RGB_DI_PIN +#define RGBLIGHT_ANIMATIONS +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 +#endif +#define RGB_DI_PIN D3 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 4 +#define ws2812_PORTREG PORTD +#define ws2812_DDRREG DDRD + +#endif \ No newline at end of file diff --git a/keyboards/chocopad/keymaps/default/config.h b/keyboards/chocopad/keymaps/default/config.h new file mode 100644 index 00000000..7fa3bf32 --- /dev/null +++ b/keyboards/chocopad/keymaps/default/config.h @@ -0,0 +1,6 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#endif diff --git a/keyboards/chocopad/keymaps/default/keymap.c b/keyboards/chocopad/keymaps/default/keymap.c new file mode 100644 index 00000000..c4536a1b --- /dev/null +++ b/keyboards/chocopad/keymaps/default/keymap.c @@ -0,0 +1,61 @@ +#include "chocopad.h" + +#define _BASE 0 +#define _FN1 1 +#define _FN2 2 + +#define KC_ KC_TRNS +#define _______ KC_TRNS + +#define KC_X1 MO(_FN1) +#define KC_X2 MO(_FN2) +#define KC_RST RESET +#define KC_BSTP BL_STEP +#define KC_RTOG RGB_TOG +#define KC_RMOD RGB_MOD +#define KC_RHUI RGB_HUI +#define KC_RHUD RGB_HUD +#define KC_RSAI RGB_SAI +#define KC_RSAD RGB_SAD +#define KC_RVAI RGB_VAI +#define KC_RVAD RGB_VAD + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_BASE] = KC_KEYMAP( + //,----+----+----+----. + PGUP,HOME, UP ,END , + //|----+----+----+----| + PGDN,LEFT,DOWN,RGHT, + //|----+----+----+----| + X2 ,VOLU,MPLY,MPRV, + //|----+----+----+----| + X1 ,VOLD,MUTE,MNXT + //`----+----+----+----' + ), + + [_FN1] = KC_KEYMAP( + //,----+----+----+----. + ESC , P7 , P8 , P9 , + //|----+----+----+----| + TAB , P4 , P5 , P6 , + //|----+----+----+----| + ENT , P1 , P2 , P3 , + //|----+----+----+----| + , P0 , P0 ,DOT + //`----+----+----+----' + ), + + [_FN2] = KC_KEYMAP( + //,----+----+----+----. + RTOG,RHUI,RSAI,RVAI, + //|----+----+----+----| + RMOD,RHUD,RSAD,RVAD, + //|----+----+----+----| + , , ,RST , + //|----+----+----+----| + BSTP, , , + //`----+----+----+----' + ) + +}; diff --git a/keyboards/chocopad/keymaps/default/rules.mk b/keyboards/chocopad/keymaps/default/rules.mk new file mode 100644 index 00000000..1e576127 --- /dev/null +++ b/keyboards/chocopad/keymaps/default/rules.mk @@ -0,0 +1,5 @@ +RGBLIGHT_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/chocopad/rules.mk b/keyboards/chocopad/rules.mk new file mode 100644 index 00000000..cd9222a1 --- /dev/null +++ b/keyboards/chocopad/rules.mk @@ -0,0 +1,56 @@ +# MCU name +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +AUDIO_ENABLE = no +RGBLIGHT_ENABLE = yes From d837ab586a127721679ac1971874f52e5c72aefb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20J=C3=A4rvstrand?= Date: Sun, 21 Jan 2018 21:32:19 +0100 Subject: [PATCH 013/173] Make new_project.sh a bit more robust --- util/new_project.sh | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/util/new_project.sh b/util/new_project.sh index 18d16e56..0f507b67 100755 --- a/util/new_project.sh +++ b/util/new_project.sh @@ -12,19 +12,11 @@ cd "$(dirname "$0")/.." KEYBOARD=$1 KEYBOARD_UPPERCASE=$(echo $1 | awk '{print toupper($0)}') -mkdir keyboards/$1 -mkdir keyboards/$1/keymaps -mkdir keyboards/$1/keymaps/default -sed -e "s;%KEYBOARD%;$KEYBOARD;g" -e "s;%KEYBOARD_UPPERCASE%;$KEYBOARD_UPPERCASE;g" quantum/template/template.h > keyboards/$KEYBOARD/$KEYBOARD.h -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/template.c > keyboards/$KEYBOARD/$KEYBOARD.c -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/config.h > keyboards/$KEYBOARD/config.h -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/readme.md > keyboards/$KEYBOARD/readme.md -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/Makefile > keyboards/$KEYBOARD/Makefile -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/rules.mk > keyboards/$KEYBOARD/rules.mk -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default/config.h > keyboards/$KEYBOARD/keymaps/default/config.h -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default/keymap.c > keyboards/$KEYBOARD/keymaps/default/keymap.c -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default/Makefile > keyboards/$KEYBOARD/keymaps/default/Makefile -sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default/readme.md > keyboards/$KEYBOARD/keymaps/default/readme.md +cp -r quantum/template keyboards/$KEYBOARD +mv keyboards/$KEYBOARD/template.c keyboards/$KEYBOARD/$KEYBOARD.c +mv keyboards/$KEYBOARD/template.h keyboards/$KEYBOARD/$KEYBOARD.h +find keyboards/${KEYBOARD} -type f -exec sed -i "s;%KEYBOARD%;$KEYBOARD;g" {} \; +find keyboards/${KEYBOARD} -type f -exec sed -i "s;%KEYBOARD_UPPERCASE%;$KEYBOARD_UPPERCASE;g" {} \; echo "######################################################" echo "# /keyboards/$KEYBOARD project created. To start" From 7c3d2d5f64061db8ff54aefe3e41b0505aa9f4e8 Mon Sep 17 00:00:00 2001 From: allo-world <35620024+allo-world@users.noreply.github.com> Date: Wed, 24 Jan 2018 22:00:31 -0800 Subject: [PATCH 014/173] Added KBD66 (#2292) * Created default layout for KBD66. * Added KBD66 ISO layout. --- keyboards/kbd66/config.h | 191 ++++++++++++++++++++++ keyboards/kbd66/kbd66.c | 43 +++++ keyboards/kbd66/kbd66.h | 36 ++++ keyboards/kbd66/keymaps/ansi/config.h | 24 +++ keyboards/kbd66/keymaps/ansi/keymap.c | 103 ++++++++++++ keyboards/kbd66/keymaps/ansi/readme.md | 11 ++ keyboards/kbd66/keymaps/default/config.h | 24 +++ keyboards/kbd66/keymaps/default/keymap.c | 103 ++++++++++++ keyboards/kbd66/keymaps/default/readme.md | 12 ++ keyboards/kbd66/keymaps/iso/config.h | 24 +++ keyboards/kbd66/keymaps/iso/keymap.c | 103 ++++++++++++ keyboards/kbd66/keymaps/iso/readme.md | 11 ++ keyboards/kbd66/readme.md | 15 ++ keyboards/kbd66/rules.mk | 68 ++++++++ 14 files changed, 768 insertions(+) create mode 100644 keyboards/kbd66/config.h create mode 100644 keyboards/kbd66/kbd66.c create mode 100644 keyboards/kbd66/kbd66.h create mode 100644 keyboards/kbd66/keymaps/ansi/config.h create mode 100644 keyboards/kbd66/keymaps/ansi/keymap.c create mode 100644 keyboards/kbd66/keymaps/ansi/readme.md create mode 100644 keyboards/kbd66/keymaps/default/config.h create mode 100644 keyboards/kbd66/keymaps/default/keymap.c create mode 100644 keyboards/kbd66/keymaps/default/readme.md create mode 100644 keyboards/kbd66/keymaps/iso/config.h create mode 100644 keyboards/kbd66/keymaps/iso/keymap.c create mode 100644 keyboards/kbd66/keymaps/iso/readme.md create mode 100644 keyboards/kbd66/readme.md create mode 100644 keyboards/kbd66/rules.mk diff --git a/keyboards/kbd66/config.h b/keyboards/kbd66/config.h new file mode 100644 index 00000000..1802a021 --- /dev/null +++ b/keyboards/kbd66/config.h @@ -0,0 +1,191 @@ +/* +Copyright 2018 Alex Peters + +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 CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0xBD66 +#define DEVICE_VER 0x0001 +#define MANUFACTURER KBDFans +#define PRODUCT KBD66 +#define DESCRIPTION QMK keyboard firmware for KBD66 + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 16 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ +#define MATRIX_ROW_PINS { B0, B1, F0, F1, D4 } // From qmkeyboard.cn +#define MATRIX_COL_PINS { C6, C7, E2, F5, F6, F4, D3, D2, D5, D0, D1, B4, D7, D6, E6, B3 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ +#define DIODE_DIRECTION COL2ROW + +#define BACKLIGHT_PIN B6 +#define BACKLIGHT_LEVELS 3 +#define BACKLIGHT_BREATHING +#define BREATHING_PERIOD 6 + + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. + * This is userful for the Windows task manager shortcut (ctrl+shift+esc). + */ +// #define GRAVE_ESC_CTRL_OVERRIDE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Magic Key Options + * + * Magic keys are hotkey commands that allow control over firmware functions of + * the keyboard. They are best used in combination with the HID Listen program, + * found here: https://www.pjrc.com/teensy/hid_listen.html + * + * The options below allow the magic key functionality to be changed. This is + * useful if your keyboard/keypad is missing keys and you want magic key support. + * + */ + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* control how magic key switches layers */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false + +/* override magic key keymap */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM +//#define MAGIC_KEY_HELP1 H +//#define MAGIC_KEY_HELP2 SLASH +//#define MAGIC_KEY_DEBUG D +//#define MAGIC_KEY_DEBUG_MATRIX X +//#define MAGIC_KEY_DEBUG_KBD K +//#define MAGIC_KEY_DEBUG_MOUSE M +//#define MAGIC_KEY_VERSION V +//#define MAGIC_KEY_STATUS S +//#define MAGIC_KEY_CONSOLE C +//#define MAGIC_KEY_LAYER0_ALT1 ESC +//#define MAGIC_KEY_LAYER0_ALT2 GRAVE +//#define MAGIC_KEY_LAYER0 0 +//#define MAGIC_KEY_LAYER1 1 +//#define MAGIC_KEY_LAYER2 2 +//#define MAGIC_KEY_LAYER3 3 +//#define MAGIC_KEY_LAYER4 4 +//#define MAGIC_KEY_LAYER5 5 +//#define MAGIC_KEY_LAYER6 6 +//#define MAGIC_KEY_LAYER7 7 +//#define MAGIC_KEY_LAYER8 8 +//#define MAGIC_KEY_LAYER9 9 +//#define MAGIC_KEY_BOOTLOADER PAUSE +//#define MAGIC_KEY_LOCK CAPS +//#define MAGIC_KEY_EEPROM E +//#define MAGIC_KEY_NKRO N +//#define MAGIC_KEY_SLEEP_LED Z + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ +//#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 1 + +#endif diff --git a/keyboards/kbd66/kbd66.c b/keyboards/kbd66/kbd66.c new file mode 100644 index 00000000..7a84b636 --- /dev/null +++ b/keyboards/kbd66/kbd66.c @@ -0,0 +1,43 @@ +/* Copyright 2018 Alex Peters + * + * 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 "kbd66.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + + matrix_init_user(); +} + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + + matrix_scan_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware + + return process_record_user(keycode, record); +} + +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + + led_set_user(usb_led); +} diff --git a/keyboards/kbd66/kbd66.h b/keyboards/kbd66/kbd66.h new file mode 100644 index 00000000..af1156e5 --- /dev/null +++ b/keyboards/kbd66/kbd66.h @@ -0,0 +1,36 @@ +/* Copyright 2018 Alex Peters + * + * 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 KBD66_H +#define KBD66_H + +#include "quantum.h" + +// This a shortcut to help you visually see your layout. +#define KEYMAP( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D,k0E, k0F, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1F, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2D, \ + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \ + k40, k41, k42, k45, k48, k4A, k4B, k4C, k4D, k4E, k4F \ +) { \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, k0F}, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, KC_NO, k1F}, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, KC_NO, k2D, KC_NO, KC_NO}, \ + { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, KC_NO}, \ + { k40, k41, k42, KC_NO, KC_NO, k45, KC_NO, KC_NO, k48, KC_NO, k4A, k4B, k4C, k4D, k4E, k4F}, \ +} + +#endif diff --git a/keyboards/kbd66/keymaps/ansi/config.h b/keyboards/kbd66/keymaps/ansi/config.h new file mode 100644 index 00000000..c7b3d6ec --- /dev/null +++ b/keyboards/kbd66/keymaps/ansi/config.h @@ -0,0 +1,24 @@ +/* Copyright 2018 Alex Peters + * + * 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 CONFIG_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +// place overrides here + +#endif diff --git a/keyboards/kbd66/keymaps/ansi/keymap.c b/keyboards/kbd66/keymaps/ansi/keymap.c new file mode 100644 index 00000000..f5ffa7b7 --- /dev/null +++ b/keyboards/kbd66/keymaps/ansi/keymap.c @@ -0,0 +1,103 @@ +/* Copyright 2018 Alex Peters + * + * 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 "kbd66.h" + +#define _____ KC_TRNS +#define XXXXX KC_NO +#define _L0 0 +#define _L1 1 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0 + * ,-----------------------------------------------------------. ,---. + * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BckSp | |INS| + * |-----------------------------------------------------------| |---| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |DEL| + * |-----------------------------------------------------------| `---' + * |Cap | A| S| D| F| G| H| J| K| L| ;| '| Enter | + * |---------------------------------------------------------------. + * | Shift | Z| X| C| V| B| N| M| ,| .| /| Shift | UP| + * |-------------------------------------------------------------------. + * |Ctl |OS |Alt | Space |Alt | Fn |Ctl |LFT|DWN|RIG| + * `-------------------------------------------------------------------' + */ +[_L0] = KEYMAP( + KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, XXXXX, KC_BSPC, KC_INS, + KC_TAB, 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, KC_DEL, + KC_CAPS, 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, XXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, XXXXX, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_RALT, MO(_L1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT +), + + /* Layer 1 + * ,-----------------------------------------------------------. ,---. + * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | |HOM| + * |-----------------------------------------------------------| |---| + * | | | | | | | | | | |PSc|VDn|VUp| Mute| |END| + * |-----------------------------------------------------------| `---' + * |RESET| | | | | | |PRV|PLY|NXT|STP| | | + * |---------------------------------------------------------------. + * | | | | | | | | |BLB|BLC|Slp| |PUp| + * |-------------------------------------------------------------------. + * | | | | | | | | |PDn|SLk| + * `-------------------------------------------------------------------' + */ +[_L1] = KEYMAP( + 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_HOME, + _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, KC_PSCR, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, + RESET, _____, _____, _____, _____, _____, _____, KC_MPRV, KC_MPLY, KC_MNXT, KC_MSTP, _____, _____, + _____, _____, _____, _____, _____, _____, _____, _____, _____, BL_BRTG, BL_STEP, KC_SLEP, _____, _____, KC_PGUP, + _____, _____, _____, _____, _____, _____, _____, _____, _____, KC_PGDN, KC_SLCK +) + +}; + +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: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/kbd66/keymaps/ansi/readme.md b/keyboards/kbd66/keymaps/ansi/readme.md new file mode 100644 index 00000000..6ad0d85e --- /dev/null +++ b/keyboards/kbd66/keymaps/ansi/readme.md @@ -0,0 +1,11 @@ +# ANSI keymap for KBD66 + +![KBD66 Layout Image](https://i.imgur.com/Hmt5QDW.jpg) + +Your standard ANSI layout for the KBD66. +Cycle backlight: Fn + . +Backlight breathing: Fn + , +Volume Up/Down: Fn + [ and Fn + ] +Mute: Fn + \ +Sleep: Fn + / +Bootloader Mode: Fn + CapsLock \ No newline at end of file diff --git a/keyboards/kbd66/keymaps/default/config.h b/keyboards/kbd66/keymaps/default/config.h new file mode 100644 index 00000000..c7b3d6ec --- /dev/null +++ b/keyboards/kbd66/keymaps/default/config.h @@ -0,0 +1,24 @@ +/* Copyright 2018 Alex Peters + * + * 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 CONFIG_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +// place overrides here + +#endif diff --git a/keyboards/kbd66/keymaps/default/keymap.c b/keyboards/kbd66/keymaps/default/keymap.c new file mode 100644 index 00000000..551df141 --- /dev/null +++ b/keyboards/kbd66/keymaps/default/keymap.c @@ -0,0 +1,103 @@ +/* Copyright 2018 Alex Peters + * + * 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 "kbd66.h" + +#define _____ KC_TRNS +#define XXXXX KC_NO +#define _L0 0 +#define _L1 1 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0 + * ,-----------------------------------------------------------. ,---. + * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| `| BS| |INS| + * |-----------------------------------------------------------| |---| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |DEL| + * |-----------------------------------------------------------| `---' + * |Cap | A| S| D| F| G| H| J| K| L| ;| '| Enter | + * |---------------------------------------------------------------. + * |Shft| `| Z| X| C| V| B| N| M| ,| .| /| Shft |Fn | UP| + * |-------------------------------------------------------------------. + * |Ctl |OS |Alt | Space |Alt | Fn |Ctl |LFT|DWN|RIG| + * `-------------------------------------------------------------------' + */ +[_L0] = KEYMAP( + KC_GESC, 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_GRV, KC_BSPC, KC_INS, + KC_TAB, 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, KC_DEL, + KC_CAPS, 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_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(_L1), KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_RALT, MO(_L1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT +), + + /* Layer 1 + * ,-----------------------------------------------------------. ,---. + * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | | |HOM| + * |-----------------------------------------------------------| |---| + * | | | | | | | | | | |PSc|VDn|VUp| Mute| |END| + * |-----------------------------------------------------------| `---' + * |RESET| | | | | | |PRV|PLY|NXT|STP| | | + * |---------------------------------------------------------------. + * | | | | | | | | | |BLB|BLC|Slp| | |PUp| + * |-------------------------------------------------------------------. + * | | | | | | | | |PDn|SLk| + * `-------------------------------------------------------------------' + */ +[_L1] = KEYMAP( + 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_HOME, + _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, KC_PSCR, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, + RESET, _____, _____, _____, _____, _____, _____, KC_MPRV, KC_MPLY, KC_MNXT, KC_MSTP, _____, _____, + _____, _____, _____, _____, _____, _____, _____, _____, _____, BL_BRTG, BL_STEP, KC_SLEP, _____, _____, KC_PGUP, + _____, _____, _____, _____, _____, _____, _____, _____, _____, KC_PGDN, KC_SLCK +) + +}; + +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: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/kbd66/keymaps/default/readme.md b/keyboards/kbd66/keymaps/default/readme.md new file mode 100644 index 00000000..f4ab771a --- /dev/null +++ b/keyboards/kbd66/keymaps/default/readme.md @@ -0,0 +1,12 @@ +# The default keymap for KBD66 + +![KBD66 Layout Image](https://i.imgur.com/QNpHnMe.jpg) + +This is a fairly universal layout that supports standard ANSI, split backspace, +split left shift, and split right shift. +Cycle backlight: Fn + . +Backlight breathing: Fn + , +Volume Up/Down: Fn + [ and Fn + ] +Mute: Fn + \ +Sleep: Fn + / +Bootloader Mode: Fn + CapsLock \ No newline at end of file diff --git a/keyboards/kbd66/keymaps/iso/config.h b/keyboards/kbd66/keymaps/iso/config.h new file mode 100644 index 00000000..c7b3d6ec --- /dev/null +++ b/keyboards/kbd66/keymaps/iso/config.h @@ -0,0 +1,24 @@ +/* Copyright 2018 Alex Peters + * + * 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 CONFIG_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +// place overrides here + +#endif diff --git a/keyboards/kbd66/keymaps/iso/keymap.c b/keyboards/kbd66/keymaps/iso/keymap.c new file mode 100644 index 00000000..fa9202ca --- /dev/null +++ b/keyboards/kbd66/keymaps/iso/keymap.c @@ -0,0 +1,103 @@ +/* Copyright 2018 Alex Peters + * + * 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 "kbd66.h" + +#define _____ KC_TRNS +#define XXXXX KC_NO +#define _L0 0 +#define _L1 1 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0 + * ,-----------------------------------------------------------. ,---. + * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BckSp | |INS| + * |-----------------------------------------------------------| |---| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |DEL| + * |------------------------------------------------------|Ent | `---' + * |Cap | A| S| D| F| G| H| J| K| L| ;| '| #| | + * |---------------------------------------------------------------. + * |Shft| \| Z| X| C| V| B| N| M| ,| .| /| Shft |Fn | UP| + * |-------------------------------------------------------------------. + * |Ctl |OS |Alt | Space |Alt | Fn |Ctl |LFT|DWN|RIG| + * `-------------------------------------------------------------------' + */ +[_L0] = KEYMAP( + KC_GESC, 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_GRV, KC_BSPC, KC_INS, + KC_TAB, 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_NUHS, KC_DEL, + KC_CAPS, 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_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(_L1), KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_RALT, MO(_L1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT +), + + /* Layer 1 + * ,-----------------------------------------------------------. ,---. + * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | | |HOM| + * |-----------------------------------------------------------| |---| + * | | | | | | | | | | |PSc|VDn|VUp| | |END| + * |------------------------------------------------------| | `---' + * |RESET | | | | | | |PRV|PLY|NXT|STP| |Mut| | + * |---------------------------------------------------------------. + * | | | | | | | | | |BLB|BLC|Slp| | |PUp| + * |-------------------------------------------------------------------. + * | | | | | | | | |PDn|SLk| + * `-------------------------------------------------------------------' + */ +[_L1] = KEYMAP( + 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_HOME, + _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, KC_PSCR, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, + RESET, _____, _____, _____, _____, _____, _____, KC_MPRV, KC_MPLY, KC_MNXT, KC_MSTP, _____, _____, + _____, _____, _____, _____, _____, _____, _____, _____, _____, BL_BRTG, BL_STEP, KC_SLEP, _____, _____, KC_PGUP, + _____, _____, _____, _____, _____, _____, _____, _____, _____, KC_PGDN, KC_SLCK +) + +}; + +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: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/kbd66/keymaps/iso/readme.md b/keyboards/kbd66/keymaps/iso/readme.md new file mode 100644 index 00000000..f325b741 --- /dev/null +++ b/keyboards/kbd66/keymaps/iso/readme.md @@ -0,0 +1,11 @@ +# ISO keymap for KBD66 + +![KBD66 Layout Image](https://i.imgur.com/q6GTOsb.jpg) + +Standard ISO layout for KBD66. +Cycle backlight: Fn + . +Backlight breathing: Fn + , +Volume Up/Down: Fn + [ and Fn + ] +Mute: Fn + # +Sleep: Fn + / +Bootloader Mode: Fn + CapsLock \ No newline at end of file diff --git a/keyboards/kbd66/readme.md b/keyboards/kbd66/readme.md new file mode 100644 index 00000000..71fe1f2e --- /dev/null +++ b/keyboards/kbd66/readme.md @@ -0,0 +1,15 @@ +# KBD66 + +![KBD66](https://i.imgur.com/qtLuL2o.jpg) + +A 65% keyboard from KBDFans. + +Keyboard Maintainer: [Alex](https://github.com/allo-world) +Hardware Supported: KBD66, ATmega32U4 +Hardware Availability: [KBDFans](https://kbdfans.cn), [Massdrop](https://www.massdrop.com/buy/kbd66-mechanical-keyboard-kit?mode=guest_open) + +Make example for this keyboard (after setting up your build environment): + + make kbd66:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. \ No newline at end of file diff --git a/keyboards/kbd66/rules.mk b/keyboards/kbd66/rules.mk new file mode 100644 index 00000000..45eb6ee3 --- /dev/null +++ b/keyboards/kbd66/rules.mk @@ -0,0 +1,68 @@ +# MCU name +#MCU = at90usb1286 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +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 = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = no # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default +MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 +FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches From 61d851af6594be3b52c316be29115e282dc2a4f2 Mon Sep 17 00:00:00 2001 From: TerryMathews Date: Thu, 25 Jan 2018 01:00:59 -0500 Subject: [PATCH 015/173] Add SSD1306 OLED display support to TKC1800 (#2293) * Add support for SSD1306 OLED display * Correct keymap Had tilde on keymap instead of grave, corrected. * Winkeyless keymap --- keyboards/tkc1800/i2c.c | 166 +++++++++++++++++++++ keyboards/tkc1800/i2c.h | 49 ++++++ keyboards/tkc1800/keymaps/default/config.h | 5 + keyboards/tkc1800/keymaps/default/keymap.c | 94 +++++++++--- keyboards/tkc1800/keymaps/wkl/config.h | 29 ++++ keyboards/tkc1800/keymaps/wkl/keymap.c | 145 ++++++++++++++++++ keyboards/tkc1800/rules.mk | 5 +- 7 files changed, 475 insertions(+), 18 deletions(-) create mode 100644 keyboards/tkc1800/i2c.c create mode 100644 keyboards/tkc1800/i2c.h create mode 100644 keyboards/tkc1800/keymaps/wkl/config.h create mode 100644 keyboards/tkc1800/keymaps/wkl/keymap.c diff --git a/keyboards/tkc1800/i2c.c b/keyboards/tkc1800/i2c.c new file mode 100644 index 00000000..cd2b835d --- /dev/null +++ b/keyboards/tkc1800/i2c.c @@ -0,0 +1,166 @@ +#include +#include +#include +#include +#include +#include +#include "i2c.h" + +#ifdef USE_I2C + +// Limits the amount of we wait for any one i2c transaction. +// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is +// 9 bits, a single transaction will take around 90μs to complete. +// +// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit +// poll loop takes at least 8 clock cycles to execute +#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 + +#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) + +volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; + +static volatile uint8_t slave_buffer_pos; +static volatile bool slave_has_register_set = false; + +// Wait for an i2c operation to finish +inline static +void i2c_delay(void) { + uint16_t lim = 0; + while(!(TWCR & (1<10. + // Check datasheets for more info. + TWBR = ((F_CPU/SCL_CLOCK)-16)/2; +} + +// Start a transaction with the given i2c slave address. The direction of the +// transfer is set with I2C_READ and I2C_WRITE. +// returns: 0 => success +// 1 => error +uint8_t i2c_master_start(uint8_t address) { + TWCR = (1< slave ACK +// 1 => slave NACK +uint8_t i2c_master_write(uint8_t data) { + TWDR = data; + TWCR = (1<= SLAVE_BUFFER_SIZE ) { + ack = 0; + slave_buffer_pos = 0; + } + slave_has_register_set = true; + } else { + i2c_slave_buffer[slave_buffer_pos] = TWDR; + BUFFER_POS_INC(); + } + break; + + case TW_ST_SLA_ACK: + case TW_ST_DATA_ACK: + // master has addressed this device as a slave transmitter and is + // requesting data. + TWDR = i2c_slave_buffer[slave_buffer_pos]; + BUFFER_POS_INC(); + break; + + case TW_BUS_ERROR: // something went wrong, reset twi state + TWCR = 0; + default: + break; + } + // Reset everything, so we are ready for the next TWI interrupt + TWCR |= (1< + +#ifndef F_CPU +#define F_CPU 16000000UL +#endif + +#define I2C_READ 1 +#define I2C_WRITE 0 + +#define I2C_ACK 1 +#define I2C_NACK 0 + +#define SLAVE_BUFFER_SIZE 0x10 + +// i2c SCL clock frequency +#define SCL_CLOCK 800000L + +extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; + +void i2c_master_init(void); +uint8_t i2c_master_start(uint8_t address); +void i2c_master_stop(void); +uint8_t i2c_master_write(uint8_t data); +uint8_t i2c_master_read(int); +void i2c_reset_state(void); +void i2c_slave_init(uint8_t address); + + +static inline unsigned char i2c_start_read(unsigned char addr) { + return i2c_master_start((addr << 1) | I2C_READ); +} + +static inline unsigned char i2c_start_write(unsigned char addr) { + return i2c_master_start((addr << 1) | I2C_WRITE); +} + +// from SSD1306 scrips +extern unsigned char i2c_rep_start(unsigned char addr); +extern void i2c_start_wait(unsigned char addr); +extern unsigned char i2c_readAck(void); +extern unsigned char i2c_readNak(void); +extern unsigned char i2c_read(unsigned char ack); + +#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); + +#endif diff --git a/keyboards/tkc1800/keymaps/default/config.h b/keyboards/tkc1800/keymaps/default/config.h index a3828f7d..30973348 100644 --- a/keyboards/tkc1800/keymaps/default/config.h +++ b/keyboards/tkc1800/keymaps/default/config.h @@ -19,6 +19,11 @@ #include "../../config.h" +#define USE_I2C +#define SSD1306OLED +//#define OLED_ROTATE180 +#define SSD1306_ADDRESS 0x3C + // place overrides here #endif diff --git a/keyboards/tkc1800/keymaps/default/keymap.c b/keyboards/tkc1800/keymaps/default/keymap.c index 1b9f390b..7821f0f3 100644 --- a/keyboards/tkc1800/keymaps/default/keymap.c +++ b/keyboards/tkc1800/keymaps/default/keymap.c @@ -14,21 +14,33 @@ * along with this program. If not, see . */ #include "tkc1800.h" +#include "LUFA/Drivers/Peripheral/TWI.h" +#include "i2c.h" +#include "ssd1306.h" + #define MODS_SHFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) #define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) + // Helpful defines #define ______ KC_TRNS #define XXXXXX KC_NO -#define _DEFAULT 0 -#define _FUNCTION 1 +//Layers + +enum { + BASE = 0, + FUNCTION, +}; + +//13 characters max without re-writing the "Layer: " format in iota_gfx_task_user() +static char layer_lookup[][14] = {"Base","Function"}; + -//RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* Keymap _BL: (Base Layer) Default Layer + /* Keymap BASE: (Base Layer) Default Layer * ,-------------------------------------------------------. ,-------------------. * |Esc| F1| F2| F3| F4| | F5| F6| F7| F8| | F9|F10|F11|F12| |Ins |Home|PgUp|PrSc| * `-------------------------------------------------------' |-------------------| @@ -45,41 +57,89 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Ctrl|Gui |Alt | Space |Alt |Gui|Ctr|Left |Down|Rght| 0 | . | | * `---------------------------------------------------------------------------------' */ - [_DEFAULT] = KEYMAP( + [BASE] = KEYMAP( KC_ESC, 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_INS, KC_HOME, KC_PGUP, KC_PSCR, \ KC_DEL, KC_END, KC_PGDN, KC_SLCK, \ - KC_TILD, 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, XXXXXX, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ + KC_GRV, 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, XXXXXX, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ KC_TAB, 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, KC_P7, KC_P8, KC_P9, KC_PMNS, \ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXX, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, \ - KC_LSFT, XXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, \ - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(_FUNCTION), KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, XXXXXX + KC_LSFT, XXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, XXXXXX, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(FUNCTION), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT ), - [_FUNCTION] = KEYMAP( + [FUNCTION] = KEYMAP( KC_ESC, 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_INS, KC_HOME, KC_PGUP, KC_PSCR, \ KC_DEL, KC_END, KC_PGDN, KC_SLCK, \ - KC_TILD, 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, XXXXXX, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, RESET, XXXXXX, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ KC_TAB, 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, KC_P7, KC_P8, KC_P9, KC_PMNS, \ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXX, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, \ - KC_LSFT, XXXXXX, RGB_TOG,RGB_MOD,RGB_HUI,RGB_HUD,RGB_SAI,RGB_SAD,RGB_VAI,RGB_VAD, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, \ - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, ______, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, XXXXXX + KC_LSFT, XXXXXX, RGB_TOG,RGB_MOD,RGB_HUI,RGB_HUD,RGB_SAI,RGB_SAD,RGB_VAI,RGB_VAD, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, XXXXXX, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, ______, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT ), }; // const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {}; +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} -void matrix_init_user(void) { +void led_set_user(uint8_t usb_led) { } +void matrix_init_user(void) { + #ifdef USE_I2C + i2c_master_init(); + #ifdef SSD1306OLED + // calls code for the SSD1306 OLED + _delay_ms(400); + TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); + iota_gfx_init(); // turns on the display + #endif + #endif + #ifdef AUDIO_ENABLE + startup_user(); + #endif +} void matrix_scan_user(void) { - + #ifdef SSD1306OLED + iota_gfx_task(); // this is what updates the display continuously + #endif } -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - return true; +void matrix_update(struct CharacterMatrix *dest, + const struct CharacterMatrix *source) { + if (memcmp(dest->display, source->display, sizeof(dest->display))) { + memcpy(dest->display, source->display, sizeof(dest->display)); + dest->dirty = true; + } } -void led_set_user(uint8_t usb_led) { +void iota_gfx_task_user(void) { +#if DEBUG_TO_SCREEN + if (debug_enable) { + return; + } +#endif + + struct CharacterMatrix matrix; + + matrix_clear(&matrix); + matrix_write_P(&matrix, PSTR("TKC1800")); + + uint8_t layer = biton32(layer_state); + + char buf[40]; + snprintf(buf,sizeof(buf), "Undef-%d", layer); + matrix_write_P(&matrix, PSTR("\nLayer: ")); + matrix_write(&matrix, layer_lookup[layer]); + // Host Keyboard LED Status + char led[40]; + snprintf(led, sizeof(led), "\n\n%s %s %s", + (host_keyboard_leds() & (1< + * + * 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 CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#define USE_I2C +#define SSD1306OLED +//#define OLED_ROTATE180 +#define SSD1306_ADDRESS 0x3C + +// place overrides here + +#endif diff --git a/keyboards/tkc1800/keymaps/wkl/keymap.c b/keyboards/tkc1800/keymaps/wkl/keymap.c new file mode 100644 index 00000000..b72a77c2 --- /dev/null +++ b/keyboards/tkc1800/keymaps/wkl/keymap.c @@ -0,0 +1,145 @@ +/* Copyright 2017 Mathias Andersson + * + * 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 "tkc1800.h" +#include "LUFA/Drivers/Peripheral/TWI.h" +#include "i2c.h" +#include "ssd1306.h" + + +#define MODS_SHFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) +#define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) + + +// Helpful defines +#define ______ KC_TRNS +#define XXXXXX KC_NO + +//Layers + +enum { + BASE = 0, + FUNCTION, +}; + +//13 characters max without re-writing the "Layer: " format in iota_gfx_task_user() +static char layer_lookup[][14] = {"Base","Function"}; + + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap BASE: (Base Layer) Default Layer + * ,-------------------------------------------------------. ,-------------------. + * |Esc| F1| F2| F3| F4| | F5| F6| F7| F8| | F9|F10|F11|F12| |Ins |Home|PgUp|PrSc| + * `-------------------------------------------------------' |-------------------| + * |Del |End |PgDn|ScrL| + * ,-----------------------------------------------------------. |-------------------| + * | ~ | 1 | 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |NumL| / | * |Paus| + * |-----------------------------------------------------------| |-------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | | 7 | 8 | 9 | - | + * |-----------------------------------------------------------| |-------------------| + * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return | | 4 | 5 | 6 | + | + * |-----------------------------------------------------------' |-------------------| + * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | Up | 1 | 2 | 3 | Ent| + * |--------------------------------------------------------'----`--------------| | + * |Ctrl|Gui |Alt | Space |Alt |Gui|Ctr|Left |Down|Rght| 0 | . | | + * `---------------------------------------------------------------------------------' + */ + [BASE] = KEYMAP( + KC_ESC, 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_INS, KC_HOME, KC_PGUP, KC_PSCR, \ + KC_DEL, KC_END, KC_PGDN, KC_SLCK, \ + KC_GRV, 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, XXXXXX, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ + KC_TAB, 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, KC_P7, KC_P8, KC_P9, KC_PMNS, \ + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXX, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, \ + KC_LSFT, XXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, XXXXXX, \ + KC_LCTL, KC_LALT, XXXXXX, KC_SPC, XXXXXX, MO(FUNCTION), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT + ), + [FUNCTION] = KEYMAP( + KC_ESC, 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_INS, KC_HOME, KC_PGUP, KC_PSCR, \ + KC_DEL, KC_END, KC_PGDN, KC_SLCK, \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, RESET, XXXXXX, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ + KC_TAB, 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, KC_P7, KC_P8, KC_P9, KC_PMNS, \ + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXX, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, \ + KC_LSFT, XXXXXX, RGB_TOG,RGB_MOD,RGB_HUI,RGB_HUD,RGB_SAI,RGB_SAD,RGB_VAI,RGB_VAD, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, XXXXXX, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, XXXXXX, ______, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT + ), +}; + +// const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} +void matrix_init_user(void) { + #ifdef USE_I2C + i2c_master_init(); + #ifdef SSD1306OLED + // calls code for the SSD1306 OLED + _delay_ms(400); + TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); + iota_gfx_init(); // turns on the display + #endif + #endif + #ifdef AUDIO_ENABLE + startup_user(); + #endif +} + +void matrix_scan_user(void) { + #ifdef SSD1306OLED + iota_gfx_task(); // this is what updates the display continuously + #endif +} + +void matrix_update(struct CharacterMatrix *dest, + const struct CharacterMatrix *source) { + if (memcmp(dest->display, source->display, sizeof(dest->display))) { + memcpy(dest->display, source->display, sizeof(dest->display)); + dest->dirty = true; + } +} + +void iota_gfx_task_user(void) { +#if DEBUG_TO_SCREEN + if (debug_enable) { + return; + } +#endif + + struct CharacterMatrix matrix; + + matrix_clear(&matrix); + matrix_write_P(&matrix, PSTR("TKC1800")); + + uint8_t layer = biton32(layer_state); + + char buf[40]; + snprintf(buf,sizeof(buf), "Undef-%d", layer); + matrix_write_P(&matrix, PSTR("\nLayer: ")); + matrix_write(&matrix, layer_lookup[layer]); + + // Host Keyboard LED Status + char led[40]; + snprintf(led, sizeof(led), "\n\n%s %s %s", + (host_keyboard_leds() & (1< Date: Sat, 20 Jan 2018 16:41:36 +0100 Subject: [PATCH 016/173] Fix compilation error when RGB light is disabled --- keyboards/ergodox_ez/keymaps/default/keymap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/keyboards/ergodox_ez/keymaps/default/keymap.c b/keyboards/ergodox_ez/keymaps/default/keymap.c index 3c15b8a4..e400ffcd 100644 --- a/keyboards/ergodox_ez/keymaps/default/keymap.c +++ b/keyboards/ergodox_ez/keymaps/default/keymap.c @@ -217,8 +217,10 @@ uint32_t layer_state_set_user(uint32_t state) { #ifdef RGBLIGHT_COLOR_LAYER_0 rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); #else + #ifdef RGBLIGHT_ENABLE rgblight_init(); #endif + #endif break; case 1: ergodox_right_led_1_on(); From b9b67e9614eed1634850a3a0b05711b90ee98fe1 Mon Sep 17 00:00:00 2001 From: Alex Vogel Date: Thu, 25 Jan 2018 07:03:49 +0100 Subject: [PATCH 017/173] [Keymap] semi-ISO Spanish HHKB Keymap for Satan Keyboards (#2290) * ISO HHKB first commit * First version of my HHKB ISO Spanish Keymap * Readme.md * Added more media keys. Caps Lock added on function layer. Backlight toggle added on funtion layer. * RGB support for WS2812B RGB led strip * RGB and brightness control. --- keyboards/satan/keymaps/isoHHKB/keymap.c | 110 ++++++++++++++++++ keyboards/satan/keymaps/isoHHKB/readme.md | 55 +++++++++ keyboards/satan/keymaps/isoHHKB/rules.mk | 21 ++++ .../satan/keymaps/isoHHKB/stunny_iso_hhkb.h | 21 ++++ 4 files changed, 207 insertions(+) create mode 100644 keyboards/satan/keymaps/isoHHKB/keymap.c create mode 100644 keyboards/satan/keymaps/isoHHKB/readme.md create mode 100644 keyboards/satan/keymaps/isoHHKB/rules.mk create mode 100644 keyboards/satan/keymaps/isoHHKB/stunny_iso_hhkb.h diff --git a/keyboards/satan/keymaps/isoHHKB/keymap.c b/keyboards/satan/keymaps/isoHHKB/keymap.c new file mode 100644 index 00000000..a14c5c39 --- /dev/null +++ b/keyboards/satan/keymaps/isoHHKB/keymap.c @@ -0,0 +1,110 @@ +#include "satan.h" +#include "stunny_iso_hhkb.h" + +// Used for SHIFT_ESC +#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _BL 0 +#define _FL 1 + +#define KC_ENYE M(0) +#define KC_CEDL M(1) + +#define _______ KC_TRNS + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap _BL: (Base Layer) Default Layer + * ,-----------------------------------------------------------. + * |Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | + * |-----------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Ret | + * |-----------------------------------------------------------| + * |Ctrl | A| S| D| F| G| H| J| K| L| Ñ| ;| ' |urn| + * |-----------------------------------------------------------| + * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | Fn| + * |-----------------------------------------------------------| + * | |Alt|WinK | Space |WinK |Alt| | + * `-----------------------------------------------------------' + * + */ + + [_BL] = KEYMAP_ISO_HHKB( \ + F(0), 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, \ + KC_TAB, 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_LCTRL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENYE,KC_SCLN,KC_QUOT,KC_ENT, \ + OSM(MOD_LSFT),_______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, OSM(MOD_RSFT), MO(_FL), \ + _______, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI,_______, _______), + + /* Keymap _FL: (Function Layer) Second Layer + * ,-----------------------------------------------------------. + * | |F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|PSR| RESET| + * |-----------------------------------------------------------| + * | | |VUP| | | | | | | | | | | | + * |-----------------------------------------------------------| + * |CapsLck|PRV|VDN|NXT| |RGB|FRW|BRT|VAI|VAD|INC|DEC| | | + * |-----------------------------------------------------------| + * | | | | Ç| |BTG| |MUT| | | | | | + * |-----------------------------------------------------------| + * | | | | PLY/PAU | | | | + * `-----------------------------------------------------------' + */ + [_FL] = KEYMAP_ISO_HHKB(\ + + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_PSCR, RESET, \ + _______,_______,KC_VOLU,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______, _______, \ + KC_CAPS,KC_MPRV,KC_VOLD,KC_MNXT,_______,_______,RGB_TOG,RGB_MOD,RGB_M_B,RGB_VAI,RGB_VAD,BL_INC, BL_DEC, _______, \ + _______,_______,_______,_______,KC_CEDL,_______,BL_TOGG,_______,KC_MUTE,_______,_______,_______,_______, _______, \ + _______,_______,_______, KC_MPLY, _______,_______,_______, _______) + +}; + +enum function_id { + SHIFT_ESC, +}; + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_FUNCTION(SHIFT_ESC), +}; + +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { + static uint8_t shift_esc_shift_mask; + switch (id) { + case SHIFT_ESC: + shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK; + if (record->event.pressed) { + if (shift_esc_shift_mask) { + add_key(KC_GRV); + send_keyboard_report(); + } else { + add_key(KC_ESC); + send_keyboard_report(); + } + } else { + if (shift_esc_shift_mask) { + del_key(KC_GRV); + send_keyboard_report(); + } else { + del_key(KC_ESC); + send_keyboard_report(); + } + } + break; + } +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + if (record->event.pressed) { + switch(id) { + case 0: // Ñ + return MACRO(D(LALT), T(KP_0), T(KP_2), T(KP_4), T(KP_1), U(LALT), END); + case 1: // Ç + return MACRO(D(LALT), T(KP_0), T(KP_2), T(KP_3), T(KP_1), U(LALT), END); + } + } + return MACRO_NONE; +}; diff --git a/keyboards/satan/keymaps/isoHHKB/readme.md b/keyboards/satan/keymaps/isoHHKB/readme.md new file mode 100644 index 00000000..60454efb --- /dev/null +++ b/keyboards/satan/keymaps/isoHHKB/readme.md @@ -0,0 +1,55 @@ +# HKKB-ISO Satan Layout by Stunny + +This layout combines the split Right Shift ISO layout with the popular HHKB layout. The Caps Lock key will be replaced in the default layout by the Control key, which is more convenient for some people. + +This version is designed to have in its base layer letter 'Ñ' for Spanish writing. Also, 'ç' is included for those who have to write in French, Catalan or other languages that may need it. + +This keymap also supports control for a WS2812B RGB led strip connected to pin E2 of the microcontroller. If you want more functionalities, pls check RGB documentation at [QMK Docs]( https://docs.qmk.fm/feature_rgblight.html#rgb-lighting). This also goes for backlighting functionalities. If you want more control, check [QMK Docs](https://docs.qmk.fm/feature_backlight.html#backlighting) on that. + +Base Layer: + +``` +,-----------------------------------------------------------. +|Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | +|-----------------------------------------------------------| +|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Ret | +|-----------------------------------------------------------| +|Ctrl | A| S| D| F| G| H| J| K| L| Ñ| ;| ' |urn| +|-----------------------------------------------------------| +|Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | Fn| +|-----------------------------------------------------------| +| |Alt|LGUI | Space |RGUI |Alt| | +`-----------------------------------------------------------' +``` + +Function Layer +``` +,-----------------------------------------------------------. +| |F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|PSR| RESET| +|-----------------------------------------------------------| +| | |VUP| | | | | | | | | | | | +|-----------------------------------------------------------| +|CapsLck|PRV|VDN|NXT| |RGB|FRW|BRT|VAI|VAD|INC|DEC| | | +|-----------------------------------------------------------| +| | | | Ç| |BTG| |MUT| | | | | | +|-----------------------------------------------------------| +| | | | PLY/PAU | | | | +`-----------------------------------------------------------' +``` + +Where: +- `PRV` is `KC_MEDIA_PREV_TRACK` +- `NXT` is `KC_MEDIA_NEXT_TRACK` +- `VUP` is `KC_AUDIO_VOL_UP` +- `VDN` is `KC_AUDIO_VOL_DOWN` +- `MUT` is `KC_AUDIO_MUTE` +- `PLY/PAU` is `KC_MEDIA_PLAY_PAUSE` +- `BTG` is `BL_TOGG` (toggles key backlighting) +- `INC` increases backlighting brightness +- `DEC` decreases backlighting brightness +- `PSR` is `KC_PSCREEN` +- `RGB` is `RGB_TOG` +- `FRW` jumps to next RGB mode +- `BRT` activates RGB breathing mode directly +- `VAI` increases RGB brightness +- `VAD` decreases RGB brightness diff --git a/keyboards/satan/keymaps/isoHHKB/rules.mk b/keyboards/satan/keymaps/isoHHKB/rules.mk new file mode 100644 index 00000000..026b33c7 --- /dev/null +++ b/keyboards/satan/keymaps/isoHHKB/rules.mk @@ -0,0 +1,21 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/satan/keymaps/isoHHKB/stunny_iso_hhkb.h b/keyboards/satan/keymaps/isoHHKB/stunny_iso_hhkb.h new file mode 100644 index 00000000..b5737f5a --- /dev/null +++ b/keyboards/satan/keymaps/isoHHKB/stunny_iso_hhkb.h @@ -0,0 +1,21 @@ +#ifndef STUNNY_ISO_HHKB_H +#define STUNNY_ISO_HHKB_H + +/* Satan ISO - HHKB matrix layout + * With 7u space bar, split right shift and 2u Backspace + * ,------------------------------------------------------------. + * | 00 |01| 02| 03| 04| 05| 06| 07| 08| 09| 0a| 0b| 0c| 0d | + * |------------------------------------------------------------| + * | 10 | 11| 12| 13| 14| 15| 16| 17| 18| 19| 1a| 1b| 1c| | + * |------------------------------------------------------------| + * | 20 | 21| 22| 23| 24| 25| 26| 27| 28| 29| 2a| 2b| 2c| 2d | + * |------------------------------------------------------------| + * | 30 | 32| 33| 34| 35| 36| 37| 38| 39| 3a| 3b| 3d | 3c | + * |------------------------------------------------------------| + * | | 41| 42 | 45 | 4a | 4b | | | + * `------------------------------------------------------------' + */ + +#define KEYMAP_ISO_HHKB KEYMAP_ISO_SPLITRSHIFT + +#endif From ed659aa3a84b415f91e640ffaaec2b97e78623c3 Mon Sep 17 00:00:00 2001 From: na7thana Date: Wed, 24 Jan 2018 22:04:31 -0800 Subject: [PATCH 018/173] Hi there :) (#2273) --- keyboards/jc65/keymaps/na7thana/config.h | 1 + keyboards/jc65/keymaps/na7thana/keymap.c | 18 ++++++++++++++++++ keyboards/jc65/keymaps/na7thana/readme.md | 10 ++++++++++ keyboards/jc65/keymaps/na7thana/rules.mk | 0 4 files changed, 29 insertions(+) create mode 100644 keyboards/jc65/keymaps/na7thana/config.h create mode 100644 keyboards/jc65/keymaps/na7thana/keymap.c create mode 100644 keyboards/jc65/keymaps/na7thana/readme.md create mode 100644 keyboards/jc65/keymaps/na7thana/rules.mk diff --git a/keyboards/jc65/keymaps/na7thana/config.h b/keyboards/jc65/keymaps/na7thana/config.h new file mode 100644 index 00000000..a5568e40 --- /dev/null +++ b/keyboards/jc65/keymaps/na7thana/config.h @@ -0,0 +1 @@ +#include "../../config.h" diff --git a/keyboards/jc65/keymaps/na7thana/keymap.c b/keyboards/jc65/keymaps/na7thana/keymap.c new file mode 100644 index 00000000..2f262efa --- /dev/null +++ b/keyboards/jc65/keymaps/na7thana/keymap.c @@ -0,0 +1,18 @@ +#include "jc65.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = KEYMAP( + KC_GESC, 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_NO, KC_BSLS, KC_HOME, + KC_TAB, 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_BSPC, KC_PGUP, + KC_LCTL, 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_PGDN, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, MO(1), + KC_LCTL, KC_LALT, KC_LALT, KC_SPACE, KC_SPACE, KC_SPACE, KC_SPACE, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT + ), + [1] = KEYMAP( + RESET, 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_HOME, KC_END, KC_DEL, KC_TRNS, + KC_CAPS, RGB_TOG, RGB_MOD, RGB_RMOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLU, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_MPLY, KC_MPLY, KC_VOLU, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_VOLD, KC_TRNS + ), +}; \ No newline at end of file diff --git a/keyboards/jc65/keymaps/na7thana/readme.md b/keyboards/jc65/keymaps/na7thana/readme.md new file mode 100644 index 00000000..13430a63 --- /dev/null +++ b/keyboards/jc65/keymaps/na7thana/readme.md @@ -0,0 +1,10 @@ +Default Keymap +=== + +Super simple default keymap with only a base layer. + +Keymap Maintainer: [Ethan Madden](https://github.com/jetpacktuxedo) + +Difference from base layout: This is (as close as I can tell) the same as the layout that ships on the boards other than default underglow color. + +Intended usage: This is mostly provided for testing before you build your own keymap and as a reference to a stock(ish) configuration diff --git a/keyboards/jc65/keymaps/na7thana/rules.mk b/keyboards/jc65/keymaps/na7thana/rules.mk new file mode 100644 index 00000000..e69de29b From a9bbf9ee5cedcef9e7b7c88f8f7a3fa3b54e1800 Mon Sep 17 00:00:00 2001 From: manofinterests Date: Fri, 12 Jan 2018 19:41:14 -0800 Subject: [PATCH 019/173] hi there friends --- .../66/keymaps/manofinterests/keymap.c | 39 +++++++++++++++++++ .../66/keymaps/manofinterests/readme.md | 8 ++++ 2 files changed, 47 insertions(+) create mode 100644 keyboards/clueboard/66/keymaps/manofinterests/keymap.c create mode 100644 keyboards/clueboard/66/keymaps/manofinterests/readme.md diff --git a/keyboards/clueboard/66/keymaps/manofinterests/keymap.c b/keyboards/clueboard/66/keymaps/manofinterests/keymap.c new file mode 100644 index 00000000..ae74b12d --- /dev/null +++ b/keyboards/clueboard/66/keymaps/manofinterests/keymap.c @@ -0,0 +1,39 @@ +#include "66.h" + +// Helpful defines +#define _______ KC_TRNS + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +#define _BL 0 +#define _FL 1 +#define _CL 2 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap _BL: Base Layer (Default Layer) + */ +[_BL] = KEYMAP( + KC_GESC,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_GRV, KC_BSPC, RGB_VAI, \ + KC_TAB, 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, RGB_VAD, \ + KC_CAPS,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,KC_NUHS,KC_ENT, \ + KC_LSFT,KC_NUBS,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RO, KC_RSFT, KC_UP, \ + KC_LCTL,KC_LGUI,KC_LALT,KC_MHEN, KC_SPC, KC_SPC, KC_HENK,KC_RALT,MO(_FL),KC_RCTL,KC_LEFT,KC_DOWN,KC_RGHT), + + /* Keymap _FL: Function Layer + */ +[_FL] = KEYMAP( + 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, KC_VOLU, \ + _______,_______,_______,_______,_______,_______,_______,_______,_______,KC_MPRV,KC_MPLY,KC_MNXT,_______,KC_MUTE, KC_VOLD, \ + _______,_______,MO(_CL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \ + _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, KC_PGUP, \ + _______,_______,_______,_______, _______,_______, _______,_______,MO(_FL),_______,KC_HOME,KC_PGDN,KC_END), + + /* Keymap _CL: Control layer + */ +[_CL] = KEYMAP( + BL_STEP,RGB_M_P,RGB_M_B,RGB_M_R,RGB_M_SW,RGB_M_SN,RGB_M_K,RGB_M_X,RGB_M_G,_______,_______,_______,_______,_______,RGB_TOG, RGB_VAI, \ + _______,_______,_______,_______,RESET, _______,_______,_______,_______,_______,_______,_______,_______,_______, RGB_VAD, \ + _______,_______,MO(_CL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \ + MO(_FL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, RGB_SAI, \ + _______,_______,_______,_______, RGB_MOD, RGB_MOD, _______,_______,MO(_FL),_______,RGB_HUD,RGB_SAD,RGB_HUI), +}; diff --git a/keyboards/clueboard/66/keymaps/manofinterests/readme.md b/keyboards/clueboard/66/keymaps/manofinterests/readme.md new file mode 100644 index 00000000..019131ae --- /dev/null +++ b/keyboards/clueboard/66/keymaps/manofinterests/readme.md @@ -0,0 +1,8 @@ +![Clueboard Layout Image](http://i.imgur.com/7Capi8W.png) + +# Default Clueboard Layout + +This is the default layout that comes flashed on every Clueboard. For the most +part it's a straightforward and easy to follow layout. The only unusual key is +the key in the upper left, which sends Escape normally, but Grave when any of +the Ctrl, Alt, or GUI modifiers are held down. From 13d288116f59b6ea502f65ef669daeaf00433d21 Mon Sep 17 00:00:00 2001 From: Mason McAllaster Date: Thu, 25 Jan 2018 01:09:37 -0500 Subject: [PATCH 020/173] Adding personal keymap for planck/niu_mini (#2263) * Adding mason keymap for planck/niu_mini * Adding power shortcut --- keyboards/niu_mini/keymaps/mason/keymap.c | 116 ++++++++++++++++++++++ keyboards/planck/keymaps/mason/keymap.c | 116 ++++++++++++++++++++++ 2 files changed, 232 insertions(+) create mode 100644 keyboards/niu_mini/keymaps/mason/keymap.c create mode 100644 keyboards/planck/keymaps/mason/keymap.c diff --git a/keyboards/niu_mini/keymaps/mason/keymap.c b/keyboards/niu_mini/keymaps/mason/keymap.c new file mode 100644 index 00000000..09a755a8 --- /dev/null +++ b/keyboards/niu_mini/keymaps/mason/keymap.c @@ -0,0 +1,116 @@ +#include "niu_mini.h" + +enum layers { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST +}; + +enum keycodes { + LOWER, + RAISE +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ;: | '" | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | ,< | .> | /? |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Caps | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_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_LCTL, 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_CAPS, KC_ESC, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | | ! | @ | # | $ | % | ^ | & | * | ( | ) | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 | ~ | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = { + {_______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______}, + {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, _______}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_GRV), S(KC_BSLS), _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | Ins | Home | PgUp | | | | - | = | [ | ] | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | Del | End | PgDn | | | | ` | \ | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = { + {_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______}, + {_______, KC_INS, KC_HOME, KC_PGUP, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, _______}, + {_______, KC_DEL, KC_END, KC_PGDN, _______, _______, _______, KC_GRV, KC_BSLS, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | Reset| | | | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | |BLtogg|BLstep| | | | | | | | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | |RGBtog|RGBhui|RGBhud|RGBmod|RGBsai|RGBsad| | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = { + {_______, RESET, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, KC_POWER}, + {_______, BL_TOGG, BL_STEP, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, RGB_TOG, RGB_HUI, RGB_HUD, RGB_MOD, RGB_SAI, RGB_SAD, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +} + + +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + } + return true; +} diff --git a/keyboards/planck/keymaps/mason/keymap.c b/keyboards/planck/keymaps/mason/keymap.c new file mode 100644 index 00000000..87039cf4 --- /dev/null +++ b/keyboards/planck/keymaps/mason/keymap.c @@ -0,0 +1,116 @@ +#include "planck.h" + +enum planck_layers { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST +}; + +enum planck_keycodes { + LOWER, + RAISE +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ;: | '" | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | ,< | .> | /? |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Caps | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_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_LCTL, 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_CAPS, KC_ESC, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | | ! | @ | # | $ | % | ^ | & | * | ( | ) | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 | ~ | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = { + {_______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______}, + {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, _______}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_GRV), S(KC_BSLS), _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | Ins | Home | PgUp | | | | - | = | [ | ] | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | Del | End | PgDn | | | | ` | \ | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = { + {_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______}, + {_______, KC_INS, KC_HOME, KC_PGUP, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, _______}, + {_______, KC_DEL, KC_END, KC_PGDN, _______, _______, _______, KC_GRV, KC_BSLS, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | Reset| | | | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | |BLtogg|BLstep| | | | | | | | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | |RGBtog|RGBhui|RGBhud|RGBmod|RGBsai|RGBsad| | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = { + {_______, RESET, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, KC_POWER}, + {_______, BL_TOGG, BL_STEP, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, RGB_TOG, RGB_HUI, RGB_HUD, RGB_MOD, RGB_SAI, RGB_SAD, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +} + + +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + } + return true; +} From 86225ccc9b22f6b7b3cbbb9c5c578ea31f2214fa Mon Sep 17 00:00:00 2001 From: Gabriel Rauter Date: Fri, 26 Jan 2018 13:57:09 +0100 Subject: [PATCH 021/173] katana60: fix bootloader size to work with PCB Fix the bootloader size so the `RESET` key actually resets to the bootloader instead of just restarting the boards. --- keyboards/katana60/rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/katana60/rules.mk b/keyboards/katana60/rules.mk index a3571e8d..ca2a2a5f 100644 --- a/keyboards/katana60/rules.mk +++ b/keyboards/katana60/rules.mk @@ -45,7 +45,7 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT # Atmel DFU loader 4096 # LUFA bootloader 4096 # USBaspLoader 2048 -OPT_DEFS += -DBOOTLOADER_SIZE=512 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 # Build Options From bceffdefcac30dd8b08ec3b803af372cbf254a7b Mon Sep 17 00:00:00 2001 From: MakotoKurauchi Date: Mon, 29 Jan 2018 02:14:12 +0900 Subject: [PATCH 022/173] Add helix keyboard (#2308) * Fork from Let's Split * Organizing files * Delete some keymaps * I2C and serial enabled at the same time * Change readme * add #define HELIX_ROWS for multiple rows * Delete avrdude flashing script * Delete makefiles * Subproject elimination * Fix lufa path * Remove PLAY_NOTE_ARRAY usages to get rid of warning. Fix conflicting function name * Mousekey change default to off * Fix to oled display adjust * make rev2 change pin assign change keymap * use master_buffer * Timing adjustment * Organizing files * Change Keymap * Change Keymap Add EISU and KANA Correct 4rows * NKRO default to disable * EXTRAKEY_ENABLE default to disable * add rgb reset key * rgb custom function enable * Extend font * add RGBLED_POWER default folder to helix/rev2 RGB_ENABLE to no * renamed directory * Disable RGBLIGHT_CUSTOM_DRIVER * Disable LOCKING_SUPPORT_ENABLE * Update bootloader setting * Change readme * Fixed argument error --- keyboards/helix/common/glcdfont.c | 244 +++++++ keyboards/helix/config.h | 28 + keyboards/helix/helix.c | 1 + keyboards/helix/helix.h | 57 ++ keyboards/helix/i2c.c | 162 +++++ keyboards/helix/i2c.h | 49 ++ keyboards/helix/pro_micro.h | 362 ++++++++++ keyboards/helix/readme.md | 16 + keyboards/helix/rev1/config.h | 103 +++ .../helix/rev1/keymaps/OLED_sample/config.h | 54 ++ .../helix/rev1/keymaps/OLED_sample/keymap.c | 498 ++++++++++++++ .../helix/rev1/keymaps/OLED_sample/readme.md | 25 + .../helix/rev1/keymaps/OLED_sample/rules.mk | 25 + keyboards/helix/rev1/keymaps/default/config.h | 37 ++ keyboards/helix/rev1/keymaps/default/keymap.c | 349 ++++++++++ keyboards/helix/rev1/keymaps/default/rules.mk | 3 + keyboards/helix/rev1/matrix.c | 316 +++++++++ keyboards/helix/rev1/rev1.c | 39 ++ keyboards/helix/rev1/rev1.h | 145 +++++ keyboards/helix/rev1/rules.mk | 4 + keyboards/helix/rev1/split_util.c | 86 +++ keyboards/helix/rev1/split_util.h | 24 + keyboards/helix/rev2/config.h | 97 +++ keyboards/helix/rev2/keymaps/default/config.h | 54 ++ keyboards/helix/rev2/keymaps/default/keymap.c | 616 ++++++++++++++++++ .../helix/rev2/keymaps/default/readme.md | 25 + keyboards/helix/rev2/keymaps/default/rules.mk | 25 + keyboards/helix/rev2/matrix.c | 359 ++++++++++ keyboards/helix/rev2/rev2.c | 32 + keyboards/helix/rev2/rev2.h | 115 ++++ keyboards/helix/rev2/rules.mk | 3 + keyboards/helix/rev2/split_util.c | 71 ++ keyboards/helix/rev2/split_util.h | 23 + keyboards/helix/rules.mk | 73 +++ keyboards/helix/serial.c | 238 +++++++ keyboards/helix/serial.h | 36 + keyboards/helix/ssd1306.c | 324 +++++++++ keyboards/helix/ssd1306.h | 93 +++ 38 files changed, 4811 insertions(+) create mode 100644 keyboards/helix/common/glcdfont.c create mode 100644 keyboards/helix/config.h create mode 100644 keyboards/helix/helix.c create mode 100644 keyboards/helix/helix.h create mode 100644 keyboards/helix/i2c.c create mode 100644 keyboards/helix/i2c.h create mode 100644 keyboards/helix/pro_micro.h create mode 100644 keyboards/helix/readme.md create mode 100644 keyboards/helix/rev1/config.h create mode 100644 keyboards/helix/rev1/keymaps/OLED_sample/config.h create mode 100644 keyboards/helix/rev1/keymaps/OLED_sample/keymap.c create mode 100644 keyboards/helix/rev1/keymaps/OLED_sample/readme.md create mode 100644 keyboards/helix/rev1/keymaps/OLED_sample/rules.mk create mode 100644 keyboards/helix/rev1/keymaps/default/config.h create mode 100644 keyboards/helix/rev1/keymaps/default/keymap.c create mode 100644 keyboards/helix/rev1/keymaps/default/rules.mk create mode 100644 keyboards/helix/rev1/matrix.c create mode 100644 keyboards/helix/rev1/rev1.c create mode 100644 keyboards/helix/rev1/rev1.h create mode 100644 keyboards/helix/rev1/rules.mk create mode 100644 keyboards/helix/rev1/split_util.c create mode 100644 keyboards/helix/rev1/split_util.h create mode 100644 keyboards/helix/rev2/config.h create mode 100644 keyboards/helix/rev2/keymaps/default/config.h create mode 100644 keyboards/helix/rev2/keymaps/default/keymap.c create mode 100644 keyboards/helix/rev2/keymaps/default/readme.md create mode 100644 keyboards/helix/rev2/keymaps/default/rules.mk create mode 100644 keyboards/helix/rev2/matrix.c create mode 100644 keyboards/helix/rev2/rev2.c create mode 100644 keyboards/helix/rev2/rev2.h create mode 100644 keyboards/helix/rev2/rules.mk create mode 100644 keyboards/helix/rev2/split_util.c create mode 100644 keyboards/helix/rev2/split_util.h create mode 100644 keyboards/helix/rules.mk create mode 100644 keyboards/helix/serial.c create mode 100644 keyboards/helix/serial.h create mode 100644 keyboards/helix/ssd1306.c create mode 100644 keyboards/helix/ssd1306.h diff --git a/keyboards/helix/common/glcdfont.c b/keyboards/helix/common/glcdfont.c new file mode 100644 index 00000000..89665ba0 --- /dev/null +++ b/keyboards/helix/common/glcdfont.c @@ -0,0 +1,244 @@ +// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. +// See gfxfont.h for newer custom bitmap font info. + +#ifndef FONT5X7_H +#define FONT5X7_H + +#ifdef __AVR__ + #include + #include +#elif defined(ESP8266) + #include +#else + #define PROGMEM +#endif + +// Standard ASCII 5x7 font + +static const unsigned char font[] PROGMEM = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, + 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, + 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, + 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, + 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, + 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, + 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, + 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, + 0x00, 0x18, 0x24, 0x18, 0x00, 0x00, + 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, + 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, + 0x26, 0x29, 0x79, 0x29, 0x26, 0x00, + 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, + 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, + 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00, + 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, + 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, + 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, + 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, + 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, + 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, + 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, + 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, + 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, + 0x10, 0x20, 0x7E, 0x20, 0x10, 0x00, + 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, + 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, + 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, + 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, + 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, + 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, + 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, + 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, + 0x23, 0x13, 0x08, 0x64, 0x62, 0x00, + 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, + 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, + 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, + 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, + 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, + 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, + 0x00, 0x80, 0x70, 0x30, 0x00, 0x00, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, + 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, + 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, + 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, + 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, + 0x72, 0x49, 0x49, 0x49, 0x46, 0x00, + 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, + 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, + 0x27, 0x45, 0x45, 0x45, 0x39, 0x00, + 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, + 0x41, 0x21, 0x11, 0x09, 0x07, 0x00, + 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, + 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, + 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, + 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, + 0x02, 0x01, 0x59, 0x09, 0x06, 0x00, + 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, + 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, + 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, + 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, + 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, + 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, + 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, + 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, + 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, + 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, + 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, + 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, + 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, + 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, + 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, + 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, + 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, + 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, + 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, + 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, + 0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, + 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, + 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, + 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, + 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, + 0x03, 0x04, 0x78, 0x04, 0x03, 0x00, + 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, + 0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, + 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, + 0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, + 0x04, 0x02, 0x01, 0x02, 0x04, 0x00, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, + 0x00, 0x03, 0x07, 0x08, 0x00, 0x00, + 0x20, 0x54, 0x54, 0x78, 0x40, 0x00, + 0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x28, 0x00, + 0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, + 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, + 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, + 0x18, 0xA4, 0xA4, 0x9C, 0x78, 0x00, + 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, + 0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, + 0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, + 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, + 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, + 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, + 0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, + 0xFC, 0x18, 0x24, 0x24, 0x18, 0x00, + 0x18, 0x24, 0x24, 0x18, 0xFC, 0x00, + 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, + 0x48, 0x54, 0x54, 0x54, 0x24, 0x00, + 0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, + 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, + 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, + 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, + 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, + 0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00, + 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, + 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, + 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, + 0x00, 0x41, 0x36, 0x08, 0x00, 0x00, + 0x02, 0x01, 0x02, 0x04, 0x02, 0x00, + 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, + 0x03, 0x07, 0x1F, 0x7F, 0xFF, 0xFF, + 0xFE, 0xF8, 0xF0, 0xC0, 0x20, 0xF8, + 0xFE, 0xFF, 0xFE, 0x79, 0x27, 0x1F, + 0x7F, 0xFF, 0xFF, 0xFE, 0xF8, 0xF0, + 0xC0, 0x20, 0xF8, 0xFE, 0xFF, 0xFF, + 0x7F, 0x3F, 0x3F, 0x7F, 0xFF, 0xFE, + 0xF8, 0xF0, 0xC0, 0x00, 0x00, 0x00, + 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0x7F, 0x7F, 0x7F, + 0xBF, 0xBF, 0xC0, 0xC0, 0xC0, 0xE0, + 0xE0, 0xE0, 0xE0, 0xF0, 0xF0, 0xF0, + 0xF8, 0x78, 0x78, 0x7C, 0x3C, 0x3C, + 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, + 0xBF, 0xBF, 0xDF, 0xDF, 0xEF, 0xEF, + 0x00, 0x03, 0x07, 0x1F, 0x7F, 0xFF, + 0xFF, 0xFF, 0xFE, 0xF8, 0xE0, 0xC0, + 0xE0, 0xF8, 0xFE, 0xFF, 0xFF, 0xFF, + 0x7F, 0x1F, 0x07, 0x03, 0x00, 0x00, + 0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, + 0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, + 0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, + 0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00, + 0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B, + 0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00, + 0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE, + 0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xC1, 0xF3, + 0xCF, 0xBF, 0x7F, 0xFF, 0xFF, 0xFC, + 0xFB, 0xE7, 0x81, 0x00, 0x00, 0x00, + 0x00, 0x80, 0xE3, 0xCF, 0x3F, 0xFF, + 0xFF, 0xFF, 0xFC, 0xFB, 0xE7, 0x81, + 0x00, 0x00, 0x00, 0x00, 0x81, 0xE7, + 0xFF, 0xFF, 0xFF, 0xFF, 0x3C, 0x00, + 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xF8, 0xF8, 0xFC, 0x7C, 0x7E, + 0x7E, 0x3E, 0xFE, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xF7, 0xF7, 0xF7, 0xFB, + 0xFB, 0x7D, 0x7D, 0x7D, 0xBE, 0xBE, + 0xBE, 0xDF, 0xDF, 0xE0, 0xE0, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0xFC, 0xFC, 0x7C, 0x7E, 0x7E, + 0x3E, 0x3E, 0x1F, 0x1F, 0x1F, 0x0F, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, + 0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xE7, 0x81, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, + 0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, + 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00, + 0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20, + 0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00, + 0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F, + 0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x60, 0x70, 0x7C, 0x7F, 0x7F, 0x7F, + 0x7F, 0x1F, 0x06, 0x01, 0x03, 0x0F, + 0x3F, 0x7F, 0x7F, 0x7E, 0x7C, 0x7C, + 0x7E, 0x7F, 0x7F, 0x7F, 0x1F, 0x06, + 0x01, 0x07, 0x0F, 0x3F, 0x7F, 0x7F, + 0x7E, 0x7C, 0x7C, 0x7E, 0x7F, 0x7F, + 0x3F, 0x0F, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7D, 0x7D, 0x3D, 0x3E, + 0x1E, 0x1F, 0x1F, 0x1F, 0x0F, 0x0F, + 0x07, 0x07, 0x07, 0x03, 0x03, 0x00, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, + 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x00, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x00, 0x40, 0x70, 0x78, 0x7E, 0x7F, + 0x7F, 0x7F, 0x3F, 0x0F, 0x03, 0x01, + 0x03, 0x0F, 0x3F, 0x7F, 0x7F, 0x7F, + 0x7E, 0x78, 0x70, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; +#endif // FONT5X7_H diff --git a/keyboards/helix/config.h b/keyboards/helix/config.h new file mode 100644 index 00000000..8f0524f9 --- /dev/null +++ b/keyboards/helix/config.h @@ -0,0 +1,28 @@ +/* +Copyright 2012 Jun Wako +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 CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +#ifdef SUBPROJECT_rev1 + #include "rev1/config.h" +#endif + +#endif diff --git a/keyboards/helix/helix.c b/keyboards/helix/helix.c new file mode 100644 index 00000000..539abd53 --- /dev/null +++ b/keyboards/helix/helix.c @@ -0,0 +1 @@ +#include "helix.h" diff --git a/keyboards/helix/helix.h b/keyboards/helix/helix.h new file mode 100644 index 00000000..cddeb883 --- /dev/null +++ b/keyboards/helix/helix.h @@ -0,0 +1,57 @@ +#ifndef HELIX_H +#define HELIX_H + +#ifdef KEYBOARD_helix_rev1 + #include "rev1.h" +#endif +#ifdef KEYBOARD_helix_rev2 + #include "rev2.h" +#endif + +#if HELIX_ROWS == 3 + #define KC_KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + ) \ + KEYMAP( \ + KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, \ + KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, \ + KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, \ + ) +#elif HELIX_ROWS == 4 + // Used to create a keymap using only KC_ prefixed keys + #define KC_KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \ + ) \ + KEYMAP( \ + KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, \ + KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, \ + KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, \ + KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35 \ + ) +#elif HELIX_ROWS == 5 + #define KC_KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35, \ + L40, L41, L42, L43, L44, L45, R40, R41, R42, R43, R44, R45 \ + ) \ + KEYMAP( \ + KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, \ + KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, \ + KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, \ + KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35, \ + KC_##L40, KC_##L41, KC_##L42, KC_##L43, KC_##L44, KC_##L45, KC_##R40, KC_##R41, KC_##R42, KC_##R43, KC_##R44, KC_##R45 \ + ) +#else + #error "expected HELIX_ROWS 3 or 4 or 5" +#endif + +#include "quantum.h" + +#endif diff --git a/keyboards/helix/i2c.c b/keyboards/helix/i2c.c new file mode 100644 index 00000000..084c890c --- /dev/null +++ b/keyboards/helix/i2c.c @@ -0,0 +1,162 @@ +#include +#include +#include +#include +#include +#include +#include "i2c.h" + +#ifdef USE_I2C + +// Limits the amount of we wait for any one i2c transaction. +// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is +// 9 bits, a single transaction will take around 90μs to complete. +// +// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit +// poll loop takes at least 8 clock cycles to execute +#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 + +#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) + +volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; + +static volatile uint8_t slave_buffer_pos; +static volatile bool slave_has_register_set = false; + +// Wait for an i2c operation to finish +inline static +void i2c_delay(void) { + uint16_t lim = 0; + while(!(TWCR & (1<10. + // Check datasheets for more info. + TWBR = ((F_CPU/SCL_CLOCK)-16)/2; +} + +// Start a transaction with the given i2c slave address. The direction of the +// transfer is set with I2C_READ and I2C_WRITE. +// returns: 0 => success +// 1 => error +uint8_t i2c_master_start(uint8_t address) { + TWCR = (1< slave ACK +// 1 => slave NACK +uint8_t i2c_master_write(uint8_t data) { + TWDR = data; + TWCR = (1<= SLAVE_BUFFER_SIZE ) { + ack = 0; + slave_buffer_pos = 0; + } + slave_has_register_set = true; + } else { + i2c_slave_buffer[slave_buffer_pos] = TWDR; + BUFFER_POS_INC(); + } + break; + + case TW_ST_SLA_ACK: + case TW_ST_DATA_ACK: + // master has addressed this device as a slave transmitter and is + // requesting data. + TWDR = i2c_slave_buffer[slave_buffer_pos]; + BUFFER_POS_INC(); + break; + + case TW_BUS_ERROR: // something went wrong, reset twi state + TWCR = 0; + default: + break; + } + // Reset everything, so we are ready for the next TWI interrupt + TWCR |= (1< + +#ifndef F_CPU +#define F_CPU 16000000UL +#endif + +#define I2C_READ 1 +#define I2C_WRITE 0 + +#define I2C_ACK 1 +#define I2C_NACK 0 + +#define SLAVE_BUFFER_SIZE 0x10 + +// i2c SCL clock frequency +#define SCL_CLOCK 400000L + +extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; + +void i2c_master_init(void); +uint8_t i2c_master_start(uint8_t address); +void i2c_master_stop(void); +uint8_t i2c_master_write(uint8_t data); +uint8_t i2c_master_read(int); +void i2c_reset_state(void); +void i2c_slave_init(uint8_t address); + + +static inline unsigned char i2c_start_read(unsigned char addr) { + return i2c_master_start((addr << 1) | I2C_READ); +} + +static inline unsigned char i2c_start_write(unsigned char addr) { + return i2c_master_start((addr << 1) | I2C_WRITE); +} + +// from SSD1306 scrips +extern unsigned char i2c_rep_start(unsigned char addr); +extern void i2c_start_wait(unsigned char addr); +extern unsigned char i2c_readAck(void); +extern unsigned char i2c_readNak(void); +extern unsigned char i2c_read(unsigned char ack); + +#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); + +#endif diff --git a/keyboards/helix/pro_micro.h b/keyboards/helix/pro_micro.h new file mode 100644 index 00000000..f9e7ed75 --- /dev/null +++ b/keyboards/helix/pro_micro.h @@ -0,0 +1,362 @@ +/* + pins_arduino.h - Pin definition functions for Arduino + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2007 David A. Mellis + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ +*/ + +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +// Workaround for wrong definitions in "iom32u4.h". +// This should be fixed in the AVR toolchain. +#undef UHCON +#undef UHINT +#undef UHIEN +#undef UHADDR +#undef UHFNUM +#undef UHFNUML +#undef UHFNUMH +#undef UHFLEN +#undef UPINRQX +#undef UPINTX +#undef UPNUM +#undef UPRST +#undef UPCONX +#undef UPCFG0X +#undef UPCFG1X +#undef UPSTAX +#undef UPCFG2X +#undef UPIENX +#undef UPDATX +#undef TCCR2A +#undef WGM20 +#undef WGM21 +#undef COM2B0 +#undef COM2B1 +#undef COM2A0 +#undef COM2A1 +#undef TCCR2B +#undef CS20 +#undef CS21 +#undef CS22 +#undef WGM22 +#undef FOC2B +#undef FOC2A +#undef TCNT2 +#undef TCNT2_0 +#undef TCNT2_1 +#undef TCNT2_2 +#undef TCNT2_3 +#undef TCNT2_4 +#undef TCNT2_5 +#undef TCNT2_6 +#undef TCNT2_7 +#undef OCR2A +#undef OCR2_0 +#undef OCR2_1 +#undef OCR2_2 +#undef OCR2_3 +#undef OCR2_4 +#undef OCR2_5 +#undef OCR2_6 +#undef OCR2_7 +#undef OCR2B +#undef OCR2_0 +#undef OCR2_1 +#undef OCR2_2 +#undef OCR2_3 +#undef OCR2_4 +#undef OCR2_5 +#undef OCR2_6 +#undef OCR2_7 + +#define NUM_DIGITAL_PINS 30 +#define NUM_ANALOG_INPUTS 12 + +#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) +#define TXLED0 PORTD |= (1<<5) +#define TXLED1 PORTD &= ~(1<<5) +#define RXLED0 PORTB |= (1<<0) +#define RXLED1 PORTB &= ~(1<<0) + +static const uint8_t SDA = 2; +static const uint8_t SCL = 3; +#define LED_BUILTIN 13 + +// Map SPI port to 'new' pins D14..D17 +static const uint8_t SS = 17; +static const uint8_t MOSI = 16; +static const uint8_t MISO = 14; +static const uint8_t SCK = 15; + +// Mapping of analog pins as digital I/O +// A6-A11 share with digital pins +static const uint8_t ADC0 = 18; +static const uint8_t ADC1 = 19; +static const uint8_t ADC2 = 20; +static const uint8_t ADC3 = 21; +static const uint8_t ADC4 = 22; +static const uint8_t ADC5 = 23; +static const uint8_t ADC6 = 24; // D4 +static const uint8_t ADC7 = 25; // D6 +static const uint8_t ADC8 = 26; // D8 +static const uint8_t ADC9 = 27; // D9 +static const uint8_t ADC10 = 28; // D10 +static const uint8_t ADC11 = 29; // D12 + +#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) +#define digitalPinToPCICRbit(p) 0 +#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) +#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) + +// __AVR_ATmega32U4__ has an unusual mapping of pins to channels +extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; +#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) + +#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) + +#ifdef ARDUINO_MAIN + +// On the Arduino board, digital pins are also used +// for the analog output (software PWM). Analog input +// pins are a separate set. + +// ATMEL ATMEGA32U4 / ARDUINO LEONARDO +// +// D0 PD2 RXD1/INT2 +// D1 PD3 TXD1/INT3 +// D2 PD1 SDA SDA/INT1 +// D3# PD0 PWM8/SCL OC0B/SCL/INT0 +// D4 A6 PD4 ADC8 +// D5# PC6 ??? OC3A/#OC4A +// D6# A7 PD7 FastPWM #OC4D/ADC10 +// D7 PE6 INT6/AIN0 +// +// D8 A8 PB4 ADC11/PCINT4 +// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5 +// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6 +// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7 +// D12 A11 PD6 T1/#OC4D/ADC9 +// D13# PC7 PWM10 CLK0/OC4A +// +// A0 D18 PF7 ADC7 +// A1 D19 PF6 ADC6 +// A2 D20 PF5 ADC5 +// A3 D21 PF4 ADC4 +// A4 D22 PF1 ADC1 +// A5 D23 PF0 ADC0 +// +// New pins D14..D17 to map SPI port to digital pins +// +// MISO D14 PB3 MISO,PCINT3 +// SCK D15 PB1 SCK,PCINT1 +// MOSI D16 PB2 MOSI,PCINT2 +// SS D17 PB0 RXLED,SS/PCINT0 +// +// Connected LEDs on board for TX and RX +// TXLED D24 PD5 XCK1 +// RXLED D17 PB0 +// HWB PE2 HWB + +// these arrays map port names (e.g. port B) to the +// appropriate addresses for various functions (e.g. reading +// and writing) +const uint16_t PROGMEM port_to_mode_PGM[] = { + NOT_A_PORT, + NOT_A_PORT, + (uint16_t) &DDRB, + (uint16_t) &DDRC, + (uint16_t) &DDRD, + (uint16_t) &DDRE, + (uint16_t) &DDRF, +}; + +const uint16_t PROGMEM port_to_output_PGM[] = { + NOT_A_PORT, + NOT_A_PORT, + (uint16_t) &PORTB, + (uint16_t) &PORTC, + (uint16_t) &PORTD, + (uint16_t) &PORTE, + (uint16_t) &PORTF, +}; + +const uint16_t PROGMEM port_to_input_PGM[] = { + NOT_A_PORT, + NOT_A_PORT, + (uint16_t) &PINB, + (uint16_t) &PINC, + (uint16_t) &PIND, + (uint16_t) &PINE, + (uint16_t) &PINF, +}; + +const uint8_t PROGMEM digital_pin_to_port_PGM[] = { + PD, // D0 - PD2 + PD, // D1 - PD3 + PD, // D2 - PD1 + PD, // D3 - PD0 + PD, // D4 - PD4 + PC, // D5 - PC6 + PD, // D6 - PD7 + PE, // D7 - PE6 + + PB, // D8 - PB4 + PB, // D9 - PB5 + PB, // D10 - PB6 + PB, // D11 - PB7 + PD, // D12 - PD6 + PC, // D13 - PC7 + + PB, // D14 - MISO - PB3 + PB, // D15 - SCK - PB1 + PB, // D16 - MOSI - PB2 + PB, // D17 - SS - PB0 + + PF, // D18 - A0 - PF7 + PF, // D19 - A1 - PF6 + PF, // D20 - A2 - PF5 + PF, // D21 - A3 - PF4 + PF, // D22 - A4 - PF1 + PF, // D23 - A5 - PF0 + + PD, // D24 - PD5 + PD, // D25 / D6 - A7 - PD7 + PB, // D26 / D8 - A8 - PB4 + PB, // D27 / D9 - A9 - PB5 + PB, // D28 / D10 - A10 - PB6 + PD, // D29 / D12 - A11 - PD6 +}; + +const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { + _BV(2), // D0 - PD2 + _BV(3), // D1 - PD3 + _BV(1), // D2 - PD1 + _BV(0), // D3 - PD0 + _BV(4), // D4 - PD4 + _BV(6), // D5 - PC6 + _BV(7), // D6 - PD7 + _BV(6), // D7 - PE6 + + _BV(4), // D8 - PB4 + _BV(5), // D9 - PB5 + _BV(6), // D10 - PB6 + _BV(7), // D11 - PB7 + _BV(6), // D12 - PD6 + _BV(7), // D13 - PC7 + + _BV(3), // D14 - MISO - PB3 + _BV(1), // D15 - SCK - PB1 + _BV(2), // D16 - MOSI - PB2 + _BV(0), // D17 - SS - PB0 + + _BV(7), // D18 - A0 - PF7 + _BV(6), // D19 - A1 - PF6 + _BV(5), // D20 - A2 - PF5 + _BV(4), // D21 - A3 - PF4 + _BV(1), // D22 - A4 - PF1 + _BV(0), // D23 - A5 - PF0 + + _BV(5), // D24 - PD5 + _BV(7), // D25 / D6 - A7 - PD7 + _BV(4), // D26 / D8 - A8 - PB4 + _BV(5), // D27 / D9 - A9 - PB5 + _BV(6), // D28 / D10 - A10 - PB6 + _BV(6), // D29 / D12 - A11 - PD6 +}; + +const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + TIMER0B, /* 3 */ + NOT_ON_TIMER, + TIMER3A, /* 5 */ + TIMER4D, /* 6 */ + NOT_ON_TIMER, + + NOT_ON_TIMER, + TIMER1A, /* 9 */ + TIMER1B, /* 10 */ + TIMER0A, /* 11 */ + + NOT_ON_TIMER, + TIMER4A, /* 13 */ + + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, +}; + +const uint8_t PROGMEM analog_pin_to_channel_PGM[] = { + 7, // A0 PF7 ADC7 + 6, // A1 PF6 ADC6 + 5, // A2 PF5 ADC5 + 4, // A3 PF4 ADC4 + 1, // A4 PF1 ADC1 + 0, // A5 PF0 ADC0 + 8, // A6 D4 PD4 ADC8 + 10, // A7 D6 PD7 ADC10 + 11, // A8 D8 PB4 ADC11 + 12, // A9 D9 PB5 ADC12 + 13, // A10 D10 PB6 ADC13 + 9 // A11 D12 PD6 ADC9 +}; + +#endif /* ARDUINO_MAIN */ + +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#define SERIAL_PORT_MONITOR Serial +#define SERIAL_PORT_USBVIRTUAL Serial +#define SERIAL_PORT_HARDWARE Serial1 +#define SERIAL_PORT_HARDWARE_OPEN Serial1 + +#endif /* Pins_Arduino_h */ diff --git a/keyboards/helix/readme.md b/keyboards/helix/readme.md new file mode 100644 index 00000000..5ee233e8 --- /dev/null +++ b/keyboards/helix/readme.md @@ -0,0 +1,16 @@ +Helix +=== + +![Helix](https://i.imgur.com/XBAmynN.jpg) + +A compact split ortholinear keyboard. + +Keyboard Maintainer: [Makoto Kurauchi](https://github.com/MakotoKurauchi/) [@pluis9](https://twitter.com/pluis9) +Hardware Supported: Helix PCB Alpha, Beta, Pro Micro +Hardware Availability: [PCB & Case Data](https://github.com/MakotoKurauchi/helix), [Yushakobo Shop](https://yushakobo.jp/shop/) + +Make example for this keyboard (after setting up your build environment): + + make helix:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. diff --git a/keyboards/helix/rev1/config.h b/keyboards/helix/rev1/config.h new file mode 100644 index 00000000..3420992d --- /dev/null +++ b/keyboards/helix/rev1/config.h @@ -0,0 +1,103 @@ +/* +Copyright 2012 Jun Wako +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 REV1_CONFIG_H +#define REV1_CONFIG_H + +#include "../config.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x3060 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Yushakobo +#define PRODUCT Helix Alpha +#define DESCRIPTION A split keyboard for the cheap makers + +#define HELIX_ROWS 5 + +/* key matrix size */ +// Rows are doubled-up +#if HELIX_ROWS == 3 + #define MATRIX_ROWS 6 + #define MATRIX_COLS 6 + #define MATRIX_ROW_PINS { D7, E6, B4 } +#elif HELIX_ROWS == 4 + #define MATRIX_ROWS 8 + #define MATRIX_COLS 6 + #define MATRIX_ROW_PINS { D7, E6, B4, B5 } +#elif HELIX_ROWS == 5 + #define MATRIX_ROWS 10 + #define MATRIX_COLS 6 + #define MATRIX_ROW_PINS { D7, E6, B4, B5, D4 } +#else + #error "expected HELIX_ROWS 3 or 4 or 5" +#endif + +// wiring of each half +#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 } +// #define MATRIX_COL_PINS { B6, B2, B3, B1, F7, F6 } //uncomment this line and comment line above if you need to reverse left-to-right key order + +#define CATERINA_BOOTLOADER + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +// #define BACKLIGHT_LEVELS 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* ws2812 RGB LED */ +#define RGB_DI_PIN D3 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 12 // Number of LEDs +#define ws2812_PORTREG PORTD +#define ws2812_DDRREG DDRD + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +// #define NO_DEBUG + +/* disable print */ +// #define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + + +#endif diff --git a/keyboards/helix/rev1/keymaps/OLED_sample/config.h b/keyboards/helix/rev1/keymaps/OLED_sample/config.h new file mode 100644 index 00000000..6cd3072b --- /dev/null +++ b/keyboards/helix/rev1/keymaps/OLED_sample/config.h @@ -0,0 +1,54 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +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 CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* Use I2C or Serial */ + +#define USE_I2C +#define USE_SERIAL +//#define USE_MATRIX_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define _MASTER_RIGHT +// #define EE_HANDS + +#define SSD1306OLED + +#define USE_SERIAL_PD2 + +#define PREVENT_STUCK_MODIFIERS +#define TAPPING_FORCE_HOLD +#define TAPPING_TERM 100 + + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 6 +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 + +#endif diff --git a/keyboards/helix/rev1/keymaps/OLED_sample/keymap.c b/keyboards/helix/rev1/keymaps/OLED_sample/keymap.c new file mode 100644 index 00000000..4f1ffb7c --- /dev/null +++ b/keyboards/helix/rev1/keymaps/OLED_sample/keymap.c @@ -0,0 +1,498 @@ +#include "helix.h" +#include "bootloader.h" +#include "action_layer.h" +#include "eeconfig.h" +#include "LUFA/Drivers/Peripheral/TWI.h" +#ifdef AUDIO_ENABLE + #include "audio.h" +#endif +#ifdef SSD1306OLED + #include "ssd1306.h" +#endif + +extern keymap_config_t keymap_config; + +//Following line allows macro to read current RGB settings +extern rgblight_config_t rgblight_config; + + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + LOWER, + RAISE, + ADJUST, + BACKLIT, + RGBLED_TOGGLE, + RGBLED_STEP_MODE, + RGBLED_INCREASE_HUE, + RGBLED_DECREASE_HUE, + RGBLED_INCREASE_SAT, + RGBLED_DECREASE_SAT, + RGBLED_INCREASE_VAL, + RGBLED_DECREASE_VAL, +}; + +enum macro_keycodes { + KC_SAMPLEMACRO, +}; + + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO +//Macros +#define M_SAMPLE M(KC_SAMPLEMACRO) + +#if HELIX_ROWS == 5 +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Qwerty + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ + [_QWERTY] = KEYMAP( \ + 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_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL, \ + 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 , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Colemak + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ + [_COLEMAK] = KEYMAP( \ + 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_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_DEL, \ + 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 , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Dvorak + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | " | , | . | P | Y | F | G | C | R | L | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ + [_DVORAK] = KEYMAP( \ + 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_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL, \ + KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ + [_LOWER] = KEYMAP( \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ + [_RAISE] = KEYMAP( \ + 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_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | Reset| | | | | | | | | | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ + [_ADJUST] = KEYMAP( \ + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ + _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ) +}; + +#elif HELIX_ROWS == 4 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ + + [_QWERTY] = KEYMAP( \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL, \ + 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 , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Colemak + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ + [_COLEMAK] = KEYMAP( \ + 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 , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Dvorak + * ,-----------------------------------------------------------------------------------. + * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ + [_DVORAK] = KEYMAP( \ + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ + KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ + [_LOWER] = KEYMAP( \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ + [_RAISE] = KEYMAP( \ + 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_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | Reset| | | | | | | | | | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ + [_ADJUST] = KEYMAP( \ + _______, RESET, _______, M_SAMPLE, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ) +}; + +#else +#error "undefined keymaps" +#endif + + +#ifdef AUDIO_ENABLE + +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +float tone_plover[][2] = SONG(PLOVER_SOUND); +float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); +float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); +#endif + +// define variables for reactive RGB +bool TOG_STATUS = false; +int RGB_current_mode; + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +// Setting ADJUST layer RGB back to default +void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { + rgblight_mode(RGB_current_mode); + layer_on(layer3); + } else { + layer_off(layer3); + } +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_colemak); + #endif + persistent_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_dvorak); + #endif + persistent_default_layer_set(1UL<<_DVORAK); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + //not sure how to have keyboard check mode and set it to a variable, so my work around + //uses another variable that would be set to true after the first time a reactive key is pressed. + if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false + } else { + TOG_STATUS = !TOG_STATUS; + rgblight_mode(16); + } + layer_on(_LOWER); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } else { + rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change + TOG_STATUS = false; + layer_off(_LOWER); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + //not sure how to have keyboard check mode and set it to a variable, so my work around + //uses another variable that would be set to true after the first time a reactive key is pressed. + if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false + } else { + TOG_STATUS = !TOG_STATUS; + rgblight_mode(15); + } + layer_on(_RAISE); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } else { + rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change + layer_off(_RAISE); + TOG_STATUS = false; + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + } else { + unregister_code(KC_RSFT); + } + return false; + break; + //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released + case RGB_MOD: + if (record->event.pressed) { + rgblight_mode(RGB_current_mode); + rgblight_step(); + RGB_current_mode = rgblight_config.mode; + } + return false; + break; + } + return true; +} + +void matrix_init_user(void) { + #ifdef AUDIO_ENABLE + startup_user(); + #endif + RGB_current_mode = rgblight_config.mode; +} + +//SSD1306 OLED init and update loop, make sure to add #define SSD1306OLED in config.h +#ifdef SSD1306OLED +void matrix_master_OLED_init (void) { + TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); + iota_gfx_init(0); // turns on the display +} + +void matrix_scan_user(void) { + iota_gfx_task(); // this is what updates the display continuously +} +#endif + +#ifdef AUDIO_ENABLE + +void startup_user() +{ + _delay_ms(20); // gets rid of tick +} + +void shutdown_user() +{ + _delay_ms(150); + stop_all_notes(); +} + +void music_on_user(void) +{ + music_scale_user(); +} + +void music_scale_user(void) +{ + PLAY_SONG(music_scale); +} + +#endif + +/* + * Macro definition + */ +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + if (!eeconfig_is_enabled()) { + eeconfig_init(); + } + + switch (id) { + case KC_SAMPLEMACRO: + if (record->event.pressed){ + return MACRO (I(10), T(H), T(E), T(L), T(L), T(O), T(SPACE), T(W), T(O), T(R), T(L), T(D), END); + } + + } + + return MACRO_NONE; +} diff --git a/keyboards/helix/rev1/keymaps/OLED_sample/readme.md b/keyboards/helix/rev1/keymaps/OLED_sample/readme.md new file mode 100644 index 00000000..02888855 --- /dev/null +++ b/keyboards/helix/rev1/keymaps/OLED_sample/readme.md @@ -0,0 +1,25 @@ +SSD1306 OLED Display via I2C +====== + +Features +-------- + +Some features supported by the firmware: + + +* I2C connection between the two halves is required as the OLED display will use this connection as well. Note this + requires pull-up resistors on the data and clock lines. +* OLED display will connect from either side + + +Wiring +------ + + +Work in progress... + + +OLED Configuration +------------------------------- + +Work in progress... diff --git a/keyboards/helix/rev1/keymaps/OLED_sample/rules.mk b/keyboards/helix/rev1/keymaps/OLED_sample/rules.mk new file mode 100644 index 00000000..67a0ff2d --- /dev/null +++ b/keyboards/helix/rev1/keymaps/OLED_sample/rules.mk @@ -0,0 +1,25 @@ + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +ONEHAND_ENABLE = no # Enable one-hand typing + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/helix/rev1/keymaps/default/config.h b/keyboards/helix/rev1/keymaps/default/config.h new file mode 100644 index 00000000..7f33a436 --- /dev/null +++ b/keyboards/helix/rev1/keymaps/default/config.h @@ -0,0 +1,37 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +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 CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +// #define USE_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define _MASTER_RIGHT +// #define EE_HANDS + +#endif \ No newline at end of file diff --git a/keyboards/helix/rev1/keymaps/default/keymap.c b/keyboards/helix/rev1/keymaps/default/keymap.c new file mode 100644 index 00000000..d7cf3405 --- /dev/null +++ b/keyboards/helix/rev1/keymaps/default/keymap.c @@ -0,0 +1,349 @@ +#include "helix.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + LOWER, + RAISE, + ADJUST, +}; + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +#if HELIX_ROWS == 5 +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Qwerty + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ + [_QWERTY] = KEYMAP( \ + 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_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL, \ + 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 , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Colemak + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ + [_COLEMAK] = KEYMAP( \ + 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_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_DEL, \ + 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 , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Dvorak + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | " | , | . | P | Y | F | G | C | R | L | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ + [_DVORAK] = KEYMAP( \ + 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_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL, \ + KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ + [_LOWER] = KEYMAP( \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ + [_RAISE] = KEYMAP( \ + 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_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | Reset| | | | | | | | | | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ + [_ADJUST] = KEYMAP( \ + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ + _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ) +}; + +#elif HELIX_ROWS == 4 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ + + [_QWERTY] = KEYMAP( \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL, \ + 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 , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Colemak + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ + [_COLEMAK] = KEYMAP( \ + 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 , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Dvorak + * ,-----------------------------------------------------------------------------------. + * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ + [_DVORAK] = KEYMAP( \ + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ + KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ + [_LOWER] = KEYMAP( \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ + [_RAISE] = KEYMAP( \ + 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_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | Reset| | | | | | | | | | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ + [_ADJUST] = KEYMAP( \ + _______, RESET, _______, M_SAMPLE, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ) +}; + +#else +#error "undefined keymaps" +#endif + +#ifdef AUDIO_ENABLE +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +#endif + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_colemak); + #endif + persistent_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_dvorak); + #endif + persistent_default_layer_set(1UL<<_DVORAK); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + } + return true; +} diff --git a/keyboards/helix/rev1/keymaps/default/rules.mk b/keyboards/helix/rev1/keymaps/default/rules.mk new file mode 100644 index 00000000..457a3d01 --- /dev/null +++ b/keyboards/helix/rev1/keymaps/default/rules.mk @@ -0,0 +1,3 @@ +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/helix/rev1/matrix.c b/keyboards/helix/rev1/matrix.c new file mode 100644 index 00000000..375057a6 --- /dev/null +++ b/keyboards/helix/rev1/matrix.c @@ -0,0 +1,316 @@ +/* +Copyright 2012 Jun Wako + +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 . +*/ + +/* + * scan matrix + */ +#include +#include +#include +#include +#include +#include +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "split_util.h" +#include "pro_micro.h" +#include "config.h" + +#ifdef USE_MATRIX_I2C +# include "i2c.h" +#else // USE_SERIAL +# include "serial.h" +#endif + +#ifndef DEBOUNCE +# define DEBOUNCE 5 +#endif + +#define ERROR_DISCONNECT_COUNT 5 + +static uint8_t debouncing = DEBOUNCE; +static const int ROWS_PER_HAND = MATRIX_ROWS/2; +static uint8_t error_count = 0; + +static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +static matrix_row_t read_cols(void); +static void init_cols(void); +static void unselect_rows(void); +static void select_row(uint8_t row); + +__attribute__ ((weak)) +void matrix_init_quantum(void) { + matrix_init_kb(); +} + +__attribute__ ((weak)) +void matrix_scan_quantum(void) { + matrix_scan_kb(); +} + +__attribute__ ((weak)) +void matrix_init_kb(void) { + matrix_init_user(); +} + +__attribute__ ((weak)) +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +__attribute__ ((weak)) +void matrix_init_user(void) { +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { +} + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +void matrix_init(void) +{ + debug_enable = true; + debug_matrix = true; + debug_mouse = true; + // initialize row and col + unselect_rows(); + init_cols(); + + TX_RX_LED_INIT; + + // initialize matrix state: all keys off + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + matrix_debouncing[i] = 0; + } + + matrix_init_quantum(); +} + +uint8_t _matrix_scan(void) +{ + // Right hand is stored after the left in the matirx so, we need to offset it + int offset = isLeftHand ? 0 : (ROWS_PER_HAND); + + for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { + select_row(i); + _delay_us(30); // without this wait read unstable value. + matrix_row_t cols = read_cols(); + if (matrix_debouncing[i+offset] != cols) { + matrix_debouncing[i+offset] = cols; + debouncing = DEBOUNCE; + } + unselect_rows(); + } + + if (debouncing) { + if (--debouncing) { + _delay_ms(1); + } else { + for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { + matrix[i+offset] = matrix_debouncing[i+offset]; + } + } + } + + return 1; +} + +#ifdef USE_MATRIX_I2C + +// Get rows from other half over i2c +int i2c_transaction(void) { + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + + int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); + if (err) goto i2c_error; + + // start of matrix stored at 0x00 + err = i2c_master_write(0x00); + if (err) goto i2c_error; + + // Start read + err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); + if (err) goto i2c_error; + + if (!err) { + int i; + for (i = 0; i < ROWS_PER_HAND-1; ++i) { + matrix[slaveOffset+i] = i2c_master_read(I2C_ACK); + } + matrix[slaveOffset+i] = i2c_master_read(I2C_NACK); + i2c_master_stop(); + } else { +i2c_error: // the cable is disconnceted, or something else went wrong + i2c_reset_state(); + return err; + } + + return 0; +} + +#else // USE_SERIAL + +int serial_transaction(void) { + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + + if (serial_update_buffers()) { + return 1; + } + + for (int i = 0; i < ROWS_PER_HAND; ++i) { + matrix[slaveOffset+i] = serial_slave_buffer[i]; + } + return 0; +} +#endif + +uint8_t matrix_scan(void) +{ + int ret = _matrix_scan(); + + + +#ifdef USE_MATRIX_I2C + if( i2c_transaction() ) { +#else // USE_SERIAL + if( serial_transaction() ) { +#endif + // turn on the indicator led when halves are disconnected + TXLED1; + + error_count++; + + if (error_count > ERROR_DISCONNECT_COUNT) { + // reset other half if disconnected + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + for (int i = 0; i < ROWS_PER_HAND; ++i) { + matrix[slaveOffset+i] = 0; + } + } + } else { + // turn off the indicator led on no error + TXLED0; + error_count = 0; + } + matrix_scan_quantum(); + return ret; +} + +void matrix_slave_scan(void) { + _matrix_scan(); + + int offset = (isLeftHand) ? 0 : (MATRIX_ROWS / 2); + +#ifdef USE_MATRIX_I2C + for (int i = 0; i < ROWS_PER_HAND; ++i) { + /* i2c_slave_buffer[i] = matrix[offset+i]; */ + i2c_slave_buffer[i] = matrix[offset+i]; + } +#else // USE_SERIAL + for (int i = 0; i < ROWS_PER_HAND; ++i) { + serial_slave_buffer[i] = matrix[offset+i]; + } +#endif +} + +bool matrix_is_modified(void) +{ + if (debouncing) return false; + return true; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & ((matrix_row_t)1<> 4) + 1) &= ~_BV(col_pins[x] & 0xF); + _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF); + } +} + +static matrix_row_t read_cols(void) +{ + matrix_row_t result = 0; + for(int x = 0; x < MATRIX_COLS; x++) { + result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x); + } + return result; +} + +static void unselect_rows(void) +{ + for(int x = 0; x < ROWS_PER_HAND; x++) { + _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF); + _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF); + } +} + +static void select_row(uint8_t row) +{ + _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF); + _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF); +} diff --git a/keyboards/helix/rev1/rev1.c b/keyboards/helix/rev1/rev1.c new file mode 100644 index 00000000..950e4eec --- /dev/null +++ b/keyboards/helix/rev1/rev1.c @@ -0,0 +1,39 @@ +#include "helix.h" + +#ifdef AUDIO_ENABLE + float tone_startup[][2] = SONG(STARTUP_SOUND); + float tone_goodbye[][2] = SONG(GOODBYE_SOUND); +#endif + +#ifdef SSD1306OLED +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + led_set_user(usb_led); +} +#endif + +void matrix_init_kb(void) { + + #ifdef AUDIO_ENABLE + _delay_ms(20); // gets rid of tick + PLAY_SONG(tone_startup); + #endif + + // // green led on + // DDRD |= (1<<5); + // PORTD &= ~(1<<5); + + // // orange led on + // DDRB |= (1<<0); + // PORTB &= ~(1<<0); + + matrix_init_user(); +}; + +void shutdown_kb(void) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_goodbye); + _delay_ms(150); + stop_all_notes(); + #endif +} diff --git a/keyboards/helix/rev1/rev1.h b/keyboards/helix/rev1/rev1.h new file mode 100644 index 00000000..fb56de02 --- /dev/null +++ b/keyboards/helix/rev1/rev1.h @@ -0,0 +1,145 @@ +#ifndef REV1_H +#define REV1_CONFIG_H + +#include "../helix.h" + +//void promicro_bootloader_jmp(bool program); +#include "quantum.h" + + +#ifdef USE_I2C +#include +#ifdef __AVR__ + #include + #include +#endif +#endif + +//void promicro_bootloader_jmp(bool program); + + +#if HELIX_ROWS == 3 + #ifndef FLIP_HALF + // Standard Keymap + // (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left) + #define KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05 }, \ + { L10, L11, L12, L13, L14, L15 }, \ + { L20, L21, L22, L23, L24, L25 }, \ + { R05, R04, R03, R02, R01, R00 }, \ + { R15, R14, R13, R12, R11, R10 }, \ + { R25, R24, R23, R22, R21, R20 }, \ + } + #else + // Keymap with right side flipped + // (TRRS jack on both halves are to the right) + #define KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05 }, \ + { L10, L11, L12, L13, L14, L15 }, \ + { L20, L21, L22, L23, L24, L25 }, \ + { R00, R01, R02, R03, R04, R05 }, \ + { R10, R11, R12, R13, R14, R15 }, \ + { R20, R21, R22, R23, R24, R25 }, \ + } + #endif +#elif HELIX_ROWS == 4 + #ifndef FLIP_HALF + // Standard Keymap + // (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left) + #define KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05 }, \ + { L10, L11, L12, L13, L14, L15 }, \ + { L20, L21, L22, L23, L24, L25 }, \ + { L30, L31, L32, L33, L34, L35 }, \ + { R05, R04, R03, R02, R01, R00 }, \ + { R15, R14, R13, R12, R11, R10 }, \ + { R25, R24, R23, R22, R21, R20 }, \ + { R35, R34, R33, R32, R31, R30 } \ + } + #else + // Keymap with right side flipped + // (TRRS jack on both halves are to the right) + #define KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05 }, \ + { L10, L11, L12, L13, L14, L15 }, \ + { L20, L21, L22, L23, L24, L25 }, \ + { L30, L31, L32, L33, L34, L35 }, \ + { R00, R01, R02, R03, R04, R05 }, \ + { R10, R11, R12, R13, R14, R15 }, \ + { R20, R21, R22, R23, R24, R25 }, \ + { R30, R31, R32, R33, R34, R35 } \ + } + #endif +#elif HELIX_ROWS == 5 + #ifndef FLIP_HALF + // Standard Keymap + // (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left) + #define KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35, \ + L40, L41, L42, L43, L44, L45, R40, R41, R42, R43, R44, R45 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05 }, \ + { L10, L11, L12, L13, L14, L15 }, \ + { L20, L21, L22, L23, L24, L25 }, \ + { L30, L31, L32, L33, L34, L35 }, \ + { L40, L41, L42, L43, L44, L45 }, \ + { R05, R04, R03, R02, R01, R00 }, \ + { R15, R14, R13, R12, R11, R10 }, \ + { R25, R24, R23, R22, R21, R20 }, \ + { R35, R34, R33, R32, R31, R30 }, \ + { R45, R44, R43, R42, R41, R40 } \ + } + #else + // Keymap with right side flipped + // (TRRS jack on both halves are to the right) + #define KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35, \ + L40, L41, L42, L43, L44, L45, R40, R41, R42, R43, R44, R45 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05 }, \ + { L10, L11, L12, L13, L14, L15 }, \ + { L20, L21, L22, L23, L24, L25 }, \ + { L30, L31, L32, L33, L34, L35 }, \ + { L40, L41, L42, L43, L44, L45 }, \ + { R00, R01, R02, R03, R04, R05 }, \ + { R10, R11, R12, R13, R14, R15 }, \ + { R20, R21, R22, R23, R24, R25 }, \ + { R30, R31, R32, R33, R34, R35 }, \ + { R40, R41, R42, R43, R44, R45 } \ + } + #endif +#else + #error "expected HELIX_ROWS 3 or 4 or 5" +#endif + +#endif diff --git a/keyboards/helix/rev1/rules.mk b/keyboards/helix/rev1/rules.mk new file mode 100644 index 00000000..daba80ea --- /dev/null +++ b/keyboards/helix/rev1/rules.mk @@ -0,0 +1,4 @@ +SRC += rev1/matrix.c \ + rev1/split_util.c + +BACKLIGHT_ENABLE = no diff --git a/keyboards/helix/rev1/split_util.c b/keyboards/helix/rev1/split_util.c new file mode 100644 index 00000000..5debd6e0 --- /dev/null +++ b/keyboards/helix/rev1/split_util.c @@ -0,0 +1,86 @@ +#include +#include +#include +#include +#include +#include +#include "split_util.h" +#include "matrix.h" +#include "keyboard.h" +#include "config.h" + +#ifdef USE_MATRIX_I2C +# include "i2c.h" +#else +# include "serial.h" +#endif + +volatile bool isLeftHand = true; + +static void setup_handedness(void) { + #ifdef EE_HANDS + isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); + #else + // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c + #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) + isLeftHand = !has_usb(); + #else + isLeftHand = has_usb(); + #endif + #endif +} + +static void keyboard_master_setup(void) { +#ifdef USE_I2C +#ifdef SSD1306OLED + matrix_master_OLED_init (); +#endif +#endif +#ifdef USE_MATRIX_I2C + i2c_master_init(); +#else + serial_master_init(); +#endif +} + +static void keyboard_slave_setup(void) { +#ifdef USE_MATRIX_I2C + i2c_slave_init(SLAVE_I2C_ADDRESS); +#else + serial_slave_init(); +#endif +} + +bool has_usb(void) { + USBCON |= (1 << OTGPADE); //enables VBUS pad + _delay_us(5); + return (USBSTA & (1< + +#ifdef EE_HANDS + #define EECONFIG_BOOTMAGIC_END (uint8_t *)10 + #define EECONFIG_HANDEDNESS EECONFIG_BOOTMAGIC_END +#endif + +#define SLAVE_I2C_ADDRESS 0x32 + +extern volatile bool isLeftHand; + +// slave version of matix scan, defined in matrix.c +void matrix_slave_scan(void); + +void split_keyboard_setup(void); +bool has_usb(void); +void keyboard_slave_loop(void); + +void matrix_master_OLED_init (void); + +#endif diff --git a/keyboards/helix/rev2/config.h b/keyboards/helix/rev2/config.h new file mode 100644 index 00000000..42878d5c --- /dev/null +++ b/keyboards/helix/rev2/config.h @@ -0,0 +1,97 @@ +/* +Copyright 2012 Jun Wako +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 REV2_CONFIG_H +#define REV2_CONFIG_H + +#include "../config.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x3060 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Yushakobo +#define PRODUCT Helix Beta +#define DESCRIPTION A split keyboard for the cheap makers + +#define HELIX_ROWS 5 + +/* key matrix size */ +// Rows are doubled-up +#if HELIX_ROWS == 4 + #define MATRIX_ROWS 8 + #define MATRIX_COLS 7 + #define MATRIX_ROW_PINS { D4, C6, D7, E6 } +#elif HELIX_ROWS == 5 + #define MATRIX_ROWS 10 + #define MATRIX_COLS 7 + #define MATRIX_ROW_PINS { D4, C6, D7, E6, B4 } +#else + #error "expected HELIX_ROWS 4 or 5" +#endif + +// wiring of each half +#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2 } +// #define MATRIX_COL_PINS { B2, B3, B1, F7, F6, F5, F4 } //uncomment this line and comment line above if you need to reverse left-to-right key order + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +// #define BACKLIGHT_LEVELS 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +//#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +//#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* ws2812 RGB LED */ +#define RGB_DI_PIN D3 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 12 // Number of LEDs +#define ws2812_PORTREG PORTD +#define ws2812_DDRREG DDRD + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +// #define NO_DEBUG + +/* disable print */ +// #define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + + +#endif diff --git a/keyboards/helix/rev2/keymaps/default/config.h b/keyboards/helix/rev2/keymaps/default/config.h new file mode 100644 index 00000000..1b3875fc --- /dev/null +++ b/keyboards/helix/rev2/keymaps/default/config.h @@ -0,0 +1,54 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +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 CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* Use I2C or Serial */ + +#define USE_I2C +#define USE_SERIAL +//#define USE_MATRIX_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define MASTER_RIGHT +// #define EE_HANDS + +//#define SSD1306OLED + +#define USE_SERIAL_PD2 + +#define PREVENT_STUCK_MODIFIERS +#define TAPPING_FORCE_HOLD +#define TAPPING_TERM 100 + + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 6 +#define RGBLIGHT_LIMIT_VAL 255 +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 +#endif diff --git a/keyboards/helix/rev2/keymaps/default/keymap.c b/keyboards/helix/rev2/keymaps/default/keymap.c new file mode 100644 index 00000000..b8a9baee --- /dev/null +++ b/keyboards/helix/rev2/keymaps/default/keymap.c @@ -0,0 +1,616 @@ +#include "helix.h" +#include "bootloader.h" +#include "action_layer.h" +#include "eeconfig.h" +#ifdef PROTOCOL_LUFA +#include "lufa.h" +#include "split_util.h" +#endif +#include "LUFA/Drivers/Peripheral/TWI.h" +#ifdef AUDIO_ENABLE + #include "audio.h" +#endif +#ifdef SSD1306OLED + #include "ssd1306.h" +#endif + +extern keymap_config_t keymap_config; + +#ifdef RGBLIGHT_ENABLE +//Following line allows macro to read current RGB settings +extern rgblight_config_t rgblight_config; +#endif + +extern uint8_t is_master; + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + LOWER, + RAISE, + ADJUST, + BACKLIT, + EISU, + KANA, + RGBRST +}; + +enum macro_keycodes { + KC_SAMPLEMACRO, +}; + + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO +//Macros +#define M_SAMPLE M(KC_SAMPLEMACRO) + +#if HELIX_ROWS == 5 +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Qwerty + * ,-----------------------------------------. ,-----------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | [ | ] | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right | + * `-------------------------------------------------------------------------------------------------' + */ + [_QWERTY] = KEYMAP( \ + 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_LCTL, 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_LBRC, KC_RBRC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ + ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Colemak + * ,-----------------------------------------. ,-----------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Tab | Q | W | F | P | G | | J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Ctrl | A | R | S | T | D | | H | N | E | I | O | ' | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | [ | ] | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right | + * `-------------------------------------------------------------------------------------------------' + */ + [_COLEMAK] = KEYMAP( \ + 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_LCTL, 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_LBRC, KC_RBRC, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ + ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Dvorak + * ,-----------------------------------------. ,-----------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Tab | ' | , | . | P | Y | | F | G | C | R | L | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Ctrl | A | O | E | U | I | | D | H | T | N | S | / | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | [ | ] | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right | + * `-------------------------------------------------------------------------------------------------' + */ + [_DVORAK] = KEYMAP( \ + 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_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL, \ + KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_LBRC, KC_RBRC, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \ + ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Lower + * ,-----------------------------------------. ,-----------------------------------------. + * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | F1 | F2 | F3 | F4 | F5 | | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | ( | ) | F12 | | | Home | End | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | Next | Vol- | Vol+ | Play | + * `-------------------------------------------------------------------------------------------------' + */ + [_LOWER] = KEYMAP( \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \ + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_LPRN, KC_RPRN, KC_F12, _______, _______, KC_HOME, KC_END, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Raise + * ,-----------------------------------------. ,-----------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | | | F12 | | |PageDn|PageUp| | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | Next | Vol- | Vol+ | Play | + * `-------------------------------------------------------------------------------------------------' + */ + [_RAISE] = KEYMAP( \ + 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_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, KC_F12, _______, _______, KC_PGDN, KC_PGUP, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Adjust (Lower + Raise) + * ,-----------------------------------------. ,-----------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | Reset|RGBRST| | | | | | | | | | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | |Aud on|Audoff| Mac | | Win |Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | |RGB ON| HUE+ | SAT+ | VAL+ | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | MODE | HUE- | SAT- | VAL- | + * `-------------------------------------------------------------------------------------------------' + */ + [_ADJUST] = KEYMAP( \ + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ + _______, RESET, RGBRST, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD \ + ) +}; + +#elif HELIX_ROWS == 4 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Qwerty + * ,-----------------------------------------. ,-----------------------------------------. + * | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+-------------+------+------+------+------+------+------| + * |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right | + * `-------------------------------------------------------------------------------------------------' + */ + [_QWERTY] = KEYMAP( \ + 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_LCTL, 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 , \ + ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Colemak + * ,-----------------------------------------. ,-----------------------------------------. + * | Tab | Q | W | F | P | G | | J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Ctrl | A | R | S | T | D | | H | N | E | I | O | ' | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+-------------+------+------+------+------+------+------| + * |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right | + * `-------------------------------------------------------------------------------------------------' + */ + [_COLEMAK] = KEYMAP( \ + 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_LCTL, 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 , \ + ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Dvorak + * ,-----------------------------------------. ,-----------------------------------------. + * | Tab | ' | , | . | P | Y | | F | G | C | R | L | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Ctrl | A | O | E | U | I | | D | H | T | N | S | / | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+-------------+------+------+------+------+------+------| + * |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right | + * `-------------------------------------------------------------------------------------------------' + */ + [_DVORAK] = KEYMAP( \ + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL, \ + KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \ + ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + + /* Lower + * ,-----------------------------------------. ,-----------------------------------------. + * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | F1 | F2 | F3 | F4 | F5 | | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | | F12 | | | Home | End | | + * |------+------+------+------+------+------+-------------+------+------+------+------+------+------| + * | | | | | | | | | | | Next | Vol- | Vol+ | Play | + * `-------------------------------------------------------------------------------------------------' + */ + [_LOWER] = KEYMAP( \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \ + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_HOME, KC_END, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Raise + * ,-----------------------------------------. ,-----------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | | F12 | | |PageDn|PageUp| | + * |------+------+------+------+------+------+-------------+------+------+------+------+------+------| + * | | | | | | | | | | | Next | Vol- | Vol+ | Play | + * `-------------------------------------------------------------------------------------------------' + */ + [_RAISE] = KEYMAP( \ + 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_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_PGDN, KC_PGUP, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + ), + + /* Adjust (Lower + Raise) + * ,-----------------------------------------. ,-----------------------------------------. + * | | Reset| | | | | | | | | | | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | |Aud on|Audoff| Mac | | Win |Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | |RGB ON| HUE+ | SAT+ | VAL+ | + * |------+------+------+------+------+------+-------------+------+------+------+------+------+------| + * | | | | | | | | | | | MODE | HUE- | SAT- | VAL- | + * `-------------------------------------------------------------------------------------------------' + */ + [_ADJUST] = KEYMAP( \ + _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD \ + ) +}; + +#else +#error "undefined keymaps" +#endif + + +#ifdef AUDIO_ENABLE + +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +float tone_plover[][2] = SONG(PLOVER_SOUND); +float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); +float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); +#endif + +// define variables for reactive RGB +bool TOG_STATUS = false; +int RGB_current_mode; + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +// Setting ADJUST layer RGB back to default +void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { + #ifdef RGBLIGHT_ENABLE + //rgblight_mode(RGB_current_mode); + #endif + layer_on(layer3); + } else { + layer_off(layer3); + } +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_colemak); + #endif + persistent_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_dvorak); + #endif + persistent_default_layer_set(1UL<<_DVORAK); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + //not sure how to have keyboard check mode and set it to a variable, so my work around + //uses another variable that would be set to true after the first time a reactive key is pressed. + if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false + } else { + TOG_STATUS = !TOG_STATUS; + #ifdef RGBLIGHT_ENABLE + //rgblight_mode(16); + #endif + } + layer_on(_LOWER); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } else { + #ifdef RGBLIGHT_ENABLE + //rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change + #endif + TOG_STATUS = false; + layer_off(_LOWER); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + //not sure how to have keyboard check mode and set it to a variable, so my work around + //uses another variable that would be set to true after the first time a reactive key is pressed. + if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false + } else { + TOG_STATUS = !TOG_STATUS; + #ifdef RGBLIGHT_ENABLE + //rgblight_mode(15); + #endif + } + layer_on(_RAISE); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } else { + #ifdef RGBLIGHT_ENABLE + //rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change + #endif + layer_off(_RAISE); + TOG_STATUS = false; + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released + case RGB_MOD: + #ifdef RGBLIGHT_ENABLE + if (record->event.pressed) { + rgblight_mode(RGB_current_mode); + rgblight_step(); + RGB_current_mode = rgblight_config.mode; + } + #endif + return false; + break; + case EISU: + if (record->event.pressed) { + if(keymap_config.swap_lalt_lgui==false){ + register_code(KC_LANG2); + }else{ + SEND_STRING(SS_LALT("`")); + } + } else { + unregister_code(KC_LANG2); + } + return false; + break; + case KANA: + if (record->event.pressed) { + if(keymap_config.swap_lalt_lgui==false){ + register_code(KC_LANG1); + }else{ + SEND_STRING(SS_LALT("`")); + } + } else { + unregister_code(KC_LANG1); + } + return false; + break; + case RGBRST: + #ifdef RGBLIGHT_ENABLE + if (record->event.pressed) { + eeconfig_update_rgblight_default(); + rgblight_enable(); + RGB_current_mode = rgblight_config.mode; + } + #endif + break; + } + return true; +} + +void matrix_init_user(void) { + #ifdef AUDIO_ENABLE + startup_user(); + #endif + #ifdef RGBLIGHT_ENABLE + RGB_current_mode = rgblight_config.mode; + #endif + //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h + #ifdef SSD1306OLED + TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); + iota_gfx_init(!has_usb()); // turns on the display + #endif +} + + +#ifdef AUDIO_ENABLE + +void startup_user() +{ + _delay_ms(20); // gets rid of tick +} + +void shutdown_user() +{ + _delay_ms(150); + stop_all_notes(); +} + +void music_on_user(void) +{ + music_scale_user(); +} + +void music_scale_user(void) +{ + PLAY_SONG(music_scale); +} + +#endif + + +//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h +#ifdef SSD1306OLED + +void matrix_scan_user(void) { + iota_gfx_task(); // this is what updates the display continuously +} + +void matrix_update(struct CharacterMatrix *dest, + const struct CharacterMatrix *source) { + if (memcmp(dest->display, source->display, sizeof(dest->display))) { + memcpy(dest->display, source->display, sizeof(dest->display)); + dest->dirty = true; + } +} + +//assign the right code to your layers for OLED display +#define L_BASE 0 +#define L_LOWER 8 +#define L_RAISE 16 +#define L_FNLAYER 64 +#define L_NUMLAY 128 +#define L_NLOWER 136 +#define L_NFNLAYER 192 +#define L_MOUSECURSOR 256 +#define L_ADJUST 65536 +#define L_ADJUST_TRI 65560 + +static void render_logo(struct CharacterMatrix *matrix) { + + static char logo[]={ + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, + 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, + 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4, + 0}; + matrix_write(matrix, logo); + //matrix_write_P(&matrix, PSTR(" Split keyboard kit")); +} + + + +void render_status(struct CharacterMatrix *matrix) { + + // Render to mode icon + static char logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}}; + if(keymap_config.swap_lalt_lgui==false){ + matrix_write(matrix, logo[0][0]); + matrix_write_P(matrix, PSTR("\n")); + matrix_write(matrix, logo[0][1]); + }else{ + matrix_write(matrix, logo[1][0]); + matrix_write_P(matrix, PSTR("\n")); + matrix_write(matrix, logo[1][1]); + } + + // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below + char buf[40]; + snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); + matrix_write_P(matrix, PSTR("\nLayer: ")); + switch (layer_state) { + case L_BASE: + matrix_write_P(matrix, PSTR("Default")); + break; + case L_RAISE: + matrix_write_P(matrix, PSTR("Raise")); + break; + case L_LOWER: + matrix_write_P(matrix, PSTR("Lower")); + break; + case L_ADJUST: + case L_ADJUST_TRI: + matrix_write_P(matrix, PSTR("Adjust")); + break; + default: + matrix_write(matrix, buf); + } + + // Host Keyboard LED Status + char led[40]; + snprintf(led, sizeof(led), "\n%s %s %s", + (host_keyboard_leds() & (1< + +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 . +*/ + +/* + * scan matrix + */ +#include +#include +#include +#include +#include +#include +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "split_util.h" +#include "pro_micro.h" +#include "config.h" + +#ifdef USE_MATRIX_I2C +# include "i2c.h" +#else // USE_SERIAL +# include "serial.h" +#endif + +#ifndef DEBOUNCE +# define DEBOUNCE 5 +#endif + +#define ERROR_DISCONNECT_COUNT 5 + +static uint8_t debouncing = DEBOUNCE; +static const int ROWS_PER_HAND = MATRIX_ROWS/2; +static uint8_t error_count = 0; +uint8_t is_master = 0 ; + +static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +static matrix_row_t read_cols(void); +static void init_cols(void); +static void unselect_rows(void); +static void select_row(uint8_t row); +static uint8_t matrix_master_scan(void); + +__attribute__ ((weak)) +void matrix_init_quantum(void) { + matrix_init_kb(); +} + +__attribute__ ((weak)) +void matrix_scan_quantum(void) { + matrix_scan_kb(); +} + +__attribute__ ((weak)) +void matrix_init_kb(void) { + matrix_init_user(); +} + +__attribute__ ((weak)) +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +__attribute__ ((weak)) +void matrix_init_user(void) { +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { +} + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +void matrix_init(void) +{ + debug_enable = true; + debug_matrix = true; + debug_mouse = true; + // initialize row and col + unselect_rows(); + init_cols(); + + TX_RX_LED_INIT; + + // initialize matrix state: all keys off + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + matrix_debouncing[i] = 0; + } + + is_master = has_usb(); + + matrix_init_quantum(); +} + +uint8_t _matrix_scan(void) +{ + // Right hand is stored after the left in the matirx so, we need to offset it + int offset = isLeftHand ? 0 : (ROWS_PER_HAND); + + for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { + select_row(i); + _delay_us(30); // without this wait read unstable value. + matrix_row_t cols = read_cols(); + if (matrix_debouncing[i+offset] != cols) { + matrix_debouncing[i+offset] = cols; + debouncing = DEBOUNCE; + } + unselect_rows(); + } + + if (debouncing) { + if (--debouncing) { + _delay_ms(1); + } else { + for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { + matrix[i+offset] = matrix_debouncing[i+offset]; + } + } + } + + return 1; +} + +#ifdef USE_MATRIX_I2C + +// Get rows from other half over i2c +int i2c_transaction(void) { + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + + int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); + if (err) goto i2c_error; + + // start of matrix stored at 0x00 + err = i2c_master_write(0x00); + if (err) goto i2c_error; + + // Start read + err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); + if (err) goto i2c_error; + + if (!err) { + int i; + for (i = 0; i < ROWS_PER_HAND-1; ++i) { + matrix[slaveOffset+i] = i2c_master_read(I2C_ACK); + } + matrix[slaveOffset+i] = i2c_master_read(I2C_NACK); + i2c_master_stop(); + } else { +i2c_error: // the cable is disconnceted, or something else went wrong + i2c_reset_state(); + return err; + } + + return 0; +} + +#else // USE_SERIAL + +int serial_transaction(void) { + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + int ret=serial_update_buffers(); + if (ret ) { + if(ret==2)RXLED1; + return 1; + } +RXLED0; + for (int i = 0; i < ROWS_PER_HAND; ++i) { + matrix[slaveOffset+i] = serial_slave_buffer[i]; + } + return 0; +} +#endif + +uint8_t matrix_scan(void) +{ + if (is_master) { + matrix_master_scan(); + }else{ + matrix_slave_scan(); + +// if(serial_slave_DATA_CORRUPT()){ +// TXLED0; + int offset = (isLeftHand) ? ROWS_PER_HAND : 0; + + for (int i = 0; i < ROWS_PER_HAND; ++i) { + matrix[offset+i] = serial_master_buffer[i]; + } + +// }else{ +// TXLED1; +// } + + matrix_scan_quantum(); + } + return 1; +} + + +uint8_t matrix_master_scan(void) { + + int ret = _matrix_scan(); + +#ifndef KEYBOARD_helix_rev1 + int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; + +#ifdef USE_MATRIX_I2C +// for (int i = 0; i < ROWS_PER_HAND; ++i) { + /* i2c_slave_buffer[i] = matrix[offset+i]; */ +// i2c_slave_buffer[i] = matrix[offset+i]; +// } +#else // USE_SERIAL + for (int i = 0; i < ROWS_PER_HAND; ++i) { + serial_master_buffer[i] = matrix[offset+i]; + } +#endif +#endif + +#ifdef USE_MATRIX_I2C + if( i2c_transaction() ) { +#else // USE_SERIAL + if( serial_transaction() ) { +#endif + // turn on the indicator led when halves are disconnected + TXLED1; + + error_count++; + + if (error_count > ERROR_DISCONNECT_COUNT) { + // reset other half if disconnected + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + for (int i = 0; i < ROWS_PER_HAND; ++i) { + matrix[slaveOffset+i] = 0; + } + } + } else { + // turn off the indicator led on no error + TXLED0; + error_count = 0; + } + matrix_scan_quantum(); + return ret; +} + +void matrix_slave_scan(void) { + _matrix_scan(); + + int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; + +#ifdef USE_MATRIX_I2C + for (int i = 0; i < ROWS_PER_HAND; ++i) { + /* i2c_slave_buffer[i] = matrix[offset+i]; */ + i2c_slave_buffer[i] = matrix[offset+i]; + } +#else // USE_SERIAL + for (int i = 0; i < ROWS_PER_HAND; ++i) { + serial_slave_buffer[i] = matrix[offset+i]; + } +#endif +} + +bool matrix_is_modified(void) +{ + if (debouncing) return false; + return true; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & ((matrix_row_t)1<> 4) + 1) &= ~_BV(col_pins[x] & 0xF); + _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF); + } +} + +static matrix_row_t read_cols(void) +{ + matrix_row_t result = 0; + for(int x = 0; x < MATRIX_COLS; x++) { + result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x); + } + return result; +} + +static void unselect_rows(void) +{ + for(int x = 0; x < ROWS_PER_HAND; x++) { + _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF); + _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF); + } +} + +static void select_row(uint8_t row) +{ + _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF); + _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF); +} diff --git a/keyboards/helix/rev2/rev2.c b/keyboards/helix/rev2/rev2.c new file mode 100644 index 00000000..1b23edb7 --- /dev/null +++ b/keyboards/helix/rev2/rev2.c @@ -0,0 +1,32 @@ +#include "helix.h" + + +#ifdef AUDIO_ENABLE + float tone_startup[][2] = SONG(STARTUP_SOUND); + float tone_goodbye[][2] = SONG(GOODBYE_SOUND); +#endif + +#ifdef SSD1306OLED +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + //led_set_user(usb_led); +} +#endif + +void matrix_init_kb(void) { + + #ifdef AUDIO_ENABLE + _delay_ms(20); // gets rid of tick + PLAY_SONG(tone_startup); + #endif + + matrix_init_user(); +}; + +void shutdown_kb(void) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_goodbye); + _delay_ms(150); + stop_all_notes(); + #endif +} diff --git a/keyboards/helix/rev2/rev2.h b/keyboards/helix/rev2/rev2.h new file mode 100644 index 00000000..7cab57ea --- /dev/null +++ b/keyboards/helix/rev2/rev2.h @@ -0,0 +1,115 @@ +#ifndef REV2_H +#define REV2_CONFIG_H + +#include "../helix.h" + +//void promicro_bootloader_jmp(bool program); +#include "quantum.h" + +#ifdef RGBLIGHT_ENABLE +//rgb led driver +#include "ws2812.h" +#endif + +#ifdef USE_I2C +#include +#ifdef __AVR__ + #include + #include +#endif +#endif + +//void promicro_bootloader_jmp(bool program); + + +#if HELIX_ROWS == 4 +#ifndef FLIP_HALF +// Standard Keymap +// (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left) +#define KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, L36, R36, R30, R31, R32, R33, R34, R35 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05, KC_NO }, \ + { L10, L11, L12, L13, L14, L15, KC_NO }, \ + { L20, L21, L22, L23, L24, L25, KC_NO }, \ + { L30, L31, L32, L33, L34, L35, L36 }, \ + { R05, R04, R03, R02, R01, R00, KC_NO }, \ + { R15, R14, R13, R12, R11, R10, KC_NO }, \ + { R25, R24, R23, R22, R21, R20, KC_NO }, \ + { R35, R34, R33, R32, R31, R30, R36 }, \ + } +#else +// Keymap with right side flipped +// (TRRS jack on both halves are to the right) +#define KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, L36, R36, R30, R31, R32, R33, R34, R35 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05, KC_NO }, \ + { L10, L11, L12, L13, L14, L15, KC_NO }, \ + { L20, L21, L22, L23, L24, L25, KC_NO }, \ + { L30, L31, L32, L33, L34, L35, L36 }, \ + { KC_NO, R00, R01, R02, R03, R04, R05 }, \ + { KC_NO, R10, R11, R12, R13, R14, R15 }, \ + { KC_NO, R20, R21, R22, R23, R24, R25 }, \ + { R36, R30, R31, R32, R33, R34, R35 }, \ + } +#endif +#elif HELIX_ROWS == 5 + #ifndef FLIP_HALF + // Standard Keymap + // (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left) + #define KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, L36, R36, R30, R31, R32, R33, R34, R35, \ + L40, L41, L42, L43, L44, L45, L46, R46, R40, R41, R42, R43, R44, R45 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05, KC_NO }, \ + { L10, L11, L12, L13, L14, L15, KC_NO }, \ + { L20, L21, L22, L23, L24, L25, KC_NO }, \ + { L30, L31, L32, L33, L34, L35, L36 }, \ + { L40, L41, L42, L43, L44, L45, L46 }, \ + { R05, R04, R03, R02, R01, R00, KC_NO }, \ + { R15, R14, R13, R12, R11, R10, KC_NO }, \ + { R25, R24, R23, R22, R21, R20, KC_NO }, \ + { R35, R34, R33, R32, R31, R30, R36 }, \ + { R45, R44, R43, R42, R41, R40, R46 } \ + } + #else + // Keymap with right side flipped + // (TRRS jack on both halves are to the right) + #define KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, L36, R36, R30, R31, R32, R33, R34, R35, \ + L40, L41, L42, L43, L44, L45, L46, R46, R40, R41, R42, R43, R44, R45 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05, KC_NO }, \ + { L10, L11, L12, L13, L14, L15, KC_NO }, \ + { L20, L21, L22, L23, L24, L25, KC_NO }, \ + { L30, L31, L32, L33, L34, L35, L36 }, \ + { L40, L41, L42, L43, L44, L45, L46 }, \ + { KC_NO, R00, R01, R02, R03, R04, R05 }, \ + { KC_NO, R10, R11, R12, R13, R14, R15 }, \ + { KC_NO, R20, R21, R22, R23, R24, R25 }, \ + { R36, R30, R31, R32, R33, R34, R35 }, \ + { R46, R40, R41, R42, R43, R44, R45 } \ + } + #endif +#else + #error "expected HELIX_ROWS 4 or 5" +#endif + +#endif diff --git a/keyboards/helix/rev2/rules.mk b/keyboards/helix/rev2/rules.mk new file mode 100644 index 00000000..6ab01f44 --- /dev/null +++ b/keyboards/helix/rev2/rules.mk @@ -0,0 +1,3 @@ +SRC += rev2/matrix.c \ + rev2/split_util.c \ + ws2812.c diff --git a/keyboards/helix/rev2/split_util.c b/keyboards/helix/rev2/split_util.c new file mode 100644 index 00000000..8bc06417 --- /dev/null +++ b/keyboards/helix/rev2/split_util.c @@ -0,0 +1,71 @@ +#include +#include +#include +#include +#include +#include +#include "split_util.h" +#include "matrix.h" +#include "keyboard.h" +#include "config.h" + +#ifdef USE_MATRIX_I2C +# include "i2c.h" +#else +# include "serial.h" +#endif + +volatile bool isLeftHand = true; + +static void setup_handedness(void) { + #ifdef EE_HANDS + isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); + #else + // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c + #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) + isLeftHand = !has_usb(); + #else + isLeftHand = has_usb(); + #endif + #endif +} + +static void keyboard_master_setup(void) { + +#ifdef USE_MATRIX_I2C + i2c_master_init(); +#else + serial_master_init(); +#endif +} + +static void keyboard_slave_setup(void) { + +#ifdef USE_MATRIX_I2C + i2c_slave_init(SLAVE_I2C_ADDRESS); +#else + serial_slave_init(); +#endif +} + +bool has_usb(void) { + USBCON |= (1 << OTGPADE); //enables VBUS pad + _delay_us(5); + return (USBSTA & (1< + +#ifdef EE_HANDS + #define EECONFIG_BOOTMAGIC_END (uint8_t *)10 + #define EECONFIG_HANDEDNESS EECONFIG_BOOTMAGIC_END +#endif + +#define SLAVE_I2C_ADDRESS 0x32 + +extern volatile bool isLeftHand; + +// slave version of matix scan, defined in matrix.c +void matrix_slave_scan(void); + +void split_keyboard_setup(void); +bool has_usb(void); + +void matrix_master_OLED_init (void); + +#endif diff --git a/keyboards/helix/rules.mk b/keyboards/helix/rules.mk new file mode 100644 index 00000000..c35f93fb --- /dev/null +++ b/keyboards/helix/rules.mk @@ -0,0 +1,73 @@ +SRC += i2c.c \ + serial.c \ + ssd1306.c + +# MCU name +#MCU = at90usb1287 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Bootloader +# This definition is optional, and if your keyboard supports multiple bootloaders of +# different sizes, comment this out, and the correct address will be loaded +# automatically (+60). See bootloader.mk for all options. +BOOTLOADER = caterina + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = no # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SUBPROJECT_rev1 = no +USE_I2C = yes +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +CUSTOM_MATRIX = yes + +DEFAULT_FOLDER = helix/rev2 diff --git a/keyboards/helix/serial.c b/keyboards/helix/serial.c new file mode 100644 index 00000000..e918ab6e --- /dev/null +++ b/keyboards/helix/serial.c @@ -0,0 +1,238 @@ +/* + * WARNING: be careful changing this code, it is very timing dependent + */ + +#ifndef F_CPU +#define F_CPU 16000000 +#endif + +#include +#include +#include +#include +#include "serial.h" + +#ifdef USE_SERIAL + +// Serial pulse period in microseconds. Its probably a bad idea to lower this +// value. +#define SERIAL_DELAY 24 + +uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; +uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; + +#define SLAVE_DATA_CORRUPT (1<<0) +volatile uint8_t status = 0; + +inline static +void serial_delay(void) { + _delay_us(SERIAL_DELAY); +} +void serial_delay_short(void) { + _delay_us(SERIAL_DELAY-1); +} +inline static +void serial_output(void) { + SERIAL_PIN_DDR |= SERIAL_PIN_MASK; +} + +// make the serial pin an input with pull-up resistor +inline static +void serial_input(void) { + SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK; + SERIAL_PIN_PORT |= SERIAL_PIN_MASK; +} + +inline static +uint8_t serial_read_pin(void) { + return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK); +} + +inline static +void serial_low(void) { + SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; +} + +inline static +void serial_high(void) { + SERIAL_PIN_PORT |= SERIAL_PIN_MASK; +} + +void serial_master_init(void) { + serial_output(); + serial_high(); +} + +void serial_slave_init(void) { + serial_input(); + +#ifndef USE_SERIAL_PD2 + // Enable INT0 + EIMSK |= _BV(INT0); + // Trigger on falling edge of INT0 + EICRA &= ~(_BV(ISC00) | _BV(ISC01)); +#else + // Enable INT2 + EIMSK |= _BV(INT2); + // Trigger on falling edge of INT2 + EICRA &= ~(_BV(ISC20) | _BV(ISC21)); +#endif +} + +// Used by the master to synchronize timing with the slave. +static +void sync_recv(void) { + serial_input(); + // This shouldn't hang if the slave disconnects because the + // serial line will float to high if the slave does disconnect. + while (!serial_read_pin()); + //serial_delay(); + _delay_us(SERIAL_DELAY-5); +} + +// Used by the slave to send a synchronization signal to the master. +static +void sync_send(void) { + serial_output(); + + serial_low(); + serial_delay(); + + serial_high(); +} + +// Reads a byte from the serial line +static +uint8_t serial_read_byte(void) { + uint8_t byte = 0; + serial_input(); + for ( uint8_t i = 0; i < 8; ++i) { + byte = (byte << 1) | serial_read_pin(); + serial_delay(); + _delay_us(1); + } + + return byte; +} + +// Sends a byte with MSB ordering +static +void serial_write_byte(uint8_t data) { + uint8_t b = 8; + serial_output(); + while( b-- ) { + if(data & (1 << b)) { + serial_high(); + } else { + serial_low(); + } + serial_delay(); + } +} + +// interrupt handle to be used by the slave device +ISR(SERIAL_PIN_INTERRUPT) { + sync_send(); + + uint8_t checksum = 0; + for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { + serial_write_byte(serial_slave_buffer[i]); + sync_send(); + checksum += serial_slave_buffer[i]; + } + serial_write_byte(checksum); + sync_send(); + + // wait for the sync to finish sending + serial_delay(); + + // read the middle of pulses + _delay_us(SERIAL_DELAY/2); + + uint8_t checksum_computed = 0; + for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { + serial_master_buffer[i] = serial_read_byte(); + sync_send(); + checksum_computed += serial_master_buffer[i]; + } + uint8_t checksum_received = serial_read_byte(); + sync_send(); + + serial_input(); // end transaction + + if ( checksum_computed != checksum_received ) { + status |= SLAVE_DATA_CORRUPT; + } else { + status &= ~SLAVE_DATA_CORRUPT; + } +} + +inline +bool serial_slave_DATA_CORRUPT(void) { + return status & SLAVE_DATA_CORRUPT; +} + +// Copies the serial_slave_buffer to the master and sends the +// serial_master_buffer to the slave. +// +// Returns: +// 0 => no error +// 1 => slave did not respond +int serial_update_buffers(void) { + // this code is very time dependent, so we need to disable interrupts + cli(); + + // signal to the slave that we want to start a transaction + serial_output(); + serial_low(); + _delay_us(1); + + // wait for the slaves response + serial_input(); + serial_high(); + _delay_us(SERIAL_DELAY); + + // check if the slave is present + if (serial_read_pin()) { + // slave failed to pull the line low, assume not present + sei(); + return 1; + } + + // if the slave is present syncronize with it + sync_recv(); + + uint8_t checksum_computed = 0; + // receive data from the slave + for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { + serial_slave_buffer[i] = serial_read_byte(); + sync_recv(); + checksum_computed += serial_slave_buffer[i]; + } + uint8_t checksum_received = serial_read_byte(); + sync_recv(); + + if (checksum_computed != checksum_received) { + sei(); + return 2; + } + + uint8_t checksum = 0; + // send data to the slave + for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { + serial_write_byte(serial_master_buffer[i]); + sync_recv(); + checksum += serial_master_buffer[i]; + } + serial_write_byte(checksum); + sync_recv(); + + // always, release the line when not in use + serial_output(); + serial_high(); + + sei(); + return 0; +} + +#endif diff --git a/keyboards/helix/serial.h b/keyboards/helix/serial.h new file mode 100644 index 00000000..8f15d667 --- /dev/null +++ b/keyboards/helix/serial.h @@ -0,0 +1,36 @@ +#ifndef MY_SERIAL_H +#define MY_SERIAL_H + +#include "config.h" +#include + +/* TODO: some defines for interrupt setup */ +#define SERIAL_PIN_DDR DDRD +#define SERIAL_PIN_PORT PORTD +#define SERIAL_PIN_INPUT PIND + +#ifndef USE_SERIAL_PD2 +#define SERIAL_PIN_MASK _BV(PD0) +#define SERIAL_PIN_INTERRUPT INT0_vect +#else +#define SERIAL_PIN_MASK _BV(PD2) +#define SERIAL_PIN_INTERRUPT INT2_vect +#endif + +#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 +#ifdef KEYBOARD_helix_rev1 +#define SERIAL_MASTER_BUFFER_LENGTH 1 +#else +#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2 +#endif + +// Buffers for master - slave communication +extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; +extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; + +void serial_master_init(void); +void serial_slave_init(void); +int serial_update_buffers(void); +bool serial_slave_data_corrupt(void); + +#endif diff --git a/keyboards/helix/ssd1306.c b/keyboards/helix/ssd1306.c new file mode 100644 index 00000000..80efc3d1 --- /dev/null +++ b/keyboards/helix/ssd1306.c @@ -0,0 +1,324 @@ +#ifdef SSD1306OLED + +#include "ssd1306.h" +#include "i2c.h" +#include +#include "print.h" +#include "common/glcdfont.c" +#ifdef ADAFRUIT_BLE_ENABLE +#include "adafruit_ble.h" +#endif +#ifdef PROTOCOL_LUFA +#include "lufa.h" +#endif +#include "sendchar.h" +#include "timer.h" + +// Set this to 1 to help diagnose early startup problems +// when testing power-on with ble. Turn it off otherwise, +// as the latency of printing most of the debug info messes +// with the matrix scan, causing keys to drop. +#define DEBUG_TO_SCREEN 0 + +//static uint16_t last_battery_update; +//static uint32_t vbat; +//#define BatteryUpdateInterval 10000 /* milliseconds */ +#define ScreenOffInterval 300000 /* milliseconds */ +#if DEBUG_TO_SCREEN +static uint8_t displaying; +#endif +static uint16_t last_flush; + +// Write command sequence. +// Returns true on success. +static inline bool _send_cmd1(uint8_t cmd) { + bool res = false; + + if (i2c_start_write(SSD1306_ADDRESS)) { + xprintf("failed to start write to %d\n", SSD1306_ADDRESS); + goto done; + } + + if (i2c_master_write(0x0 /* command byte follows */)) { + print("failed to write control byte\n"); + + goto done; + } + + if (i2c_master_write(cmd)) { + xprintf("failed to write command %d\n", cmd); + goto done; + } + res = true; +done: + i2c_master_stop(); + return res; +} + +// Write 2-byte command sequence. +// Returns true on success +static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) { + if (!_send_cmd1(cmd)) { + return false; + } + return _send_cmd1(opr); +} + +// Write 3-byte command sequence. +// Returns true on success +static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) { + if (!_send_cmd1(cmd)) { + return false; + } + if (!_send_cmd1(opr1)) { + return false; + } + return _send_cmd1(opr2); +} + +#define send_cmd1(c) if (!_send_cmd1(c)) {goto done;} +#define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} +#define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} + +static void clear_display(void) { + matrix_clear(&display); + + // Clear all of the display bits (there can be random noise + // in the RAM on startup) + send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1); + send_cmd3(ColumnAddr, 0, DisplayWidth - 1); + + if (i2c_start_write(SSD1306_ADDRESS)) { + goto done; + } + if (i2c_master_write(0x40)) { + // Data mode + goto done; + } + for (uint8_t row = 0; row < MatrixRows; ++row) { + for (uint8_t col = 0; col < DisplayWidth; ++col) { + i2c_master_write(0); + } + } + + display.dirty = false; + +done: + i2c_master_stop(); +} + +#if DEBUG_TO_SCREEN +#undef sendchar +static int8_t capture_sendchar(uint8_t c) { + sendchar(c); + iota_gfx_write_char(c); + + if (!displaying) { + iota_gfx_flush(); + } + return 0; +} +#endif + +bool iota_gfx_init(bool rotate) { + bool success = false; + + send_cmd1(DisplayOff); + send_cmd2(SetDisplayClockDiv, 0x80); + send_cmd2(SetMultiPlex, DisplayHeight - 1); + + send_cmd2(SetDisplayOffset, 0); + + + send_cmd1(SetStartLine | 0x0); + send_cmd2(SetChargePump, 0x14 /* Enable */); + send_cmd2(SetMemoryMode, 0 /* horizontal addressing */); + + if(rotate){ + // the following Flip the display orientation 180 degrees + send_cmd1(SegRemap); + send_cmd1(ComScanInc); + }else{ + // Flips the display orientation 0 degrees + send_cmd1(SegRemap | 0x1); + send_cmd1(ComScanDec); + } + + send_cmd2(SetComPins, 0x2); + send_cmd2(SetContrast, 0x8f); + send_cmd2(SetPreCharge, 0xf1); + send_cmd2(SetVComDetect, 0x40); + send_cmd1(DisplayAllOnResume); + send_cmd1(NormalDisplay); + send_cmd1(DeActivateScroll); + send_cmd1(DisplayOn); + + send_cmd2(SetContrast, 0); // Dim + + clear_display(); + + success = true; + + iota_gfx_flush(); + +#if DEBUG_TO_SCREEN + print_set_sendchar(capture_sendchar); +#endif + +done: + return success; +} + +bool iota_gfx_off(void) { + bool success = false; + + send_cmd1(DisplayOff); + success = true; + +done: + return success; +} + +bool iota_gfx_on(void) { + bool success = false; + + send_cmd1(DisplayOn); + success = true; + +done: + return success; +} + +void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { + *matrix->cursor = c; + ++matrix->cursor; + + if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) { + // We went off the end; scroll the display upwards by one line + memmove(&matrix->display[0], &matrix->display[1], + MatrixCols * (MatrixRows - 1)); + matrix->cursor = &matrix->display[MatrixRows - 1][0]; + memset(matrix->cursor, ' ', MatrixCols); + } +} + +void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { + matrix->dirty = true; + + if (c == '\n') { + // Clear to end of line from the cursor and then move to the + // start of the next line + uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols; + + while (cursor_col++ < MatrixCols) { + matrix_write_char_inner(matrix, ' '); + } + return; + } + + matrix_write_char_inner(matrix, c); +} + +void iota_gfx_write_char(uint8_t c) { + matrix_write_char(&display, c); +} + +void matrix_write(struct CharacterMatrix *matrix, const char *data) { + const char *end = data + strlen(data); + while (data < end) { + matrix_write_char(matrix, *data); + ++data; + } +} + +void iota_gfx_write(const char *data) { + matrix_write(&display, data); +} + +void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { + while (true) { + uint8_t c = pgm_read_byte(data); + if (c == 0) { + return; + } + matrix_write_char(matrix, c); + ++data; + } +} + +void iota_gfx_write_P(const char *data) { + matrix_write_P(&display, data); +} + +void matrix_clear(struct CharacterMatrix *matrix) { + memset(matrix->display, ' ', sizeof(matrix->display)); + matrix->cursor = &matrix->display[0][0]; + matrix->dirty = true; +} + +void iota_gfx_clear_screen(void) { + matrix_clear(&display); +} + +void matrix_render(struct CharacterMatrix *matrix) { + last_flush = timer_read(); + iota_gfx_on(); +#if DEBUG_TO_SCREEN + ++displaying; +#endif + + // Move to the home position + send_cmd3(PageAddr, 0, MatrixRows - 1); + send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1); + + if (i2c_start_write(SSD1306_ADDRESS)) { + goto done; + } + if (i2c_master_write(0x40)) { + // Data mode + goto done; + } + + for (uint8_t row = 0; row < MatrixRows; ++row) { + for (uint8_t col = 0; col < MatrixCols; ++col) { + const uint8_t *glyph = font + (matrix->display[row][col] * FontWidth); + + for (uint8_t glyphCol = 0; glyphCol < FontWidth; ++glyphCol) { + uint8_t colBits = pgm_read_byte(glyph + glyphCol); + i2c_master_write(colBits); + } + + // 1 column of space between chars (it's not included in the glyph) + //i2c_master_write(0); + } + } + + matrix->dirty = false; + +done: + i2c_master_stop(); +#if DEBUG_TO_SCREEN + --displaying; +#endif +} + +void iota_gfx_flush(void) { + matrix_render(&display); +} + +__attribute__ ((weak)) +void iota_gfx_task_user(void) { +} + +void iota_gfx_task(void) { + iota_gfx_task_user(); + + if (display.dirty) { + iota_gfx_flush(); + } + + if (timer_elapsed(last_flush) > ScreenOffInterval) { + iota_gfx_off(); + } +} +#endif diff --git a/keyboards/helix/ssd1306.h b/keyboards/helix/ssd1306.h new file mode 100644 index 00000000..b65c505c --- /dev/null +++ b/keyboards/helix/ssd1306.h @@ -0,0 +1,93 @@ +#ifndef SSD1306_H +#define SSD1306_H + +#include +#include +#include "pincontrol.h" +#include "config.h" + +enum ssd1306_cmds { + DisplayOff = 0xAE, + DisplayOn = 0xAF, + + SetContrast = 0x81, + DisplayAllOnResume = 0xA4, + + DisplayAllOn = 0xA5, + NormalDisplay = 0xA6, + InvertDisplay = 0xA7, + SetDisplayOffset = 0xD3, + SetComPins = 0xda, + SetVComDetect = 0xdb, + SetDisplayClockDiv = 0xD5, + SetPreCharge = 0xd9, + SetMultiPlex = 0xa8, + SetLowColumn = 0x00, + SetHighColumn = 0x10, + SetStartLine = 0x40, + + SetMemoryMode = 0x20, + ColumnAddr = 0x21, + PageAddr = 0x22, + + ComScanInc = 0xc0, + ComScanDec = 0xc8, + SegRemap = 0xa0, + SetChargePump = 0x8d, + ExternalVcc = 0x01, + SwitchCapVcc = 0x02, + + ActivateScroll = 0x2f, + DeActivateScroll = 0x2e, + SetVerticalScrollArea = 0xa3, + RightHorizontalScroll = 0x26, + LeftHorizontalScroll = 0x27, + VerticalAndRightHorizontalScroll = 0x29, + VerticalAndLeftHorizontalScroll = 0x2a, +}; + +// Controls the SSD1306 128x32 OLED display via i2c + +#ifndef SSD1306_ADDRESS +#define SSD1306_ADDRESS 0x3C +#endif + +#define DisplayHeight 32 +#define DisplayWidth 128 + +#define FontHeight 8 +#define FontWidth 6 + +#define MatrixRows (DisplayHeight / FontHeight) +#define MatrixCols (DisplayWidth / FontWidth) + +struct CharacterMatrix { + uint8_t display[MatrixRows][MatrixCols]; + uint8_t *cursor; + bool dirty; +}; + +struct CharacterMatrix display; + +bool iota_gfx_init(bool rotate); +void iota_gfx_task(void); +bool iota_gfx_off(void); +bool iota_gfx_on(void); +void iota_gfx_flush(void); +void iota_gfx_write_char(uint8_t c); +void iota_gfx_write(const char *data); +void iota_gfx_write_P(const char *data); +void iota_gfx_clear_screen(void); + +void iota_gfx_task_user(void); + +void matrix_clear(struct CharacterMatrix *matrix); +void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c); +void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c); +void matrix_write(struct CharacterMatrix *matrix, const char *data); +void matrix_write_P(struct CharacterMatrix *matrix, const char *data); +void matrix_render(struct CharacterMatrix *matrix); + + + +#endif From f0f991dd89733b7dc9ca54042923c031b3b3ca73 Mon Sep 17 00:00:00 2001 From: Sam Perman Date: Sat, 27 Jan 2018 10:49:43 -0500 Subject: [PATCH 023/173] update sed to work on mac See https://stackoverflow.com/questions/19456518/invalid-command-code-despite-escaping-periods-using-sed --- util/new_project.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/new_project.sh b/util/new_project.sh index 0f507b67..11218440 100755 --- a/util/new_project.sh +++ b/util/new_project.sh @@ -15,8 +15,8 @@ KEYBOARD_UPPERCASE=$(echo $1 | awk '{print toupper($0)}') cp -r quantum/template keyboards/$KEYBOARD mv keyboards/$KEYBOARD/template.c keyboards/$KEYBOARD/$KEYBOARD.c mv keyboards/$KEYBOARD/template.h keyboards/$KEYBOARD/$KEYBOARD.h -find keyboards/${KEYBOARD} -type f -exec sed -i "s;%KEYBOARD%;$KEYBOARD;g" {} \; -find keyboards/${KEYBOARD} -type f -exec sed -i "s;%KEYBOARD_UPPERCASE%;$KEYBOARD_UPPERCASE;g" {} \; +find keyboards/${KEYBOARD} -type f -exec sed -i'' -e "s;%KEYBOARD%;$KEYBOARD;g" {} \; +find keyboards/${KEYBOARD} -type f -exec sed -i'' -e "s;%KEYBOARD_UPPERCASE%;$KEYBOARD_UPPERCASE;g" {} \; echo "######################################################" echo "# /keyboards/$KEYBOARD project created. To start" From 9bfaf66792310fae2d525633b280b354babca026 Mon Sep 17 00:00:00 2001 From: skullydazed Date: Sun, 28 Jan 2018 11:11:28 -0800 Subject: [PATCH 024/173] Always copy the firmware file to the root qmk_firmware directory (#2314) * Always copy the firmware file to the root qmk_firmware directory * remove circular dependency --- build_keyboard.mk | 4 +++- tmk_core/avr.mk | 2 +- tmk_core/chibios.mk | 2 +- tmk_core/rules.mk | 8 ++++---- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/build_keyboard.mk b/build_keyboard.mk index cbdaaa01..bee8fcc8 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -113,9 +113,11 @@ endif # We can assume a ChibiOS target When MCU_FAMILY is defined , since it's not used for LUFA ifdef MCU_FAMILY + FIRMWARE_FORMAT=bin PLATFORM=CHIBIOS else PLATFORM=AVR + FIRMWARE_FORMAT=hex endif ifeq ($(PLATFORM),CHIBIOS) @@ -270,7 +272,7 @@ $(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG) all: build check-size # Change the build target to build a HEX file or a library. -build: elf cphex +build: elf cpfirmware #build: elf hex eep lss sym #build: lib diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index 30d4fe26..24722736 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk @@ -136,7 +136,7 @@ flip: $(BUILD_DIR)/$(TARGET).hex check-size DFU_PROGRAMMER ?= dfu-programmer -dfu: $(BUILD_DIR)/$(TARGET).hex check-size +dfu: $(BUILD_DIR)/$(TARGET).hex cpfirmware check-size until $(DFU_PROGRAMMER) $(MCU) get bootloader-version; do\ echo "Error: Bootloader not found. Trying again in 5s." ;\ sleep 5 ;\ diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index cb0482d7..df9fa849 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk @@ -220,7 +220,7 @@ qmk: $(BUILD_DIR)/$(TARGET).bin zip $(TARGET).qmk -urj $(BUILD_DIR)/$(TARGET).json printf "@ $(TARGET).json\n@=info.json\n" | zipnote -w $(TARGET).qmk -dfu-util: $(BUILD_DIR)/$(TARGET).bin sizeafter +dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter $(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin bin: $(BUILD_DIR)/$(TARGET).bin sizeafter diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index 920a7f6a..7a282cac 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk @@ -216,9 +216,9 @@ MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@) elf: $(BUILD_DIR)/$(TARGET).elf hex: $(BUILD_DIR)/$(TARGET).hex -cphex: hex - $(SILENT) || printf "Copying $(TARGET).hex to qmk_firmware folder" | $(AWK_CMD) - $(COPY) $(BUILD_DIR)/$(TARGET).hex $(TARGET).hex && $(PRINT_OK) +cpfirmware: $(FIRMWARE_FORMAT) + $(SILENT) || printf "Copying $(TARGET).$(FIRMWARE_FORMAT) to qmk_firmware folder" | $(AWK_CMD) + $(COPY) $(BUILD_DIR)/$(TARGET).$(FIRMWARE_FORMAT) $(TARGET).$(FIRMWARE_FORMAT) && $(PRINT_OK) eep: $(BUILD_DIR)/$(TARGET).eep lss: $(BUILD_DIR)/$(TARGET).lss sym: $(BUILD_DIR)/$(TARGET).sym @@ -392,4 +392,4 @@ $(eval $(foreach OUTPUT,$(OUTPUTS),$(shell mkdir -p $(OUTPUT) 2>/dev/null))) .PHONY : all finish sizebefore sizeafter qmkversion \ gccversion build elf hex eep lss sym coff extcoff \ clean clean_list debug gdb-config show_path \ -program teensy dfu flip dfu-ee flip-ee dfu-start \ No newline at end of file +program teensy dfu flip dfu-ee flip-ee dfu-start From 056ecb1463de9fd5ab17e4b15893b2fbd2b1c339 Mon Sep 17 00:00:00 2001 From: sanosis Date: Sun, 28 Jan 2018 20:46:22 +0100 Subject: [PATCH 025/173] Adding jj40 to keyboard list (#2315) * Adding jj40 to keyboard list Adding jj40 to Community-supported list. * Update readme.md --- keyboards/readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/keyboards/readme.md b/keyboards/readme.md index eb77bf56..b81d5841 100644 --- a/keyboards/readme.md +++ b/keyboards/readme.md @@ -44,6 +44,7 @@ These keyboards are part of the QMK repository, but their manufacturers are not * [Happy Hacking Keyboard](/keyboards/hhkb) — The Happy Hacking keyboard can be hacked with a custom controller to run QMK. * [Infinity 60%](/keyboards/infinity60) - — Compact community keyboard by Input Club. * [JD45](/keyboards/jd45) — Another Geekhack community project, designed by jdcarpe. +* [JJ40](/keyboards/jj40) — ps2avrGB based ortholinear sold by KPrepublic * [KBD75](/keyboards/kbd75) — A 75% keyboard made by made by KBDFans. * [KC60](/keyboards/kc60) — A programmable Chinese-made keyboard, lost in the mists of time. * [Kinesis Advantage](/keyboards/kinesis) — Contoured ergonomic keyboard by Kinesis Computer Ergonomics. From 2480e5d69a11fd0774d16e57384b69c1e92cbfc8 Mon Sep 17 00:00:00 2001 From: sanosis Date: Sun, 28 Jan 2018 21:58:03 +0100 Subject: [PATCH 026/173] Support for YMDK NP21 (#2316) * ymdk_np21 initial support Base support of ymdk_np21 - based on jj40. Full grid layout * Update README.md Replacing description. * Adding YMDK NP21 to comunity list. Adding YMDK NP21 to community supported list. --- keyboards/readme.md | 1 + keyboards/ymdk_np21/README.md | 17 + keyboards/ymdk_np21/backlight.c | 212 ++++++++++ keyboards/ymdk_np21/backlight_custom.h | 15 + keyboards/ymdk_np21/breathing_custom.h | 140 +++++++ keyboards/ymdk_np21/config.h | 54 +++ keyboards/ymdk_np21/i2c.c | 104 +++++ keyboards/ymdk_np21/i2c.h | 25 ++ keyboards/ymdk_np21/keymaps/default/keymap.c | 47 +++ keyboards/ymdk_np21/matrix.c | 118 ++++++ keyboards/ymdk_np21/rules.mk | 59 +++ keyboards/ymdk_np21/usbconfig.h | 397 +++++++++++++++++++ keyboards/ymdk_np21/ymdk_np21.c | 80 ++++ keyboards/ymdk_np21/ymdk_np21.h | 43 ++ 14 files changed, 1312 insertions(+) create mode 100644 keyboards/ymdk_np21/README.md create mode 100644 keyboards/ymdk_np21/backlight.c create mode 100644 keyboards/ymdk_np21/backlight_custom.h create mode 100644 keyboards/ymdk_np21/breathing_custom.h create mode 100644 keyboards/ymdk_np21/config.h create mode 100644 keyboards/ymdk_np21/i2c.c create mode 100644 keyboards/ymdk_np21/i2c.h create mode 100644 keyboards/ymdk_np21/keymaps/default/keymap.c create mode 100644 keyboards/ymdk_np21/matrix.c create mode 100644 keyboards/ymdk_np21/rules.mk create mode 100644 keyboards/ymdk_np21/usbconfig.h create mode 100644 keyboards/ymdk_np21/ymdk_np21.c create mode 100644 keyboards/ymdk_np21/ymdk_np21.h diff --git a/keyboards/readme.md b/keyboards/readme.md index b81d5841..35900f61 100644 --- a/keyboards/readme.md +++ b/keyboards/readme.md @@ -60,3 +60,4 @@ These keyboards are part of the QMK repository, but their manufacturers are not * [WhiteFox](/keyboards/whitefox) — A 65% keyboard designed as a partnership by matt3o, Massdrop and Input Club * [Vision Division](/keyboards/vision_division) — Full Size / Split Linear Keyboard by IBNobody. * [XD75](/keyboards/xd75) — 15x5 ortholinear keyboard by XIUDI. +* [YMDK NP21](/keyboards/ymdk_np21) — ps2avrGB based number pad (numpad) sold by YMDK on Aliexpress. diff --git a/keyboards/ymdk_np21/README.md b/keyboards/ymdk_np21/README.md new file mode 100644 index 00000000..79e3386f --- /dev/null +++ b/keyboards/ymdk_np21/README.md @@ -0,0 +1,17 @@ +# YMDK NP21 + +![kp21 — full grid layout](https://ae01.alicdn.com/kf/HTB1d.txfHsTMeJjSszhq6AGCFXaF.jpg?size=35021&height=662&width=1000&hash=62b3a453686e2154dc51a7af67495e28) + +ps2avrGB based number-pad sold fully assembled by YMDK on Aliexpress. + +Keyboard Maintainer: [QMK Community](https://github.com/qmk) +Hardware Supported: Atmega32A +Hardware Availability: [AliExpress](https://www.aliexpress.com/item/21-Key-NPKC-Programmable-Cherry-MX-Kailh-Gateron-Switches-Mechanical-Keyboard-Numpad-Free-shipping/32812732361.html) + +Make example for this keyboard (after setting up your build environment): + + make ymdk_np21:default:program + +Plugging the board in while pressing 'Top Left Key' (USB on top) will force it to boot bootloader without loading the firmware. + +The code for NP21 is a minor edit of jj40. diff --git a/keyboards/ymdk_np21/backlight.c b/keyboards/ymdk_np21/backlight.c new file mode 100644 index 00000000..079c410f --- /dev/null +++ b/keyboards/ymdk_np21/backlight.c @@ -0,0 +1,212 @@ +/** + * Backlighting code for PS2AVRGB boards (ATMEGA32A) + * Kenneth A. (github.com/krusli | krusli.me) + */ + +#include "backlight.h" +#include "quantum.h" + +#include +#include + +#include "backlight_custom.h" +#include "breathing_custom.h" + +// DEBUG +#include +#include + +// Port D: digital pins of the AVR chipset +#define NUMLOCK_PORT (1 << 1) // 1st pin of Port D (digital) +#define CAPSLOCK_PORT (1 << 2) // 2nd pin +#define BACKLIGHT_PORT (1 << 4) // 4th pin +#define SCROLLLOCK_PORT (1 << 6) // 6th pin + +#define TIMER_CLK_DIV64 0x03 ///< Timer clocked at F_CPU/64 +#define TIMER1PRESCALE TIMER_CLK_DIV64 ///< timer 1 prescaler default + +#define TIMER_PRESCALE_MASK 0x07 ///< Timer Prescaler Bit-Mask + +#define PWM_MAX 0xFF +#define TIMER_TOP 255 // 8 bit PWM + +extern backlight_config_t backlight_config; + +/** + * References + * Port Registers: https://www.arduino.cc/en/Reference/PortManipulation + * TCCR1A: https://electronics.stackexchange.com/questions/92350/what-is-the-difference-between-tccr1a-and-tccr1b + * Timers: http://www.avrbeginners.net/architecture/timers/timers.html + * 16-bit timer setup: http://sculland.com/ATmega168/Interrupts-And-Timers/16-Bit-Timer-Setup/ + * PS2AVRGB firmware: https://github.com/showjean/ps2avrU/tree/master/firmware + */ + +// @Override +// turn LEDs on and off depending on USB caps/num/scroll lock states. +void led_set_user(uint8_t usb_led) { + if (usb_led & (1 << USB_LED_NUM_LOCK)) { + // turn on + DDRD |= NUMLOCK_PORT; + PORTD |= NUMLOCK_PORT; + } else { + // turn off + DDRD &= ~NUMLOCK_PORT; + PORTD &= ~NUMLOCK_PORT; + } + + if (usb_led & (1 << USB_LED_CAPS_LOCK)) { + DDRD |= CAPSLOCK_PORT; + PORTD |= CAPSLOCK_PORT; + } else { + DDRD &= ~CAPSLOCK_PORT; + PORTD &= ~CAPSLOCK_PORT; + } + + if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { + DDRD |= SCROLLLOCK_PORT; + PORTD |= SCROLLLOCK_PORT; + } else { + DDRD &= ~SCROLLLOCK_PORT; + PORTD &= ~SCROLLLOCK_PORT; + } +} + +#ifdef BACKLIGHT_ENABLE + +// sets up Timer 1 for 8-bit PWM +void timer1PWMSetup(void) { // NOTE ONLY CALL THIS ONCE + // default 8 bit mode + TCCR1A &= ~(1 << 1); // cbi(TCCR1A,PWM11); <- set PWM11 bit to HIGH + TCCR1A |= (1 << 0); // sbi(TCCR1A,PWM10); <- set PWM10 bit to LOW + + // clear output compare value A + // outb(OCR1AH, 0); + // outb(OCR1AL, 0); + + // clear output comparator registers for B + OCR1BH = 0; // outb(OCR1BH, 0); + OCR1BL = 0; // outb(OCR1BL, 0); +} + +bool is_init = false; +void timer1Init(void) { + // timer1SetPrescaler(TIMER1PRESCALE) + // set to DIV/64 + (TCCR1B) = ((TCCR1B) & ~TIMER_PRESCALE_MASK) | TIMER1PRESCALE; + + // reset TCNT1 + TCNT1H = 0; // outb(TCNT1H, 0); + TCNT1L = 0; // outb(TCNT1L, 0); + + // TOIE1: Timer Overflow Interrupt Enable (Timer 1); + TIMSK |= _BV(TOIE1); // sbi(TIMSK, TOIE1); + + is_init = true; +} + +void timer1UnInit(void) { + // set prescaler back to NONE + (TCCR1B) = ((TCCR1B) & ~TIMER_PRESCALE_MASK) | 0x00; // TIMERRTC_CLK_STOP + + // disable timer overflow interrupt + TIMSK &= ~_BV(TOIE1); // overflow bit? + + setPWM(0); + + is_init = false; +} + + +// handle TCNT1 overflow +//! Interrupt handler for tcnt1 overflow interrupt +ISR(TIMER1_OVF_vect, ISR_NOBLOCK) +{ + // sei(); + // handle breathing here + #ifdef BACKLIGHT_BREATHING + if (is_breathing()) { + custom_breathing_handler(); + } + #endif + + // TODO call user defined function +} + +// enable timer 1 PWM +// timer1PWMBOn() +void timer1PWMBEnable(void) { + // turn on channel B (OC1B) PWM output + // set OC1B as non-inverted PWM + TCCR1A |= _BV(COM1B1); + TCCR1A &= ~_BV(COM1B0); +} + +// disable timer 1 PWM +// timer1PWMBOff() +void timer1PWMBDisable(void) { + TCCR1A &= ~_BV(COM1B1); + TCCR1A &= ~_BV(COM1B0); +} + +void enableBacklight(void) { + DDRD |= BACKLIGHT_PORT; // set digital pin 4 as output + PORTD |= BACKLIGHT_PORT; // set digital pin 4 to high +} + +void disableBacklight(void) { + // DDRD &= ~BACKLIGHT_PORT; // set digital pin 4 as input + PORTD &= ~BACKLIGHT_PORT; // set digital pin 4 to low +} + +void startPWM(void) { + timer1Init(); + timer1PWMBEnable(); + enableBacklight(); +} + +void stopPWM(void) { + timer1UnInit(); + disableBacklight(); + timer1PWMBDisable(); +} + +void b_led_init_ports(void) { + /* turn backlight on/off depending on user preference */ + #if BACKLIGHT_ON_STATE == 0 + // DDRx register: sets the direction of Port D + // DDRD &= ~BACKLIGHT_PORT; // set digital pin 4 as input + PORTD &= ~BACKLIGHT_PORT; // set digital pin 4 to low + #else + DDRD |= BACKLIGHT_PORT; // set digital pin 4 as output + PORTD |= BACKLIGHT_PORT; // set digital pin 4 to high + #endif + + timer1PWMSetup(); + startPWM(); + + #ifdef BACKLIGHT_BREATHING + breathing_enable(); + #endif +} + +void b_led_set(uint8_t level) { + if (level > BACKLIGHT_LEVELS) { + level = BACKLIGHT_LEVELS; + } + + setPWM((int)(TIMER_TOP * (float) level / BACKLIGHT_LEVELS)); +} + +// called every matrix scan +void b_led_task(void) { + // do nothing for now +} + +void setPWM(uint16_t xValue) { + if (xValue > TIMER_TOP) { + xValue = TIMER_TOP; + } + OCR1B = xValue; // timer1PWMBSet(xValue); +} + +#endif // BACKLIGHT_ENABLE diff --git a/keyboards/ymdk_np21/backlight_custom.h b/keyboards/ymdk_np21/backlight_custom.h new file mode 100644 index 00000000..7210be84 --- /dev/null +++ b/keyboards/ymdk_np21/backlight_custom.h @@ -0,0 +1,15 @@ +/** + * Backlighting code for PS2AVRGB boards (ATMEGA32A) + * Kenneth A. (github.com/krusli | krusli.me) + */ + +#ifndef BACKLIGHT_CUSTOM_H +#define BACKLIGHT_CUSTOM_H + +#include +void b_led_init_ports(void); +void b_led_set(uint8_t level); +void b_led_task(void); +void setPWM(uint16_t xValue); + +#endif // BACKLIGHT_CUSTOM_H diff --git a/keyboards/ymdk_np21/breathing_custom.h b/keyboards/ymdk_np21/breathing_custom.h new file mode 100644 index 00000000..71416b1b --- /dev/null +++ b/keyboards/ymdk_np21/breathing_custom.h @@ -0,0 +1,140 @@ +/** + * Breathing effect code for PS2AVRGB boards (ATMEGA32A) + * Works in conjunction with `backlight.c`. + * + * Code adapted from `quantum.c` to register with the existing TIMER1 overflow + * handler in `backlight.c` instead of setting up its own timer. + * Kenneth A. (github.com/krusli | krusli.me) + */ + +#ifdef BACKLIGHT_ENABLE +#ifdef BACKLIGHT_BREATHING + +#include "backlight_custom.h" + +#ifndef BREATHING_PERIOD +#define BREATHING_PERIOD 6 +#endif + +#define breathing_min() do {breathing_counter = 0;} while (0) +#define breathing_max() do {breathing_counter = breathing_period * 244 / 2;} while (0) + +// TODO make this share code with quantum.c + +#define BREATHING_NO_HALT 0 +#define BREATHING_HALT_OFF 1 +#define BREATHING_HALT_ON 2 +#define BREATHING_STEPS 128 + +static uint8_t breathing_period = BREATHING_PERIOD; +static uint8_t breathing_halt = BREATHING_NO_HALT; +static uint16_t breathing_counter = 0; + +static bool breathing = false; + +bool is_breathing(void) { + return breathing; +} + +// See http://jared.geek.nz/2013/feb/linear-led-pwm +static uint16_t cie_lightness(uint16_t v) { + if (v <= 5243) // if below 8% of max + return v / 9; // same as dividing by 900% + else { + uint32_t y = (((uint32_t) v + 10486) << 8) / (10486 + 0xFFFFUL); // add 16% of max and compare + // to get a useful result with integer division, we shift left in the expression above + // and revert what we've done again after squaring. + y = y * y * y >> 8; + if (y > 0xFFFFUL) // prevent overflow + return 0xFFFFU; + else + return (uint16_t) y; + } +} + +void breathing_enable(void) { + breathing = true; + breathing_counter = 0; + breathing_halt = BREATHING_NO_HALT; + // interrupt already registered +} + +void breathing_pulse(void) { + if (get_backlight_level() == 0) + breathing_min(); + else + breathing_max(); + breathing_halt = BREATHING_HALT_ON; + // breathing_interrupt_enable(); + breathing = true; +} + +void breathing_disable(void) { + breathing = false; + // backlight_set(get_backlight_level()); + b_led_set(get_backlight_level()); // custom implementation of backlight_set() +} + +void breathing_self_disable(void) +{ + if (get_backlight_level() == 0) + breathing_halt = BREATHING_HALT_OFF; + else + breathing_halt = BREATHING_HALT_ON; +} + +void breathing_toggle(void) { + if (is_breathing()) + breathing_disable(); + else + breathing_enable(); +} + +void breathing_period_set(uint8_t value) +{ + if (!value) + value = 1; + breathing_period = value; +} + +void breathing_period_default(void) { + breathing_period_set(BREATHING_PERIOD); +} + +void breathing_period_inc(void) +{ + breathing_period_set(breathing_period+1); +} + +void breathing_period_dec(void) +{ + breathing_period_set(breathing_period-1); +} + +/* To generate breathing curve in python: + * from math import sin, pi; [int(sin(x/128.0*pi)**4*255) for x in range(128)] + */ +static const uint8_t breathing_table[BREATHING_STEPS] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 17, 20, 24, 28, 32, 36, 41, 46, 51, 57, 63, 70, 76, 83, 91, 98, 106, 113, 121, 129, 138, 146, 154, 162, 170, 178, 185, 193, 200, 207, 213, 220, 225, 231, 235, 240, 244, 247, 250, 252, 253, 254, 255, 254, 253, 252, 250, 247, 244, 240, 235, 231, 225, 220, 213, 207, 200, 193, 185, 178, 170, 162, 154, 146, 138, 129, 121, 113, 106, 98, 91, 83, 76, 70, 63, 57, 51, 46, 41, 36, 32, 28, 24, 20, 17, 15, 12, 10, 8, 6, 5, 4, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + +// Use this before the cie_lightness function. +static inline uint16_t scale_backlight(uint16_t v) { + return v / BACKLIGHT_LEVELS * get_backlight_level(); +} + +void custom_breathing_handler(void) { + uint16_t interval = (uint16_t) breathing_period * 244 / BREATHING_STEPS; + // resetting after one period to prevent ugly reset at overflow. + breathing_counter = (breathing_counter + 1) % (breathing_period * 244); + uint8_t index = breathing_counter / interval % BREATHING_STEPS; + + if (((breathing_halt == BREATHING_HALT_ON) && (index == BREATHING_STEPS / 2)) || + ((breathing_halt == BREATHING_HALT_OFF) && (index == BREATHING_STEPS - 1))) + { + // breathing_interrupt_disable(); + } + + setPWM(cie_lightness(scale_backlight((uint16_t) pgm_read_byte(&breathing_table[index]) * 0x0101U))); +} + +#endif // BACKLIGHT_BREATHING +#endif // BACKLIGHT_ENABLE diff --git a/keyboards/ymdk_np21/config.h b/keyboards/ymdk_np21/config.h new file mode 100644 index 00000000..2b358113 --- /dev/null +++ b/keyboards/ymdk_np21/config.h @@ -0,0 +1,54 @@ +/* +Copyright 2017 Luiz Ribeiro + +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 "config_common.h" + +#ifndef CONFIG_H +#define CONFIG_H + +#define VENDOR_ID 0x20A0 +#define PRODUCT_ID 0x422D +// TODO: share these strings with usbconfig.h +// Edit usbconfig.h to change these. +#define MANUFACTURER ymdk +#define PRODUCT np21 + +/* matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 15 + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +#define BACKLIGHT_LEVELS 12 +// #define BACKLIGHT_BREATHING // works, but BL_TOGG might not work + +#define TAPPING_TOGGLE 3 + +#define NO_UART 1 + +/* RGB underglow */ +// The RGB_DI_PIN value seems to be shared between all PS2AVRGB boards. +// The same pin is used on the JJ40, at least. +#define RGBLED_NUM 5 +#define RGB_DI_PIN E2 // NOTE: for PS2AVRGB boards, underglow commands are sent via I2C to 0xB0. +#define RGBLIGHT_ANIMATIONS + +/* key combination for command */ +#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) + +#endif diff --git a/keyboards/ymdk_np21/i2c.c b/keyboards/ymdk_np21/i2c.c new file mode 100644 index 00000000..c27f3e3d --- /dev/null +++ b/keyboards/ymdk_np21/i2c.c @@ -0,0 +1,104 @@ +/* +Copyright 2016 Luiz Ribeiro + +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 +#include + +#include "i2c.h" + +void i2c_set_bitrate(uint16_t bitrate_khz) { + uint8_t bitrate_div = ((F_CPU / 1000l) / bitrate_khz); + if (bitrate_div >= 16) { + bitrate_div = (bitrate_div - 16) / 2; + } + TWBR = bitrate_div; +} + +void i2c_init(void) { + // set pull-up resistors on I2C bus pins + PORTC |= 0b11; + + i2c_set_bitrate(400); + + // enable TWI (two-wire interface) + TWCR |= (1 << TWEN); + + // enable TWI interrupt and slave address ACK + TWCR |= (1 << TWIE); + TWCR |= (1 << TWEA); +} + +uint8_t i2c_start(uint8_t address) { + // reset TWI control register + TWCR = 0; + + // begin transmission and wait for it to end + TWCR = (1< + +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 __I2C_H__ +#define __I2C_H__ + +void i2c_init(void); +void i2c_set_bitrate(uint16_t bitrate_khz); +uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length); + +#endif diff --git a/keyboards/ymdk_np21/keymaps/default/keymap.c b/keyboards/ymdk_np21/keymaps/default/keymap.c new file mode 100644 index 00000000..e79d326b --- /dev/null +++ b/keyboards/ymdk_np21/keymaps/default/keymap.c @@ -0,0 +1,47 @@ +#include "ymdk_np21.h" +#include "action_layer.h" + +#define _NP 0 +#define _BL 1 + +enum custom_keycodes { + NP = SAFE_RANGE, + BL +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Qwerty + * ,-----------------------------------------. + * | 0 | 1 | 4 | 7 | NUM | ESC | + * |------+------+------+------+------+------| + * | . | 2 | 5 | 8 | / | TAB |---, + * |------+------+------+------+------+------|USB| + * | DOT | 3 | 6 | 9 | * | BS |---' + * |------+------+------+------+------+------| + * | Enter| Enter| + | + | - | FN | + * `-----------------------------------------' + */ +[_NP] = KEYMAP( \ + KC_KP_0, KC_KP_1, KC_KP_4, KC_KP_7, KC_NUMLOCK, KC_ESC, \ + KC_DOT, KC_KP_2, KC_KP_5, KC_KP_8, KC_KP_SLASH, KC_TAB, \ + KC_KP_DOT, KC_KP_3, KC_KP_6, KC_KP_9, KC_KP_ASTERISK, KC_BSPACE, \ + KC_KP_ENTER, KC_KP_ENTER, KC_KP_PLUS, KC_KP_PLUS, KC_KP_MINUS, MO(_BL) \ +), +/* Qwerty + * ,---------------------------------------------. + * | BL_BRTG | | | | | | + * |---------+--------+---------+--------+---+---| + * | | BL_OFF | BL_TOGG | BL_ON | | |---, + * |---------+--------+---------+--------+---+---|USB| + * | | | | | | |---' + * |---------+--------+---------+--------+---+---| + * | BL_DEC | BL_DEC | BL_INC | BL_INC | | | + * `---------------------------------------------' + */ +[_BL] = KEYMAP( \ + BL_BRTG, _______, _______, _______, _______, _______, \ + _______, BL_OFF, BL_TOGG, BL_ON, _______, _______, \ + _______, _______, _______, _______, _______, _______, \ + BL_DEC, BL_DEC, BL_INC, BL_INC, _______, _______ \ +) +}; diff --git a/keyboards/ymdk_np21/matrix.c b/keyboards/ymdk_np21/matrix.c new file mode 100644 index 00000000..a9e9cb53 --- /dev/null +++ b/keyboards/ymdk_np21/matrix.c @@ -0,0 +1,118 @@ +/* +Copyright 2017 Luiz Ribeiro + +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 +#include + +#include "matrix.h" + +#ifndef DEBOUNCE +# define DEBOUNCE 5 +#endif + +static uint8_t debouncing = DEBOUNCE; + +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +void matrix_set_row_status(uint8_t row); +uint8_t bit_reverse(uint8_t x); + +void matrix_init(void) { + // all outputs for rows high + DDRB = 0xFF; + PORTB = 0xFF; + // all inputs for columns + DDRA = 0x00; + DDRC &= ~(0x111111<<2); + DDRD &= ~(1< 7 + (~PINA) & 0xFF + ) | ( + // cols 8..13, PORTC 7 -> 0 + bit_reverse((~PINC) & 0xFF) << 8 + ) | ( + // col 14, PORTD 7 + ((~PIND) & (1 << PIND7)) << 7 + ); + + if (matrix_debouncing[row] != cols) { + matrix_debouncing[row] = cols; + debouncing = DEBOUNCE; + } + } + + if (debouncing) { + if (--debouncing) { + _delay_ms(1); + } else { + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = matrix_debouncing[i]; + } + } + } + + matrix_scan_quantum(); // also missing in original PS2AVRGB implementation + + return 1; +} + +void matrix_scan_kb(void) { + // Looping keyboard code goes here + // This runs every cycle (a lot) + matrix_scan_user(); +}; + +// declarations +void matrix_set_row_status(uint8_t row) { + DDRB = (1 << row); + PORTB = ~(1 << row); +} + +uint8_t bit_reverse(uint8_t x) { + x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa); + x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc); + x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0); + return x; +} + +inline matrix_row_t matrix_get_row(uint8_t row) { + return matrix[row]; +} + +void matrix_print(void) { +} diff --git a/keyboards/ymdk_np21/rules.mk b/keyboards/ymdk_np21/rules.mk new file mode 100644 index 00000000..670967fb --- /dev/null +++ b/keyboards/ymdk_np21/rules.mk @@ -0,0 +1,59 @@ +# Copyright 2017 Luiz Ribeiro +# +# 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 . + +# MCU name +MCU = atmega32a +PROTOCOL = VUSB + +# unsupported features for now +NO_UART = yes +NO_SUSPEND_POWER_DOWN = yes + +# processor frequency +F_CPU = 12000000 + +# Bootloader +# This definition is optional, and if your keyboard supports multiple bootloaders of +# different sizes, comment this out, and the correct address will be loaded +# automatically (+60). See bootloader.mk for all options. +BOOTLOADER = bootloadHID + +# build options +BOOTMAGIC_ENABLE = no +MOUSEKEY_ENABLE = no +EXTRAKEY_ENABLE = yes +CONSOLE_ENABLE = no +COMMAND_ENABLE = yes + +BACKLIGHT_ENABLE = yes +BACKLIGHT_CUSTOM_DRIVER = yes + +RGBLIGHT_ENABLE = yes +RGBLIGHT_CUSTOM_DRIVER = yes +# DISABLE_WS2812 = no + +KEY_LOCK_ENABLE = yes + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +OPT_DEFS = -DDEBUG_LEVEL=0 + +# custom matrix setup +CUSTOM_MATRIX = yes +SRC = matrix.c i2c.c backlight.c + +# programming options +PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex diff --git a/keyboards/ymdk_np21/usbconfig.h b/keyboards/ymdk_np21/usbconfig.h new file mode 100644 index 00000000..ad97e7f0 --- /dev/null +++ b/keyboards/ymdk_np21/usbconfig.h @@ -0,0 +1,397 @@ +/* Name: usbconfig.h + * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers + * Author: Christian Starkjohann + * Creation Date: 2005-04-01 + * Tabsize: 4 + * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH + * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) + * This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $ + */ + +#ifndef __usbconfig_h_included__ +#define __usbconfig_h_included__ + +#include "config.h" + +/* +General Description: +This file is an example configuration (with inline documentation) for the USB +driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is +also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may +wire the lines to any other port, as long as D+ is also wired to INT0 (or any +other hardware interrupt, as long as it is the highest level interrupt, see +section at the end of this file). +*/ + +/* ---------------------------- Hardware Config ---------------------------- */ + +#define USB_CFG_IOPORTNAME D +/* This is the port where the USB bus is connected. When you configure it to + * "B", the registers PORTB, PINB and DDRB will be used. + */ +#define USB_CFG_DMINUS_BIT 3 +/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. + * This may be any bit in the port. + */ +#define USB_CFG_DPLUS_BIT 2 +/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. + * This may be any bit in the port. Please note that D+ must also be connected + * to interrupt pin INT0! [You can also use other interrupts, see section + * "Optional MCU Description" below, or you can connect D- to the interrupt, as + * it is required if you use the USB_COUNT_SOF feature. If you use D- for the + * interrupt, the USB interrupt will also be triggered at Start-Of-Frame + * markers every millisecond.] + */ +#define USB_CFG_CLOCK_KHZ (F_CPU/1000) +/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000, + * 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code + * require no crystal, they tolerate +/- 1% deviation from the nominal + * frequency. All other rates require a precision of 2000 ppm and thus a + * crystal! + * Since F_CPU should be defined to your actual clock rate anyway, you should + * not need to modify this setting. + */ +#define USB_CFG_CHECK_CRC 0 +/* Define this to 1 if you want that the driver checks integrity of incoming + * data packets (CRC checks). CRC checks cost quite a bit of code size and are + * currently only available for 18 MHz crystal clock. You must choose + * USB_CFG_CLOCK_KHZ = 18000 if you enable this option. + */ + +/* ----------------------- Optional Hardware Config ------------------------ */ + +/* #define USB_CFG_PULLUP_IOPORTNAME D */ +/* If you connect the 1.5k pullup resistor from D- to a port pin instead of + * V+, you can connect and disconnect the device from firmware by calling + * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h). + * This constant defines the port on which the pullup resistor is connected. + */ +/* #define USB_CFG_PULLUP_BIT 4 */ +/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined + * above) where the 1.5k pullup resistor is connected. See description + * above for details. + */ + +/* --------------------------- Functional Range ---------------------------- */ + +#define USB_CFG_HAVE_INTRIN_ENDPOINT 1 +/* Define this to 1 if you want to compile a version with two endpoints: The + * default control endpoint 0 and an interrupt-in endpoint (any other endpoint + * number). + */ +#define USB_CFG_HAVE_INTRIN_ENDPOINT3 1 +/* Define this to 1 if you want to compile a version with three endpoints: The + * default control endpoint 0, an interrupt-in endpoint 3 (or the number + * configured below) and a catch-all default interrupt-in endpoint as above. + * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature. + */ +#define USB_CFG_EP3_NUMBER 3 +/* If the so-called endpoint 3 is used, it can now be configured to any other + * endpoint number (except 0) with this macro. Default if undefined is 3. + */ +/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */ +/* The above macro defines the startup condition for data toggling on the + * interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1. + * Since the token is toggled BEFORE sending any data, the first packet is + * sent with the oposite value of this configuration! + */ +#define USB_CFG_IMPLEMENT_HALT 0 +/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature + * for endpoint 1 (interrupt endpoint). Although you may not need this feature, + * it is required by the standard. We have made it a config option because it + * bloats the code considerably. + */ +#define USB_CFG_SUPPRESS_INTR_CODE 0 +/* Define this to 1 if you want to declare interrupt-in endpoints, but don't + * want to send any data over them. If this macro is defined to 1, functions + * usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if + * you need the interrupt-in endpoints in order to comply to an interface + * (e.g. HID), but never want to send any data. This option saves a couple + * of bytes in flash memory and the transmit buffers in RAM. + */ +#define USB_CFG_INTR_POLL_INTERVAL 1 +/* If you compile a version with endpoint 1 (interrupt-in), this is the poll + * interval. The value is in milliseconds and must not be less than 10 ms for + * low speed devices. + */ +#define USB_CFG_IS_SELF_POWERED 0 +/* Define this to 1 if the device has its own power supply. Set it to 0 if the + * device is powered from the USB bus. + */ +// max power draw with maxed white underglow measured at 120 mA (peaks) +#define USB_CFG_MAX_BUS_POWER 100 +/* Set this variable to the maximum USB bus power consumption of your device. + * The value is in milliamperes. [It will be divided by two since USB + * communicates power requirements in units of 2 mA.] + */ +#define USB_CFG_IMPLEMENT_FN_WRITE 1 +/* Set this to 1 if you want usbFunctionWrite() to be called for control-out + * transfers. Set it to 0 if you don't need it and want to save a couple of + * bytes. + */ +#define USB_CFG_IMPLEMENT_FN_READ 0 +/* Set this to 1 if you need to send control replies which are generated + * "on the fly" when usbFunctionRead() is called. If you only want to send + * data from a static buffer, set it to 0 and return the data from + * usbFunctionSetup(). This saves a couple of bytes. + */ +#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0 +/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints. + * You must implement the function usbFunctionWriteOut() which receives all + * interrupt/bulk data sent to any endpoint other than 0. The endpoint number + * can be found in 'usbRxToken'. + */ +#define USB_CFG_HAVE_FLOWCONTROL 0 +/* Define this to 1 if you want flowcontrol over USB data. See the definition + * of the macros usbDisableAllRequests() and usbEnableAllRequests() in + * usbdrv.h. + */ +#define USB_CFG_DRIVER_FLASH_PAGE 0 +/* If the device has more than 64 kBytes of flash, define this to the 64 k page + * where the driver's constants (descriptors) are located. Or in other words: + * Define this to 1 for boot loaders on the ATMega128. + */ +#define USB_CFG_LONG_TRANSFERS 0 +/* Define this to 1 if you want to send/receive blocks of more than 254 bytes + * in a single control-in or control-out transfer. Note that the capability + * for long transfers increases the driver size. + */ +/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */ +/* This macro is a hook if you want to do unconventional things. If it is + * defined, it's inserted at the beginning of received message processing. + * If you eat the received message and don't want default processing to + * proceed, do a return after doing your things. One possible application + * (besides debugging) is to flash a status LED on each packet. + */ +/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */ +/* This macro is a hook if you need to know when an USB RESET occurs. It has + * one parameter which distinguishes between the start of RESET state and its + * end. + */ +/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */ +/* This macro (if defined) is executed when a USB SET_ADDRESS request was + * received. + */ +#define USB_COUNT_SOF 1 +/* define this macro to 1 if you need the global variable "usbSofCount" which + * counts SOF packets. This feature requires that the hardware interrupt is + * connected to D- instead of D+. + */ +/* #ifdef __ASSEMBLER__ + * macro myAssemblerMacro + * in YL, TCNT0 + * sts timer0Snapshot, YL + * endm + * #endif + * #define USB_SOF_HOOK myAssemblerMacro + * This macro (if defined) is executed in the assembler module when a + * Start Of Frame condition is detected. It is recommended to define it to + * the name of an assembler macro which is defined here as well so that more + * than one assembler instruction can be used. The macro may use the register + * YL and modify SREG. If it lasts longer than a couple of cycles, USB messages + * immediately after an SOF pulse may be lost and must be retried by the host. + * What can you do with this hook? Since the SOF signal occurs exactly every + * 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in + * designs running on the internal RC oscillator. + * Please note that Start Of Frame detection works only if D- is wired to the + * interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES! + */ +#define USB_CFG_CHECK_DATA_TOGGLING 0 +/* define this macro to 1 if you want to filter out duplicate data packets + * sent by the host. Duplicates occur only as a consequence of communication + * errors, when the host does not receive an ACK. Please note that you need to + * implement the filtering yourself in usbFunctionWriteOut() and + * usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable + * for each control- and out-endpoint to check for duplicate packets. + */ +#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0 +/* define this macro to 1 if you want the function usbMeasureFrameLength() + * compiled in. This function can be used to calibrate the AVR's RC oscillator. + */ +#define USB_USE_FAST_CRC 0 +/* The assembler module has two implementations for the CRC algorithm. One is + * faster, the other is smaller. This CRC routine is only used for transmitted + * messages where timing is not critical. The faster routine needs 31 cycles + * per byte while the smaller one needs 61 to 69 cycles. The faster routine + * may be worth the 32 bytes bigger code size if you transmit lots of data and + * run the AVR close to its limit. + */ + +/* -------------------------- Device Description --------------------------- */ + +#define USB_CFG_VENDOR_ID (VENDOR_ID & 0xFF), ((VENDOR_ID >> 8) & 0xFF) +/* USB vendor ID for the device, low byte first. If you have registered your + * own Vendor ID, define it here. Otherwise you may use one of obdev's free + * shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules! + * *** IMPORTANT NOTE *** + * This template uses obdev's shared VID/PID pair for Vendor Class devices + * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand + * the implications! + */ +#define USB_CFG_DEVICE_ID (PRODUCT_ID & 0xFF), ((PRODUCT_ID >> 8) & 0xFF) +/* This is the ID of the product, low byte first. It is interpreted in the + * scope of the vendor ID. If you have registered your own VID with usb.org + * or if you have licensed a PID from somebody else, define it here. Otherwise + * you may use one of obdev's free shared VID/PID pairs. See the file + * USB-IDs-for-free.txt for details! + * *** IMPORTANT NOTE *** + * This template uses obdev's shared VID/PID pair for Vendor Class devices + * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand + * the implications! + */ +#define USB_CFG_DEVICE_VERSION 0x00, 0x02 +/* Version number of the device: Minor number first, then major number. + */ +#define USB_CFG_VENDOR_NAME 'w', 'i', 'n', 'k', 'e', 'y', 'l', 'e', 's', 's', '.', 'k', 'r' +#define USB_CFG_VENDOR_NAME_LEN 13 +/* These two values define the vendor name returned by the USB device. The name + * must be given as a list of characters under single quotes. The characters + * are interpreted as Unicode (UTF-16) entities. + * If you don't want a vendor name string, undefine these macros. + * ALWAYS define a vendor name containing your Internet domain name if you use + * obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for + * details. + */ +#define USB_CFG_DEVICE_NAME 'j', 'j', '4', '0' +#define USB_CFG_DEVICE_NAME_LEN 4 +/* Same as above for the device name. If you don't want a device name, undefine + * the macros. See the file USB-IDs-for-free.txt before you assign a name if + * you use a shared VID/PID. + */ +/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */ +/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */ +/* Same as above for the serial number. If you don't want a serial number, + * undefine the macros. + * It may be useful to provide the serial number through other means than at + * compile time. See the section about descriptor properties below for how + * to fine tune control over USB descriptors such as the string descriptor + * for the serial number. + */ +#define USB_CFG_DEVICE_CLASS 0 +#define USB_CFG_DEVICE_SUBCLASS 0 +/* See USB specification if you want to conform to an existing device class. + * Class 0xff is "vendor specific". + */ +#define USB_CFG_INTERFACE_CLASS 3 /* HID */ +#define USB_CFG_INTERFACE_SUBCLASS 1 /* Boot */ +#define USB_CFG_INTERFACE_PROTOCOL 1 /* Keyboard */ +/* See USB specification if you want to conform to an existing device class or + * protocol. The following classes must be set at interface level: + * HID class is 3, no subclass and protocol required (but may be useful!) + * CDC class is 2, use subclass 2 and protocol 1 for ACM + */ +#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0 +/* Define this to the length of the HID report descriptor, if you implement + * an HID device. Otherwise don't define it or define it to 0. + * If you use this define, you must add a PROGMEM character array named + * "usbHidReportDescriptor" to your code which contains the report descriptor. + * Don't forget to keep the array and this define in sync! + */ + +/* #define USB_PUBLIC static */ +/* Use the define above if you #include usbdrv.c instead of linking against it. + * This technique saves a couple of bytes in flash memory. + */ + +/* ------------------- Fine Control over USB Descriptors ------------------- */ +/* If you don't want to use the driver's default USB descriptors, you can + * provide our own. These can be provided as (1) fixed length static data in + * flash memory, (2) fixed length static data in RAM or (3) dynamically at + * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more + * information about this function. + * Descriptor handling is configured through the descriptor's properties. If + * no properties are defined or if they are 0, the default descriptor is used. + * Possible properties are: + * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched + * at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is + * used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if + * you want RAM pointers. + * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found + * in static memory is in RAM, not in flash memory. + * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash), + * the driver must know the descriptor's length. The descriptor itself is + * found at the address of a well known identifier (see below). + * List of static descriptor names (must be declared PROGMEM if in flash): + * char usbDescriptorDevice[]; + * char usbDescriptorConfiguration[]; + * char usbDescriptorHidReport[]; + * char usbDescriptorString0[]; + * int usbDescriptorStringVendor[]; + * int usbDescriptorStringDevice[]; + * int usbDescriptorStringSerialNumber[]; + * Other descriptors can't be provided statically, they must be provided + * dynamically at runtime. + * + * Descriptor properties are or-ed or added together, e.g.: + * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18)) + * + * The following descriptors are defined: + * USB_CFG_DESCR_PROPS_DEVICE + * USB_CFG_DESCR_PROPS_CONFIGURATION + * USB_CFG_DESCR_PROPS_STRINGS + * USB_CFG_DESCR_PROPS_STRING_0 + * USB_CFG_DESCR_PROPS_STRING_VENDOR + * USB_CFG_DESCR_PROPS_STRING_PRODUCT + * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER + * USB_CFG_DESCR_PROPS_HID + * USB_CFG_DESCR_PROPS_HID_REPORT + * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver) + * + * Note about string descriptors: String descriptors are not just strings, they + * are Unicode strings prefixed with a 2 byte header. Example: + * int serialNumberDescriptor[] = { + * USB_STRING_DESCRIPTOR_HEADER(6), + * 'S', 'e', 'r', 'i', 'a', 'l' + * }; + */ + +#define USB_CFG_DESCR_PROPS_DEVICE 0 +#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC +//#define USB_CFG_DESCR_PROPS_CONFIGURATION 0 +#define USB_CFG_DESCR_PROPS_STRINGS 0 +#define USB_CFG_DESCR_PROPS_STRING_0 0 +#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0 +#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0 +#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0 +#define USB_CFG_DESCR_PROPS_HID USB_PROP_IS_DYNAMIC +//#define USB_CFG_DESCR_PROPS_HID 0 +#define USB_CFG_DESCR_PROPS_HID_REPORT USB_PROP_IS_DYNAMIC +//#define USB_CFG_DESCR_PROPS_HID_REPORT 0 +#define USB_CFG_DESCR_PROPS_UNKNOWN 0 + +#define usbMsgPtr_t unsigned short +/* If usbMsgPtr_t is not defined, it defaults to 'uchar *'. We define it to + * a scalar type here because gcc generates slightly shorter code for scalar + * arithmetics than for pointer arithmetics. Remove this define for backward + * type compatibility or define it to an 8 bit type if you use data in RAM only + * and all RAM is below 256 bytes (tiny memory model in IAR CC). + */ + +/* ----------------------- Optional MCU Description ------------------------ */ + +/* The following configurations have working defaults in usbdrv.h. You + * usually don't need to set them explicitly. Only if you want to run + * the driver on a device which is not yet supported or with a compiler + * which is not fully supported (such as IAR C) or if you use a differnt + * interrupt than INT0, you may have to define some of these. + */ +/* #define USB_INTR_CFG MCUCR */ +/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */ +/* #define USB_INTR_CFG_CLR 0 */ +/* #define USB_INTR_ENABLE GIMSK */ +/* #define USB_INTR_ENABLE_BIT INT0 */ +/* #define USB_INTR_PENDING GIFR */ +/* #define USB_INTR_PENDING_BIT INTF0 */ +/* #define USB_INTR_VECTOR INT0_vect */ + +/* Set INT1 for D- falling edge to count SOF */ +/* #define USB_INTR_CFG EICRA */ +#define USB_INTR_CFG_SET ((1 << ISC11) | (0 << ISC10)) +/* #define USB_INTR_CFG_CLR 0 */ +/* #define USB_INTR_ENABLE EIMSK */ +#define USB_INTR_ENABLE_BIT INT1 +/* #define USB_INTR_PENDING EIFR */ +#define USB_INTR_PENDING_BIT INTF1 +#define USB_INTR_VECTOR INT1_vect + +#endif /* __usbconfig_h_included__ */ diff --git a/keyboards/ymdk_np21/ymdk_np21.c b/keyboards/ymdk_np21/ymdk_np21.c new file mode 100644 index 00000000..670083a1 --- /dev/null +++ b/keyboards/ymdk_np21/ymdk_np21.c @@ -0,0 +1,80 @@ +/* +Copyright 2017 Luiz Ribeiro +Modified 2018 Kenneth A. + +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 "ymdk_np21.h" + +#include + +#include "action_layer.h" +#include "quantum.h" + +#include "i2c.h" + +#include "backlight.h" +#include "backlight_custom.h" + +extern rgblight_config_t rgblight_config; + +// for keyboard subdirectory level init functions +// @Override +void matrix_init_kb(void) { + // call user level keymaps, if any + // matrix_init_user(); +} + +#ifdef BACKLIGHT_ENABLE +/// Overrides functions in `quantum.c` +void backlight_init_ports(void) { + b_led_init_ports(); +} + +void backlight_task(void) { + b_led_task(); +} + +void backlight_set(uint8_t level) { + b_led_set(level); +} +#endif + +// custom RGB driver +void rgblight_set(void) { + if (!rgblight_config.enable) { + for (uint8_t i=0; i + +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_COMMON_H +#define KEYMAP_COMMON_H + +#include "quantum.h" +#include "quantum_keycodes.h" +#include "keycode.h" +#include "action.h" + +void matrix_init_user(void); // TODO port this to other PS2AVRGB boards + +#define KEYMAP_GRID( \ + K01, K02, K03, K04, K05, K06, \ + K11, K12, K13, K14, K15, K16, \ + K21, K22, K23, K24, K25, K26, \ + K31, K32, K33, K34, K35, K36 \ +) \ +{ \ + { K06, K05, K04, K03, K02, K01 }, \ + { K16, K15, K14, K13, K12, K11 }, \ + { K26, K25, K24, K23, K22, K21 }, \ + { K36, K35, K34, K33, K32, K31 } \ +} + +#define KEYMAP KEYMAP_GRID + +#endif From b0805e38b9389ff79e4ba9b4e35ec08b18f7a728 Mon Sep 17 00:00:00 2001 From: LEdiodes Date: Sun, 28 Jan 2018 14:58:42 -0600 Subject: [PATCH 027/173] added ATOM47 (Vortex Core QMK powered PCB) & DZ60 Custom config(LEdiodes) (#2310) * added ATOM47 (Vortex Core QMK powered PCB) * fixed broken\unfinished comment block * moved Layer template to default template. * moved Layer template to default template and removed template from the keymap.c file. * Added LEdiodes config * created readme.md contains an image of 60% board(LEdiodes). * updated readme.md with images added images of the PCB and some feature details from https://geekhack.org/index.php?topic=93447.msg2545221#msg2545221 * removed excess words. * followed the readme template to a T. * formatting fix : added a return. --- keyboards/atom47/atom47.c | 31 +++++ keyboards/atom47/atom47.h | 25 ++++ keyboards/atom47/config.h | 73 +++++++++++ keyboards/atom47/keymaps/LEdiodes/atom47.c | 31 +++++ keyboards/atom47/keymaps/LEdiodes/atom47.h | 25 ++++ keyboards/atom47/keymaps/LEdiodes/config.h | 73 +++++++++++ keyboards/atom47/keymaps/LEdiodes/keymap.c | 35 +++++ keyboards/atom47/keymaps/LEdiodes/rules.mk | 65 ++++++++++ keyboards/atom47/keymaps/default/keymap.c | 39 ++++++ keyboards/atom47/keymaps/default/readme.md | 10 ++ keyboards/atom47/readme.md | 28 ++++ keyboards/atom47/rules.mk | 65 ++++++++++ keyboards/dz60/keymaps/LEdiodes/config.h | 58 +++++++++ keyboards/dz60/keymaps/LEdiodes/keymap.c | 141 +++++++++++++++++++++ keyboards/dz60/keymaps/LEdiodes/readme.md | 9 ++ keyboards/dz60/keymaps/LEdiodes/rules.mk | 57 +++++++++ 16 files changed, 765 insertions(+) create mode 100644 keyboards/atom47/atom47.c create mode 100644 keyboards/atom47/atom47.h create mode 100644 keyboards/atom47/config.h create mode 100644 keyboards/atom47/keymaps/LEdiodes/atom47.c create mode 100644 keyboards/atom47/keymaps/LEdiodes/atom47.h create mode 100644 keyboards/atom47/keymaps/LEdiodes/config.h create mode 100644 keyboards/atom47/keymaps/LEdiodes/keymap.c create mode 100644 keyboards/atom47/keymaps/LEdiodes/rules.mk create mode 100644 keyboards/atom47/keymaps/default/keymap.c create mode 100644 keyboards/atom47/keymaps/default/readme.md create mode 100644 keyboards/atom47/readme.md create mode 100644 keyboards/atom47/rules.mk create mode 100644 keyboards/dz60/keymaps/LEdiodes/config.h create mode 100644 keyboards/dz60/keymaps/LEdiodes/keymap.c create mode 100644 keyboards/dz60/keymaps/LEdiodes/readme.md create mode 100644 keyboards/dz60/keymaps/LEdiodes/rules.mk diff --git a/keyboards/atom47/atom47.c b/keyboards/atom47/atom47.c new file mode 100644 index 00000000..7b839e79 --- /dev/null +++ b/keyboards/atom47/atom47.c @@ -0,0 +1,31 @@ +#include "atom47.h" +#include "led.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + matrix_init_user(); + led_init_ports(); +}; + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + matrix_scan_user(); +}; + +void led_init_ports(void) { + // * Set our LED pins as output + DDRB &= ~(1<<5); +} + +void led_set_kb(uint8_t usb_led) { + if (usb_led & (1<. +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6060 +#define DEVICE_VER 0x0003 +#define MANUFACTURER Vortex +#define PRODUCT Core +#define DESCRIPTION Atom47 PCB for the Vortex Core + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 13 + +// ROWS: Top to bottom, COLS: Left to right + +#define MATRIX_ROW_PINS {B1,B2,B3,B7} +#define MATRIX_COL_PINS {D7,D5,F0,F1,F4,F6,F7,D4,C7,C6,D6,B5,B4} +#define UNUSED_PINS + +#define BACKLIGHT_PIN B6 + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* Backlight configuration + */ +#define BACKLIGHT_LEVELS 4 + +#endif + +#define RGB_DI_PIN D0 // The pin the LED strip is connected to +#define RGBLED_NUM 1 // Number of LEDs in your strip + +#define QMK_ESC_OUTPUT D7 // usually COL +#define QMK_ESC_INPUT B1 // usually ROW +#define QMK_LED B6 \ No newline at end of file diff --git a/keyboards/atom47/keymaps/LEdiodes/atom47.c b/keyboards/atom47/keymaps/LEdiodes/atom47.c new file mode 100644 index 00000000..7b839e79 --- /dev/null +++ b/keyboards/atom47/keymaps/LEdiodes/atom47.c @@ -0,0 +1,31 @@ +#include "atom47.h" +#include "led.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + matrix_init_user(); + led_init_ports(); +}; + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + matrix_scan_user(); +}; + +void led_init_ports(void) { + // * Set our LED pins as output + DDRB &= ~(1<<5); +} + +void led_set_kb(uint8_t usb_led) { + if (usb_led & (1<. +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6060 +#define DEVICE_VER 0x0003 +#define MANUFACTURER Vortex +#define PRODUCT Core +#define DESCRIPTION Atom47 PCB for the Vortex Core + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 13 + +// ROWS: Top to bottom, COLS: Left to right + +#define MATRIX_ROW_PINS {B1,B2,B3,B7} +#define MATRIX_COL_PINS {D7,D5,F0,F1,F4,F6,F7,D4,C7,C6,D6,B5,B4} +#define UNUSED_PINS + +#define BACKLIGHT_PIN B6 + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* Backlight configuration + */ +#define BACKLIGHT_LEVELS 4 + +#endif + +#define RGB_DI_PIN D0 // The pin the LED strip is connected to +#define RGBLED_NUM 1 // Number of LEDs in your strip + +#define QMK_ESC_OUTPUT D7 // usually COL +#define QMK_ESC_INPUT B1 // usually ROW +#define QMK_LED B6 \ No newline at end of file diff --git a/keyboards/atom47/keymaps/LEdiodes/keymap.c b/keyboards/atom47/keymaps/LEdiodes/keymap.c new file mode 100644 index 00000000..3ea8609b --- /dev/null +++ b/keyboards/atom47/keymaps/LEdiodes/keymap.c @@ -0,0 +1,35 @@ +#include QMK_KEYBOARD_H + +// These are all aliases for the function layers. +#define _L0 0 +#define _L1 1 +#define _L2 2 +#define _L3 3 + +#define _______ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[_L0] = KEYMAP_ANSI( + 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_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_RSFT, MO(_L1), \ + KC_LCTL, KC_LGUI, KC_LALT, TG(_L3), KC_SPC, KC_SPC, MO(_L2), KC_RALT, KC_APP, KC_RCTRL), \ + +[_L2] = KEYMAP_ANSI( + _______, KC_VOLD, KC_VOLU, KC_MUTE, RESET, _______, KC_CALC, KC_PGUP, KC_UP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, \ + KC_CAPS, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, KC_HOME, KC_LEFT, KC_DOWN, KC_RIGHT, KC_INS, _______, \ + _______, _______, _______, _______, _______, _______, _______, BL_TOGG, BL_DEC, BL_INC, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), \ + +[_L1] = KEYMAP_ANSI( + 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_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, \ + _______, _______, _______, _______, _______, KC_QUOT, KC_SLSH, KC_LBRC, KC_RBRC, KC_BSLS, KC_RSFT, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), \ + +[_L3] = KEYMAP_ANSI( + _______, _______, _______, KC_7, KC_8, KC_9, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, KC_4, KC_5, KC_6, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, KC_1, KC_2, KC_3, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, KC_0, KC_DOT, _______, _______, _______, RESET), \ +}; diff --git a/keyboards/atom47/keymaps/LEdiodes/rules.mk b/keyboards/atom47/keymaps/LEdiodes/rules.mk new file mode 100644 index 00000000..d446d3a6 --- /dev/null +++ b/keyboards/atom47/keymaps/LEdiodes/rules.mk @@ -0,0 +1,65 @@ +# MCU name +#MCU = at90usb1287 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +RGBLIGHT_ENABLE = no # Enable keyboard underlight functionality (+4870) +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality (+1150) +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID diff --git a/keyboards/atom47/keymaps/default/keymap.c b/keyboards/atom47/keymaps/default/keymap.c new file mode 100644 index 00000000..cd8e622f --- /dev/null +++ b/keyboards/atom47/keymaps/default/keymap.c @@ -0,0 +1,39 @@ +#include QMK_KEYBOARD_H + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. + +#define _MA 0 //Main layer +#define _FN 1 //Fn +#define _FN1 2 //Fn1 +#define _PN 3 //Pn + +#define _______ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[_MA] = KEYMAP_ANSI( + 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_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_RSFT, MO(_FN1), \ + KC_LCTL, KC_LGUI, KC_LALT, MO(_PN), KC_SPC, KC_SPC, MO(_FN), KC_RALT, KC_APP, KC_RCTRL), \ + +[_FN] = KEYMAP_ANSI( + _______, KC_VOLD, KC_VOLU, KC_MUTE, RESET, _______, KC_CALC, KC_PGUP, KC_UP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, \ + KC_CAPS, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, KC_HOME, KC_LEFT, KC_DOWN, KC_RIGHT, KC_INS, _______, \ + _______, _______, _______, _______, _______, _______, _______, BL_TOGG, BL_DEC, BL_INC, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), \ + +[_FN1] = KEYMAP_ANSI( + 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_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, \ + _______, _______, _______, _______, _______, KC_QUOT, KC_SLSH, KC_LBRC, KC_RBRC, KC_BSLS, KC_RSFT, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), \ + +[_PN] = KEYMAP_ANSI( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET), +}; \ No newline at end of file diff --git a/keyboards/atom47/keymaps/default/readme.md b/keyboards/atom47/keymaps/default/readme.md new file mode 100644 index 00000000..02422eb9 --- /dev/null +++ b/keyboards/atom47/keymaps/default/readme.md @@ -0,0 +1,10 @@ +To be updated... + + +// This layer is just a blank template to be copied for easy layer creation. please don not edit it. + + [_LX] = KEYMAP_ANSI( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET), diff --git a/keyboards/atom47/readme.md b/keyboards/atom47/readme.md new file mode 100644 index 00000000..fec7843a --- /dev/null +++ b/keyboards/atom47/readme.md @@ -0,0 +1,28 @@ +# ATOM47 + +![ATOM47](https://i.imgur.com/rjrFTKT.png) + +## Support +Keyboard Maintainer: [Matthew Kerfoot(https://github.com/mkerfoot) +Hardware Supported: ATOM47 +Hardware Availability: [GeekHack.com Group Buy](https://geekhack.org/index.php?topic=93447.msg2545221) + + +## Features +QMK Firmware +6 Underglow RGB leds +In-switch leds +Through-hole micro usb connector (less likely to break off!) +South facing leds for the QMX/Zealencio users +Multiple layouts +Easily reachable reset button under the spacebar +CapsLock indicator + +## Build +To build the default keymap, simply run `make atom47:default`. + +For an alternative, heavily modified layout you would just need to run `make atom47:LEdiodes`. + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. + +![ATOM47](https://i.imgur.com/WebeUOF.png) diff --git a/keyboards/atom47/rules.mk b/keyboards/atom47/rules.mk new file mode 100644 index 00000000..d446d3a6 --- /dev/null +++ b/keyboards/atom47/rules.mk @@ -0,0 +1,65 @@ +# MCU name +#MCU = at90usb1287 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +RGBLIGHT_ENABLE = no # Enable keyboard underlight functionality (+4870) +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality (+1150) +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID diff --git a/keyboards/dz60/keymaps/LEdiodes/config.h b/keyboards/dz60/keymaps/LEdiodes/config.h new file mode 100644 index 00000000..bb78d9bb --- /dev/null +++ b/keyboards/dz60/keymaps/LEdiodes/config.h @@ -0,0 +1,58 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#include "config.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x2260 +#define DEVICE_VER 0x0001 +#define MANUFACTURER KBDFans +#define PRODUCT DZ60 +#define DESCRIPTION DZ60 Keyboard + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 15 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { D0, D1, D2, D3, D5 } +#define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B7, D4, B1, B0, B5, B4, D7, D6, B3, F4 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* number of backlight levels */ +#define BACKLIGHT_PIN B6 +#define BACKLIGHT_LEVELS 5 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE + +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* prevent stuck modifiers */ +#define PREVENT_STUCK_MODIFIERS + +#define RGB_DI_PIN E2 +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 16 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +/* sets 'Auto Shift' timeouts */ +#define AUTO_SHIFT_TIMEOUT 150 +#define NO_AUTO_SHIFT_SPECIAL + +#endif diff --git a/keyboards/dz60/keymaps/LEdiodes/keymap.c b/keyboards/dz60/keymaps/LEdiodes/keymap.c new file mode 100644 index 00000000..46bdb5fe --- /dev/null +++ b/keyboards/dz60/keymaps/LEdiodes/keymap.c @@ -0,0 +1,141 @@ +#include "xd60.h" +#include "action_layer.h" + +#Define _L0 0 +#Define _L1 1 +#Define _L2 2 +#Define _L3 3 +#Define _L4 4 + +#define _______ KC_TRNS + +/* + * template + * [_L1] = KEYMAP( + * _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \ + * _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \ + * _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \ + * _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \ + * _______,_______,_______, _______,_______,_______, _______,_______,_______,_______,_______, + * + * + *\ + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap _L0: (Layer 0 - Base Layer) This is the default layer + * This layer has a key set to MO(_L1) which means when held down Layer 1 will become active, If Layer 1 does not have anything set for tat key is will revert to uing the key set at layer 0. + * LT(_L1, KC_1) means that when the "1" key is long touched then it will activate the layer _L1 key(F1) but if the key is just tapped it will activate the "1" key. + * KC_GESC = Escape when tapped, ` when pressed with Shift or GUI + * KC_LSPO = Left Shift when held, ( when tapped + * TD(LT(_L3,KC_SPACE)) = This is a test... hoping it will tap dance if double tapped it does enter if single tap it does space if long hold down it does _L3(Layer 3). + * LT(_L3,KC_SPACE) = if tapped it does space, is long touch it does _L3(Layer 3) + * BL_TOGG = Toggles the LEDs. + * ,-----------------------------------------------------------------------------------------. + * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Bkspc| Del | + * |-----------------------------------------------------------------------------------------+ + * | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | + * |-----------------------------------------------------------------------------------------+ + * | _L4 | A | S | D | F | G | H | J | K | L | ; | ' | Enter | + * |-----------------------------------------------------------------------------------------+ + * | Shift | Z | X | C | V | B | N | M | , | . | / | RSh | U | _L1 | + * |-----------------------------------------------------------------------------------------+ + * | Ctrl | Win | Alt | _L3[Space] |LEdiodes| Space |Win | _L2| L | D | R | + * `-----------------------------------------------------------------------------------------' + */ +[_L0] = KEYMAP( + KC_GESC, LT(_L1, KC_1),LT(_L1, KC_2),LT(_L1, KC_3),LT(_L1, KC_4),LT(_L1, KC_5),LT(_L1, KC_6),LT(_L1, KC_7),LT(_L1, KC_8),LT(_L1, KC_9),LT(_L1, KC_0),LT(_L1, KC_MINS),LT(_L1, KC_EQL),KC_BSPC, 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_LBRC, KC_RBRC, KC_BSLS, \ + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_ENT, \ + KC_LSPO, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPO, KC_UP, M0(_L1), \ + KC_LCTL, KC_LGUI, KC_LALT, TD(LT(_L3,KC_SPACE)),BL_TOGG,TD(TD_SPC_ENT), KC_RGUI, M0(_L2), KC_LEFT, KC_DOWN, KC_RIGHT), + +/* Keymap _L1: (Layer 1) This is function layer 1 + * This layer is activated while the Fn key is being held down. + * ,-----------------------------------------------------------------------------------------. + * | Reset | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | F13| F14| + * |-----------------------------------------------------------------------------------------+ + * | | WhUp| U | WhDn | | | | | | PrtScr | | | | | + * |-----------------------------------------------------------------------------------------+ + * | | L | D | R | | | Home | | | | | | | + * |-----------------------------------------------------------------------------------------+ + * | | | | | | | End | VolDn|VolUp|Mute | | | PgUp| | + * |-----------------------------------------------------------------------------------------+ + * | | | | | | | | | Home| PgDn| End | + * `-----------------------------------------------------------------------------------------' + */ +[_L1] = KEYMAP( + RESET, 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_F13, KC_F14, \ + _______, KC_WH_U, KC_UP, KC_WH_D, _______, _______,_______, _______, _______, _______, KC_PSCR, _______, _______, _______, \ + _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, KC_HOME, _______, _______, _______, KC_HOME, _______, _______, _______, \ + _______, _______, _______, KC_APP, BL_STEP,_______, KC_END, KC_VOLD, KC_VOLU, KC_MUTE, _______, _______, _______, KC_PGUP, _______, \ + _______, _______, _______, _______,_______,_______, _______, _______, KC_HOME, KC_PGDOWN, KC_END), + +/* Keymap _L2: (Layer 2) This is function layer 2 + * This layer is activated while the Fn2 key is being held down. + * LCA(KC_TAB) = Hold Left Control and Alt and press kc_tab which cycles trough open apps. + * MEH(KC_TAB) = Hold Left Control, Shift and Alt and press kc_TAB to cycle backwards through apps. + * ,-----------------------------------------------------------------------------------------. + * | | | | | | | | | | | | | | | LCA(KC_TAB)| + * |-----------------------------------------------------------------------------------------+ + * | | | | | | | | | | | | | | |MEH(KC_TAB) + * |-----------------------------------------------------------------------------------------+ + * | | | | | | | | | | | | | | + * |-----------------------------------------------------------------------------------------+ + * | | | | | | | | || | | | | | + * |-----------------------------------------------------------------------------------------+ + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------------' + */ +[_L2] = KEYMAP( + _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,LCA(KC_TAB), \ + _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, MEH(KC_TAB), \ + _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \ + _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,KC_MS_BTN1,KC_MS_UP,KC_MS_BTN2, \ + _______,_______,_______, _______,_______,_______, _______,_______,KC_MS_LEFT,KC_MS_DOWN,KC_MS_RIGHT, + +}; + +// Custom Actions +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_MOMENTARY(1), // to Fn overlay +}; + +// Macros +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); } + else { unregister_code(KC_RSFT); } + break; + } + + return MACRO_NONE; +}; + +// Loop +void matrix_scan_user(void) { + // Empty +}; + +//Tap Dance Declarations +enum { + TD_SPC_ENT = 0, + TD_KC_LSFT_CAPS = 0, + TD_KC_RSFT_CAPS = 0 +}; + +//Tap Dance Definitions +qk_tap_dance_action_t tap_dance_actions[] = { + + //Tap once for space, tap twice for enter + [TD_SPC_ENT] = ACTION_TAP_DANCE_DOUBLE(KC_SPC, KC_ENT), + //Tap once for Left Shift, twice for Caps Lock + [TD_KC_LSFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS), + //Tap once for Right Shift, twice for Caps Lock + [TD_KC_RSFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_RSFT, KC_CAPS) + +// Other declarations would go here, separated by commas, if you have them + +}; diff --git a/keyboards/dz60/keymaps/LEdiodes/readme.md b/keyboards/dz60/keymaps/LEdiodes/readme.md new file mode 100644 index 00000000..db83b249 --- /dev/null +++ b/keyboards/dz60/keymaps/LEdiodes/readme.md @@ -0,0 +1,9 @@ +# LEdiodes Keymap for XD60 60% PCB + +![LEdiodes Layer 0 Keymap for XD60](https://i.imgur.com/pDneawX.jpg) + +## Additional Notes +Layer 0(default) Keymap for LEdiodes XD60. + +## Build +To build the default keymap, simply run `make xd60:LEdiodes`. diff --git a/keyboards/dz60/keymaps/LEdiodes/rules.mk b/keyboards/dz60/keymaps/LEdiodes/rules.mk new file mode 100644 index 00000000..f54d9500 --- /dev/null +++ b/keyboards/dz60/keymaps/LEdiodes/rules.mk @@ -0,0 +1,57 @@ +# MCU name +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +AUDIO_ENABLE = no +RGBLIGHT_ENABLE = yes +AUTO_SHIFT_ENABLE = yes # If the time depressed is greater than or equal to the AUTO_SHIFT_TIMEOUT, then a shifted version of the key is emitted. If the time is less than the AUTO_SHIFT_TIMEOUT time, then the normal state is emitted \ No newline at end of file From 91c133f4e0e9ae232503a28768c35f054eeb771f Mon Sep 17 00:00:00 2001 From: Michael Kaylan <1063516+kaylanm@users.noreply.github.com> Date: Thu, 1 Feb 2018 16:12:23 -0600 Subject: [PATCH 028/173] Add missing parenthesis back to backlight_tick --- quantum/quantum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quantum/quantum.c b/quantum/quantum.c index 65fa2596..f5246d9b 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -904,7 +904,7 @@ void backlight_task(void) { _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF); #endif } - backlight_tick = backlight_tick + 1 % 16; + backlight_tick = (backlight_tick + 1) % 16; } #endif From ee0a2b7dab2ecf1b1ca34db8ccdd378256f6a876 Mon Sep 17 00:00:00 2001 From: Mitchell van Manen Date: Thu, 1 Feb 2018 22:10:25 +0100 Subject: [PATCH 029/173] Imperial Match (Darth Vader's Theme) added crappy recording: https://clyp.it/0lufqils --- quantum/audio/song_list.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h index 4018f817..d52f45d1 100644 --- a/quantum/audio/song_list.h +++ b/quantum/audio/song_list.h @@ -53,6 +53,12 @@ E__NOTE(_CS4), E__NOTE(_B4), QD_NOTE(_AS4), \ E__NOTE(_AS4), E__NOTE(_AS4), QD_NOTE(_B4), +#define IMPERIAL_MARCH \ + HD_NOTE(_A4), HD_NOTE(_A4), HD_NOTE(_A4), QD_NOTE(_F4), QD_NOTE(_C5), \ + HD_NOTE(_A4), QD_NOTE(_F4), QD_NOTE(_C5), WD_NOTE(_A4), \ + HD_NOTE(_E5), HD_NOTE(_E5), HD_NOTE(_E5), QD_NOTE(_F5), QD_NOTE(_C5), \ + HD_NOTE(_A4), QD_NOTE(_F4), QD_NOTE(_C5), WD_NOTE(_A4) + #define CLUEBOARD_SOUND \ HD_NOTE(_C3), HD_NOTE(_D3), HD_NOTE(_E3), HD_NOTE(_F3), HD_NOTE(_G3), HD_NOTE(_A4), HD_NOTE(_B4), HD_NOTE(_C4) /* From cee0a333964626bd93b6c6df48278eb3d18d3e9f Mon Sep 17 00:00:00 2001 From: Null <35205049+NuIIUC@users.noreply.github.com> Date: Thu, 1 Feb 2018 22:07:47 -0600 Subject: [PATCH 030/173] added my layout (#2326) * added my layout basically just default with proper arrow-keys * fixed arrow keys now works properly --- .../dz60/keymaps/Ansi_plus_fn_arrows/keymap.c | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 keyboards/dz60/keymaps/Ansi_plus_fn_arrows/keymap.c diff --git a/keyboards/dz60/keymaps/Ansi_plus_fn_arrows/keymap.c b/keyboards/dz60/keymaps/Ansi_plus_fn_arrows/keymap.c new file mode 100644 index 00000000..c00d5500 --- /dev/null +++ b/keyboards/dz60/keymaps/Ansi_plus_fn_arrows/keymap.c @@ -0,0 +1,61 @@ +#include "dz60.h" + +#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + KEYMAP( + F(0), 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_NO, KC_BSPC, + KC_TAB, 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, + KC_CAPS, 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_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, MO(1), KC_RALT, KC_RALT, KC_LGUI, KC_RCTL), + + KEYMAP( + 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_TRNS, KC_DEL, + KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, + 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, BL_DEC, BL_TOGG, BL_INC, BL_STEP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_LEFT, KC_DOWN, KC_RIGHT), + + KEYMAP( + KC_TRNS, M(1), M(2), M(3), M(4), M(5), M(6), M(7), M(8), M(9), M(10), M(11), M(12), 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, 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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), +}; + +enum function_id { + SHIFT_ESC, +}; + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_FUNCTION(SHIFT_ESC), +}; + +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { + static uint8_t shift_esc_shift_mask; + switch (id) { + case SHIFT_ESC: + shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK; + if (record->event.pressed) { + if (shift_esc_shift_mask) { + add_key(KC_GRV); + send_keyboard_report(); + } else { + add_key(KC_ESC); + send_keyboard_report(); + } + } else { + if (shift_esc_shift_mask) { + del_key(KC_GRV); + send_keyboard_report(); + } else { + del_key(KC_ESC); + send_keyboard_report(); + } + } + break; + } +} \ No newline at end of file From 7636fdbbd087d7c799829c1ce6112d0a90a7bc9d Mon Sep 17 00:00:00 2001 From: Oryhara Date: Thu, 1 Feb 2018 22:08:18 -0600 Subject: [PATCH 031/173] Halfkey function for every layer (#2327) * started work on halfkeyboard * update to keymap * halfkey layouts complete for dvorak and qwerty * added plover layout to halfkeyboard mapping * fixed error in dvorak layout right hand * fixed error in dvorak layout right hand, comments updated * thing * added minus and equals to normal layouts * added minus and equals to normal layouts * adde visualizer matching halfkeyboard mappings * adde visualizer matching halfkeyboard mappings * updated keymaps for mirror handedness functionality for all layers. Also added visualizer code for distinct color for each layer, and LCD text displaying the current layer. * had a KC_TILD where should have had KC_GRAV * its spelled KC_GRAVE --- .../keymaps/halfkeyboard/keymap.c | 337 +++++++++++------- .../keymaps/halfkeyboard/visualizer.c | 72 ++++ 2 files changed, 286 insertions(+), 123 deletions(-) create mode 100644 keyboards/ergodox_infinity/keymaps/halfkeyboard/visualizer.c diff --git a/keyboards/ergodox_infinity/keymaps/halfkeyboard/keymap.c b/keyboards/ergodox_infinity/keymaps/halfkeyboard/keymap.c index 0bf0a86a..b1c3f7be 100644 --- a/keyboards/ergodox_infinity/keymaps/halfkeyboard/keymap.c +++ b/keyboards/ergodox_infinity/keymaps/halfkeyboard/keymap.c @@ -8,7 +8,10 @@ #define DVORAK 2 // dvorak layer #define HALFDVORAK 3 // mirrored dvorak layer #define SYMB 5 // symbols -#define MDIA 6 // media keys +#define HALFSYMB 6 // media keys +#define PLVR 7 // steno plover layout +#define SHORTCUTS 8 //layer with shortcut keys + enum custom_keycodes { PLACEHOLDER = SAFE_RANGE, // can always be here @@ -21,258 +24,346 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap 0: qwerty * * ,--------------------------------------------------. ,--------------------------------------------------. - * | ESC | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | BSPC | + * | ESC | 1 | 2 | 3 | 4 | 5 | ` | | \ | 6 | 7 | 8 | 9 | 0 | BSPC | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | TAB | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ | + * | TAB | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | ' | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| * | BkSp | A | S | D | F | G |------| |------| H | J | K | L | ; |ENTER | - * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------| + * |--------+------+------+------+------+------| - | | = |------+------+------+------+------+--------| * | LShift | Z | X | C | V | B | | | | N | M | , | . | / | RShift | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * |LCTRL|ALT |CTL-TAB|CTLShTab| LGui| | RGui| UP | DOWN | ALT | RCTRL | + * |LCTRL|ALT |CTLShTab|CTL-TAB| LGui| | RGui| UP | DOWN | ALT | RCTRL | * `----------------------------------' `----------------------------------' * ,-------------. ,-------------. - * | Alt | LGui | | RGui |Alt | + * |Symbol|Dvorak| |Plover|HalfSymb| * ,------|------|------| |------+--------+------. * | | | Home | | PgUp | | | - * | Space|Backsp|------| |------| Tab |Enter | - * |mirror|ace | End | | PgDn | |mirror| + * | Space|DELETE|------| |------| Tab |Enter | + * |mirror| | End | | PgDn | |mirror| * `--------------------' `----------------------' */ // If it accepts an argument (i.e, is a function), it doesn't need KC_. // Otherwise, it needs KC_* [QWERTY] = LAYOUT_ergodox( // layer 0 : default // left hand - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB), + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRAVE, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, BL_ON, - KC_LCTRL, KC_LALT, LCTL(KC_TAB), LCTL(LSFT(KC_TAB)), KC_LGUI, - KC_LALT, TG(DVORAK), + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_MINUS, + KC_LCTRL, KC_LALT, LCTL(LSFT(KC_TAB)),LCTL(KC_TAB), MO(SHORTCUTS), + TG(SYMB), TG(DVORAK), KC_HOME, - LT(HALFQWERTY, KC_SPACE),KC_BSPC,KC_END, + LT(HALFQWERTY, KC_SPACE),KC_DEL,KC_END, // right hand - KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, - TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_BSLS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_SLASH, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, - MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, KC_SLASH, KC_RSFT, + KC_EQL,KC_N, KC_M, KC_COMM,KC_DOT, KC_SLASH, KC_RSFT, KC_RGUI, KC_UP,KC_DOWN,KC_RALT, KC_RCTRL, - TG(DVORAK), KC_RALT, + TG(PLVR), TG(HALFSYMB), KC_PGUP, KC_PGDN,KC_TAB, LT(HALFQWERTY, KC_ENT) ), /* Keymap 1: mirrored qwerty * * ,--------------------------------------------------. ,--------------------------------------------------. - * | BSPC | 0 | 9 | 8 | 7 | 6 | LEFT | | RIGHT| 5 | 4 | 3 | 2 | 1 | ESC | + * | BSPC | 0 | 9 | 8 | 7 | 6 | \ | | ` | 5 | 4 | 3 | 2 | 1 | ESC | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | \ | P | O | I | U | Y | L1 | | L1 | T | R | E | W | Q | TAB | + * | ' | P | O | I | U | Y | ] | | [ | T | R | E | W | Q | TAB | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| * | ENTER | ; | L | K | J | H |------| |------| G | F | D | S | A | BSPC | - * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------| + * |--------+------+------+------+------+------| - | | = |------+------+------+------+------+--------| * | LShift | / | . | , | M | N | | | | B | V | C | X | Z | RShift | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * |LCTRL|ALT |CTL-TAB|CTLShTab| LGui| | RGui| UP | DOWN | ALT | RCTRL | + * |LCTRL|ALT |CTLShTab|CTL-TAB| LGui| | RGui| UP | DOWN | ALT | RCTRL | * `----------------------------------' `----------------------------------' * ,-------------. ,-------------. - * | Alt | LGui | | RGui |Alt | + * | | | | | | * ,------|------|------| |------+--------+------. * | | | Home | | PgUp | | | - * | Space|Backsp|------| |------| Tab |Enter | - * |mirror|ace | End | | PgDn | |mirror| + * | Space|DELETE|------| |------| Tab |Enter | + * |mirror| | End | | PgDn | |mirror| * `--------------------' `----------------------' */ // If it accepts an argument (i.e, is a function), it doesn't need KC_. // Otherwise, it needs KC_* [HALFQWERTY] = LAYOUT_ergodox( // layer 0 : default // left hand - KC_BSPC, KC_0, KC_9, KC_8, KC_7, KC_6, KC_LEFT, - KC_TAB, KC_P, KC_O, KC_I, KC_U, KC_Y, TG(SYMB), - KC_BSPC, KC_SCLN, KC_L, KC_K, KC_J, KC_H, - KC_LSFT, KC_SLASH, KC_DOT, KC_COMM,KC_M, KC_N, KC_TRANSPARENT, - KC_LCTRL, KC_LALT, LCTL(KC_TAB), LCTL(LSFT(KC_TAB)), KC_LGUI, - KC_LALT, KC_TRANSPARENT, + KC_BSPC, KC_0, KC_9, KC_8, KC_7, KC_6, KC_BSLS, + KC_BSLS, KC_P, KC_O, KC_I, KC_U, KC_Y, KC_RBRC, + KC_ENT, KC_SCLN, KC_L, KC_K, KC_J, KC_H, + KC_LSFT, KC_SLASH, KC_DOT, KC_COMM,KC_M, KC_N, KC_EQL, + KC_LCTRL, KC_LALT, LCTL(LSFT(KC_TAB)),LCTL(KC_TAB), KC_TRNS, + KC_TRNS, KC_TRANSPARENT, KC_HOME, - KC_TRANSPARENT,KC_BSPC,KC_END, + KC_TRANSPARENT,KC_DEL,KC_END, // right hand - KC_RGHT, KC_5, KC_4, KC_3, KC_2, KC_1, KC_BSPC, - TG(SYMB), KC_T, KC_R, KC_E, KC_W, KC_Q, KC_BSLS, + KC_GRAVE, KC_5, KC_4, KC_3, KC_2, KC_1, KC_BSPC, + KC_LBRC, KC_T, KC_R, KC_E, KC_W, KC_Q, KC_BSLS, KC_G, KC_F, KC_D, KC_S, KC_A, KC_ENT, - MEH_T(KC_NO),KC_B, KC_V, KC_C, KC_X, KC_Z, KC_RSFT, + KC_MINUS,KC_B, KC_V, KC_C, KC_X, KC_Z, KC_RSFT, KC_RGUI, KC_UP,KC_DOWN,KC_RALT, KC_RCTRL, - KC_TRANSPARENT, KC_RALT, + KC_TRANSPARENT, KC_TRNS, KC_PGUP, KC_PGDN,KC_TAB, KC_TRANSPARENT ), /* Keymap 3: dvorak * * ,--------------------------------------------------. ,--------------------------------------------------. - * | ESC | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | BSPC | + * | ESC | 1 | 2 | 3 | 4 | 5 | ` | | \ | 6 | 7 | 8 | 9 | 0 | BSPC | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | TAB | ' | , | . | P | Y | L1 | | L1 | F | G | C | R | L | / | + * | TAB | ' | , | . | P | Y | [ | | ] | F | G | C | R | L | / | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | BkSp | A | O | E | U | I |------| |------| D | H | T | S | - |ENTER | - * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------| + * | BkSp | A | O | E | U | I |------| |------| D | H | T | N | S |ENTER | + * |--------+------+------+------+------+------| - | | = |------+------+------+------+------+--------| * | LShift | ; | Q | J | K | X | | | | B | M | W | V | Z | RShift | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * |LCTRL|ALT |CTL-TAB|CTLShTab| LGui| | RGui| UP | DOWN | ALT | RCTRL | + * |LCTRL|ALT |CTLShTab|CTL-TAB| LGui| | RGui| UP | DOWN | ALT | RCTRL | * `----------------------------------' `----------------------------------' * ,-------------. ,-------------. - * | Alt | LGui | | RGui |Alt | + * | Alt | | | |Alt | * ,------|------|------| |------+--------+------. * | | | Home | | PgUp | | | - * | Space|Backsp|------| |------| Tab |Enter | - * |mirror|ace | End | | PgDn | |mirror| + * | Space|DELETE|------| |------| Tab |Enter | + * |mirror| | End | | PgDn | |mirror| * `--------------------' `----------------------' */ // If it accepts an argument (i.e, is a function), it doesn't need KC_. // Otherwise, it needs KC_* [DVORAK] = LAYOUT_ergodox( // layer 0 : default // left hand - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT, - KC_TAB, KC_QUOTE, KC_COMM,KC_DOT, KC_P, KC_Y, TG(SYMB), + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRAVE, + KC_TAB, KC_QUOTE, KC_COMM,KC_DOT, KC_P, KC_Y, KC_LBRC, KC_BSPC, KC_A, KC_O, KC_E, KC_U, KC_I, - KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, ALL_T(KC_NO), - KC_LCTRL, KC_LALT, LCTL(KC_TAB), LCTL(LSFT(KC_TAB)), KC_LGUI, - KC_LALT, KC_TRANSPARENT, + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_MINUS, + KC_LCTRL, KC_LALT, LCTL(LSFT(KC_TAB)),LCTL(KC_TAB), KC_TRNS, + TG(SYMB), KC_TRANSPARENT, KC_HOME, - LT(HALFDVORAK, KC_SPACE),KC_BSPC,KC_END, + LT(HALFDVORAK, KC_SPACE),KC_DEL,KC_END, // right hand - KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, - TG(SYMB), KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSLS, - KC_D, KC_H, KC_T, KC_S, KC_MINUS, KC_ENT, - MEH_T(KC_NO),KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, + KC_BSLS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_RBRC, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLASH, + KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENT, + KC_EQL,KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, KC_RGUI, KC_UP,KC_DOWN,KC_RALT, KC_RCTRL, - KC_TRANSPARENT, KC_RALT, + KC_TRANSPARENT, TG(HALFSYMB), KC_PGUP, KC_PGDN,KC_TAB, LT(HALFDVORAK, KC_ENT) ), /* Keymap 3: mirrored dvorak * * ,--------------------------------------------------. ,--------------------------------------------------. - * | BSPC | 0 | 9 | 8 | 7 | 6 | LEFT | | RIGHT| 5 | 4 | 3 | 2 | 1 | ESC | + * | BSPC | 0 | 9 | 8 | 7 | 6 | \ | | ` | 5 | 4 | 3 | 2 | 1 | ESC | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | TAB | L | R | C | G | F | L1 | | L1 | Y | P | . | , | ' | / | + * | / | L | R | C | G | F | L1 | | L1 | Y | P | . | , | ' | TAB | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | BkSp | - | S | T | H | D |------| |------| I | U | E | O | A |ENTER | - * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------| + * | ENTER | S | N | T | H | D |------| |------| I | U | E | O | A |BSPC | + * |--------+------+------+------+------+------| = | | - |------+------+------+------+------+--------| * | LShift | Z | V | W | M | B | | | | X | K | J | Q | ; | RShift | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * |LCTRL|ALT |CTL-TAB|CTLShTab| LGui| | RGui| UP | DOWN | ALT | RCTRL | + * |LCTRL|ALT |CTLShTab|CTL-TAB| LGui| | RGui| UP | DOWN | ALT | RCTRL | * `----------------------------------' `----------------------------------' * ,-------------. ,-------------. - * | Alt | LGui | | RGui |Alt | + * | Alt | | | |Alt | * ,------|------|------| |------+--------+------. * | | | Home | | PgUp | | | - * | Space|Backsp|------| |------| Tab |Enter | - * |mirror|ace | End | | PgDn | |mirror| + * | Space|DELETE|------| |------| Tab |Enter | + * |mirror| | End | | PgDn | |mirror| * `--------------------' `----------------------' */ // If it accepts an argument (i.e, is a function), it doesn't need KC_. // Otherwise, it needs KC_* [HALFDVORAK] = LAYOUT_ergodox( // layer 0 : default // left hand - KC_BSPC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT, - KC_SLASH, KC_L, KC_R, KC_C, KC_G, KC_F, TG(SYMB), + KC_BSPC, KC_0, KC_9, KC_8, KC_7, KC_6, KC_BSLS, + KC_SLASH, KC_L, KC_R, KC_C, KC_G, KC_F, KC_RBRC, KC_ENT, KC_S, KC_N, KC_T, KC_H, KC_D, - KC_LSFT, KC_Z, KC_V, KC_W, KC_M, KC_B, ALL_T(KC_NO), - KC_LCTRL, KC_LALT, LCTL(KC_TAB), LCTL(LSFT(KC_TAB)), KC_LGUI, - KC_LALT, KC_TRANSPARENT, + KC_LSFT, KC_Z, KC_V, KC_W, KC_M, KC_B, KC_EQL, + KC_LCTRL, KC_LALT, LCTL(LSFT(KC_TAB)),LCTL(KC_TAB), KC_TRNS, + KC_TRANSPARENT, KC_TRANSPARENT, KC_HOME, - KC_TRANSPARENT,KC_BSPC,KC_END, + KC_TRANSPARENT,KC_DEL,KC_END, // right hand - KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_ESC, - TG(SYMB), KC_Y, KC_P, KC_DOT, KC_COMM,KC_P, KC_TAB, - KC_I, KC_U, KC_E, KC_O, KC_A, KC_ENT, - MEH_T(KC_NO),KC_X, KC_K, KC_J, KC_Q, KC_SCLN, KC_RSFT, + KC_GRAVE, KC_5, KC_4, KC_3, KC_2, KC_5, KC_ESC, + KC_LBRC, KC_Y, KC_P, KC_DOT, KC_COMM,KC_P, KC_TAB, + KC_I, KC_U, KC_E, KC_O, KC_A, KC_BSPC, + KC_MINUS,KC_X, KC_K, KC_J, KC_Q, KC_SCLN, KC_RSFT, KC_RGUI, KC_UP,KC_DOWN,KC_RALT, KC_RCTRL, - KC_TRANSPARENT, KC_RALT, + KC_TRANSPARENT, KC_TRNS, KC_PGUP, KC_PGDN,KC_TAB, KC_TRANSPARENT ), /* Keymap 5: Symbol Layer * * ,---------------------------------------------------. ,--------------------------------------------------. - * |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | + * |Version | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 |BkSp | * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| - * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 | + * | | / | \ | { | } | | | | | | Up | 7 | 8 | 9 | * | / | * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | | + * | | ' | ; | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | - | ENTER | * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | | + * | | - | = | [ | ] | ~ | | | | & | 1 | 2 | 3 | + | | * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' * | EPRM | | | | | | | . | 0 | = | | * `-----------------------------------' `----------------------------------' * ,-------------. ,-------------. - * |Animat| | |Toggle|Solid | + * | | | | | | * ,------|------|------| |------+------+------. - * |Bright|Bright| | | |Hue- |Hue+ | - * |ness- |ness+ |------| |------| | | * | | | | | | | | + * |mirror| |------| |------| |mirror| + * |space | | | | | |enter | * `--------------------' `--------------------' */ // SYMBOLS [SYMB] = LAYOUT_ergodox( // left hand - VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, - KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS, - KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV, - KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS, - EPRM,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - RGB_MOD,KC_TRNS, - KC_TRNS, - RGB_VAD,RGB_VAI,KC_TRNS, + VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, + KC_NO,KC_SLASH,KC_BSLS, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS, + KC_NO,KC_QUOT,KC_SCLN, KC_LPRN,KC_RPRN,KC_GRV, + KC_NO,KC_MINUS,KC_EQL,KC_LBRC,KC_RBRC,KC_TILD,KC_NO, + EPRM,KC_NO,KC_NO,KC_NO,KC_TRNS, + KC_TRNS,KC_NO, + KC_NO, + LT(HALFSYMB, KC_SPACE),KC_NO,KC_NO, + // right hand + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_BSPC, + KC_NO, KC_UP, KC_KP_7, KC_KP_8, KC_KP_9,KC_KP_ASTERISK, KC_KP_SLASH, + KC_DOWN, KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_MINUS, KC_KP_ENTER, + KC_NO,KC_AMPR,KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_PLUS, KC_NO, + KC_NO,KC_DOT, KC_0, KC_KP_EQUAL, KC_NO, + KC_NO, KC_TRNS, + KC_NO, + KC_NO, KC_NO, LT(HALFSYMB, KC_ENT) +), +/* Keymap 6: Mirrored Symbol Layer + * + * ,---------------------------------------------------. ,--------------------------------------------------. + * |delete | F12 | F11 | F10 | F9 | F8 | F7 | | F6 | F5 | F4 | F3 | F2 | F1 |BkSp | + * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| + * | | | 7 | 8 | 9 | * | / | | | | | { | } | / | \ | | + * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | 4 | 5 | 6 | - |------| |------| ` | ( | ) | ; | ' | | + * |---------+------+------+------+------+------|enter | | |------+------+------+------+------+--------| + * | | | 1 | 2 | 3 | + | | | | ~ | [ | ] | = | - | | + * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | EPRM | | 0 | . | = | | | | | | | + * `-----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// SYMBOLS +[HALFSYMB] = LAYOUT_ergodox( + // left hand + KC_BSPC, KC_F12, KC_F11, KC_F10, KC_F9, KC_F8, KC_F7, + KC_NO,KC_NO,KC_KP_7, KC_KP_8, KC_KP_9,KC_KP_ASTERISK,KC_KP_SLASH, + KC_ENTER,KC_NO,KC_KP_4, KC_KP_5, KC_KP_6,KC_KP_MINUS, + KC_NO,KC_NO,KC_KP_1, KC_KP_2, KC_KP_3,KC_KP_PLUS,KC_KP_ENTER, + EPRM,KC_NO,KC_KP_0,KC_KP_DOT,KC_KP_EQUAL, + KC_TRNS,KC_NO, + KC_NO, + KC_TRANSPARENT,KC_NO,KC_NO, // right hand - KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, - KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12, - KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS, - KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, - KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS, - RGB_TOG, RGB_SLD, - KC_TRNS, - KC_TRNS, RGB_HUD, RGB_HUI + KC_F6, KC_F5, KC_F4, KC_F3, KC_F2, KC_F1, KC_BSPC, + KC_NO,KC_PIPE,KC_LCBR,KC_RCBR, KC_SLASH, KC_BSLS, KC_NO, + KC_GRV,KC_LPRN,KC_RPRN, KC_SCLN, KC_QUOT, KC_NO, + KC_NO, KC_TILD,KC_LBRC,KC_RBRC, KC_EQL, KC_MINUS, KC_NO, + KC_NO,KC_NO, KC_NO, KC_NO, KC_NO, + KC_NO, KC_TRNS, + KC_NO, + KC_NO, KC_NO, KC_TRANSPARENT ), -/* Keymap 6: Media and mouse keys + +/* Keymap 7: Steno for Plover from https://github.com/shayneholmes/tmk_keyboard/commit/11290f8489013018f778627db725160c745e75bd * * ,--------------------------------------------------. ,--------------------------------------------------. * | | | | | | | | | | | | | | | | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | | | | MsUp | | | | | | | | | | | | + * | | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play | + * | | q | w | e | r | t |------| |------| y | u | i | o | p | [ | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | | | | | | | | | | | | Prev | Next | | | + * | | a | s | d | f | g | | | | h | j | k | l | ; | ' | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | | + * | | | | | | | | | | | | * `----------------------------------' `----------------------------------' * ,-------------. ,-------------. * | | | | | | * ,------|------|------| |------+------+------. - * | | | | | | |Brwser| - * | | |------| |------| |Back | + * | | | | | | | | + * | c | v |------| |------| n | m | * | | | | | | | | * `--------------------' `--------------------' */ -// MEDIA AND MOUSE -[MDIA] = LAYOUT_ergodox( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2, - KC_TRNS, KC_TRNS, - KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, - // right hand - 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_MPLY, - KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, - KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, - KC_TRNS, - KC_TRNS, KC_TRNS, KC_WBAK + +[PLVR] = LAYOUT_ergodox( // layout: layer 4: Steno for Plover + // left hand + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_NO, KC_1, KC_2, KC_3, KC_4, KC_5, KC_TRNS, + KC_NO, KC_Q, KC_W, KC_E, KC_R, KC_T, + KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G, KC_NO, + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_FN4, KC_NO, + KC_NO, + KC_C, KC_V, KC_NO, + // right hand + KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, + KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS, + KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, + KC_NO, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_NO, KC_N, KC_M ), +/* Keymap 8: shortcuts + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ESC | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | BSPC | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | TAB | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | BkSp | A | S | D | F | G |------| |------| H | J | K | L | ; |ENTER | + * |--------+------+------+------+------+------| - | | = |------+------+------+------+------+--------| + * | LShift | Z | X | C | V | B | | | | N | M | , | . | / | RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * |LCTRL|ALT |CTLShTab|CTL-TAB| | | RGui| UP | DOWN | ALT | RCTRL | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | Alt |Dvorak| |Plover|Alt | + * ,------|------|------| |------+--------+------. + * | | | Home | | PgUp | | | + * | Space|DELETE|------| |------| Tab |Enter | + * |mirror| | End | | PgDn | |mirror| + * `--------------------' `----------------------' + */ +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* +[SHORTCUTS] = LAYOUT_ergodox( // layer 0 : default + // left hand + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_NO, + KC_TAB, LCTL(KC_Q), LCTL(KC_W),LCTL(KC_E),LCTL(KC_R),LCTL(KC_T), KC_NO, + KC_BSPC, LCTL(KC_A), LCTL(KC_S),LCTL(KC_D),LCTL(KC_F),LCTL(KC_G), + KC_LSFT, LCTL(KC_Z), LCTL(KC_X),LCTL(KC_C),LCTL(KC_V),LCTL(KC_B), KC_MINUS, + KC_LCTRL, KC_LALT, LCTL(LSFT(KC_TAB)),LCTL(KC_TAB), KC_TRANSPARENT, + KC_NO, KC_NO, + + KC_NO, + KC_NO,KC_NO,KC_NO, + // right hand + KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, + KC_EQL,KC_N, KC_M, KC_COMM,KC_DOT, KC_SLASH, KC_RSFT, + KC_RGUI, KC_UP,KC_DOWN,KC_RALT, KC_RCTRL, + KC_NO, KC_NO, + KC_NO, + KC_NO,KC_NO, KC_NO + ), }; const uint16_t PROGMEM fn_actions[] = { diff --git a/keyboards/ergodox_infinity/keymaps/halfkeyboard/visualizer.c b/keyboards/ergodox_infinity/keymaps/halfkeyboard/visualizer.c new file mode 100644 index 00000000..6842635d --- /dev/null +++ b/keyboards/ergodox_infinity/keymaps/halfkeyboard/visualizer.c @@ -0,0 +1,72 @@ +/* +Copyright 2017 Fred Sundvik +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 "simple_visualizer.h" + +#define RED 0 +#define ORANGE 21 +#define YELLOW 42 +#define SPRING_GREEN 64 +#define GREEN 85 +#define TURQUOISE 107 +#define CYAN 127 +#define OCEAN 149 +#define BLUE 170 +#define VIOLET 192 +#define MAGENTA 212 +#define RASPBERRY 234 + +// This function should be implemented by the keymap visualizer +// Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing +// that the simple_visualizer assumes that you are updating +// Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is +// stopped. This can be done by either double buffering it or by using constant strings +static void get_visualizer_layer_and_color(visualizer_state_t* state) { + uint8_t saturation = 255; + /* if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) { + saturation = 255; + } */ + if (state->status.layer & 0x100) { + state->target_lcd_color = LCD_COLOR(MAGENTA, saturation, 0xFF); + state->layer_text = "Shortcuts Layer"; + } + else if (state->status.layer & 0x80) { + state->target_lcd_color = LCD_COLOR(VIOLET, saturation, 0xFF); + state->layer_text = "Plover"; + } + else if (state->status.layer & 0x40) { + state->target_lcd_color = LCD_COLOR(RASPBERRY, saturation, 0xFF); + state->layer_text = "Mirrored Symbols"; + } + else if (state->status.layer & 0x20) { + state->target_lcd_color = LCD_COLOR(RED, saturation, 0xFF); + state->layer_text = "Symbols"; + } + else if (state->status.layer & 0x8) { + state->target_lcd_color = LCD_COLOR(OCEAN, saturation, 0xFF); + state->layer_text = "Mirrored Dvorak"; + } + else if (state->status.layer & 0x4) { + state->target_lcd_color = LCD_COLOR(BLUE, saturation, 0xFF); + state->layer_text = "Dvorak"; + } + else if (state->status.layer & 0x2) { + state->target_lcd_color = LCD_COLOR(ORANGE, saturation, 0xFF); + state->layer_text = "Mirrored Qwerty"; + } + else { + state->target_lcd_color = LCD_COLOR(YELLOW, saturation, 0xFF); + state->layer_text = "Qwerty"; + } +} \ No newline at end of file From 38ab86e8f2b6731557f28902509a011715ed5d29 Mon Sep 17 00:00:00 2001 From: Koen Klinkers Date: Fri, 2 Feb 2018 05:08:39 +0100 Subject: [PATCH 032/173] updated xd75 layout (#2321) * plank layout * ergodone * x75 * readmes * added rgb controls * bslash * added backlighting based on layer/modifier * changed colors --- keyboards/xd75/keymaps/kloki/keymap.c | 98 +++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 4 deletions(-) diff --git a/keyboards/xd75/keymaps/kloki/keymap.c b/keyboards/xd75/keymaps/kloki/keymap.c index 36d8a429..62023cf7 100644 --- a/keyboards/xd75/keymaps/kloki/keymap.c +++ b/keyboards/xd75/keymaps/kloki/keymap.c @@ -20,14 +20,15 @@ #define _QW 1 #define _NUM 2 #define _SYM 3 +#define _FUN 4 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_WO] = { /* WORKMAN */ - { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LSFT, TG(_NUM),TG(_QW),KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC }, - { KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_GRV, KC_LGUI, KC_QUOT, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_QUOT }, + { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, MO(_FUN),TG(_NUM),TG(_QW),KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC }, + { KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_GRV, KC_LGUI, KC_QUOT, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSLS }, { CTL_T(KC_ESC),KC_A,KC_S, KC_H, KC_T, KC_G, KC_EQL, KC_UP, KC_MINS, KC_Y, KC_N, KC_E, KC_O, KC_I, KC_ENT }, { KC_LSFT, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_LEFT, KC_DOWN, KC_RGHT, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT }, { KC_MEH,KC_LGUI,KC_LALT,KC_LEFT,KC_RGHT,LT(_SYM,KC_SPC),LGUI_T(KC_ENT),KC_SPC,LT(_SYM,KC_TAB),KC_BSPC,KC_DOWN,KC_UP,KC_LBRC,KC_RBRC,MO(_SYM)}, @@ -49,11 +50,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { { _______, _______, _______, _______, _______,_______,_______, KC_0, _______, _______,_______,_______, _______, _______, _______ }, }, [_SYM] = { /* SYM */ - { _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, KC_F11, KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL, }, - { _______, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR,KC_ASTR,_______, _______, _______, KC_LABK,KC_HOME,KC_UP, KC_PGUP, KC_ASTR, _______ }, + { _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL, }, + { _______, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR,KC_ASTR,_______, KC_F11, KC_F12, KC_LABK,KC_HOME,KC_UP, KC_PGUP, KC_ASTR, _______ }, { _______, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN,KC_GRV, _______, _______, _______, KC_RABK,KC_LEFT,KC_DOWN, KC_RIGHT,KC_PLUS, _______ }, { _______, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC,KC_TILD,_______, _______, _______, KC_AMPR,KC_END, KC_DOWN, KC_PGDN, KC_BSLS, _______ }, { _______, _______, _______, _______, _______,_______,_______, _______, _______, _______,_______,_______, _______, _______, _______ }, + }, + [_FUN] = { /* FUN */ + { _______, RGB_RMOD,RGB_MOD, RGB_TOG, _______,_______,_______, _______, _______, _______,_______,_______, _______, _______, RESET }, + { _______, RGB_HUD, RGB_HUI, RGB_MODE_PLAIN, _______,_______,_______, _______, _______, _______,_______,_______, _______, _______, _______ }, + { _______, RGB_SAD, RGB_SAI, _______, _______,_______,_______, _______, _______, _______,_______,_______, _______, _______, _______ }, + { _______, RGB_VAD, RGB_VAI, _______, _______,_______,_______, _______, _______, _______,_______,_______, _______, _______, _______ }, + { _______, _______, _______, _______, _______,_______,_______, _______, _______, _______,_______,_______, _______, _______, _______ }, } }; const uint16_t PROGMEM fn_actions[] = { @@ -77,3 +85,85 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) } return MACRO_NONE; }; + +bool CTRLDOWN = false; +bool WINDOWN = false; +bool SHIFTDOWN = false; +void matrix_scan_user(void) { + + uint8_t layer = biton32(layer_state); + + switch (layer) { + case 0: + rgblight_setrgb(0,240, 255); + break; + case 1: + rgblight_setrgb(0,255, 100); + break; + case 2: + rgblight_setrgb(10,255, 0); + break; + case 3: + rgblight_setrgb(255,0, 85); + break; + case 4: + rgblight_setrgb(240,255, 0); + break; + default: + // none + break; + } + if ( SHIFTDOWN) { + rgblight_setrgb(255,255, 255); + } + if ( CTRLDOWN) { + rgblight_setrgb(240,255, 0); + } + if ( WINDOWN) { + rgblight_setrgb(255,255, 255); + } + + + +}; +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_LGUI: + if (record->event.pressed) { + WINDOWN = true; + } else { + WINDOWN = false; + } + return true; + case LGUI_T(KC_ENT): + if (record->event.pressed) { + WINDOWN = true; + } else { + WINDOWN = false; + } + return true; + case CTL_T(KC_ESC): + if (record->event.pressed) { + CTRLDOWN = true; + } else { + CTRLDOWN = false; + } + return true; + case KC_LSFT: + if (record->event.pressed) { + SHIFTDOWN = true; + } else { + SHIFTDOWN = false; + } + return true; + case KC_RSFT: + if (record->event.pressed) { + SHIFTDOWN = true; + } else { + SHIFTDOWN = false; + } + return true; + default: + return true; // Process all other keycodes normally + } +}; From 9584db055b73937dfba7b9878a8b61af6aa96710 Mon Sep 17 00:00:00 2001 From: Chris Lee Date: Sat, 2 Dec 2017 03:26:49 -0700 Subject: [PATCH 033/173] Add support for key backlighting to bfake If BACKLIGHT_ENABLE is set to `yes` in `rules.mk`, then the user can use the `BL_*` keycodes to adjust the backlight. At the moment, only on/off is supported. --- keyboards/bfake/bfake.c | 23 ++++++++++++++++++++++- keyboards/bfake/config.h | 3 ++- keyboards/bfake/rules.mk | 4 ++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/keyboards/bfake/bfake.c b/keyboards/bfake/bfake.c index 33d0a60c..2160706f 100644 --- a/keyboards/bfake/bfake.c +++ b/keyboards/bfake/bfake.c @@ -16,7 +16,12 @@ along with this program. If not, see . */ #include "bfake.h" +#ifdef BACKLIGHT_ENABLE +#include "backlight.h" +#endif +#ifdef RGBLIGHT_ENABLE #include "rgblight.h" +#endif #include @@ -24,6 +29,7 @@ along with this program. If not, see . #include "i2c.h" #include "quantum.h" +#ifdef RGBLIGHT_ENABLE extern rgblight_config_t rgblight_config; void rgblight_set(void) { @@ -38,8 +44,23 @@ void rgblight_set(void) { i2c_init(); i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); } +#endif __attribute__ ((weak)) void matrix_scan_user(void) { - rgblight_task(); +} + +void backlight_init_ports(void) { + DDRD |= (1<<0 | 1<<1 | 1<<4 | 1<<6); + PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6); +} + +void backlight_set(uint8_t level) { + if (level == 0) { + // Turn out the lights + PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6); + } else { + // Turn on the lights + PORTD |= (1<<0 | 1<<1 | 1<<4 | 1<<6); + } } diff --git a/keyboards/bfake/config.h b/keyboards/bfake/config.h index c0e0face..de8c4b5d 100644 --- a/keyboards/bfake/config.h +++ b/keyboards/bfake/config.h @@ -37,7 +37,8 @@ along with this program. If not, see . #define DIODE_DIRECTION COL2ROW #define DEBOUNCING_DELAY 5 - +#define NO_BACKLIGHT_CLOCK +#define BACKLIGHT_LEVELS 1 #define RGBLIGHT_ANIMATIONS #define NO_UART 1 diff --git a/keyboards/bfake/rules.mk b/keyboards/bfake/rules.mk index 9165de42..6577ea19 100644 --- a/keyboards/bfake/rules.mk +++ b/keyboards/bfake/rules.mk @@ -37,7 +37,7 @@ EXTRAKEY_ENABLE = yes CONSOLE_ENABLE = yes COMMAND_ENABLE = yes BACKLIGHT_ENABLE = no -RGBLIGHT_ENABLE = yes +RGBLIGHT_ENABLE = no RGBLIGHT_CUSTOM_DRIVER = yes OPT_DEFS = -DDEBUG_LEVEL=0 @@ -47,4 +47,4 @@ CUSTOM_MATRIX = yes SRC = matrix.c i2c.c # programming options -PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex \ No newline at end of file +PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex From 4a04c7265e74afc8a83a19942af5e9483aac287d Mon Sep 17 00:00:00 2001 From: Daniel Shields Date: Fri, 8 Dec 2017 14:33:24 +0000 Subject: [PATCH 034/173] Replace custom tap dance keys with mod tap keys in planck/keymaps/dshields --- keyboards/planck/keymaps/dshields/config.h | 21 ++----------- keyboards/planck/keymaps/dshields/keymap.c | 34 ++-------------------- keyboards/planck/keymaps/dshields/rules.mk | 3 +- 3 files changed, 7 insertions(+), 51 deletions(-) diff --git a/keyboards/planck/keymaps/dshields/config.h b/keyboards/planck/keymaps/dshields/config.h index d920d153..438e007d 100644 --- a/keyboards/planck/keymaps/dshields/config.h +++ b/keyboards/planck/keymaps/dshields/config.h @@ -5,6 +5,7 @@ #define _______ KC_TRNS #define XXXXXXX KC_NO +#define PREVENT_STUCK_MODIFIERS #define USB_MAX_POWER_CONSUMPTION 100 #define ONESHOT_TAP_TOGGLE 2 @@ -31,24 +32,8 @@ #define OSM_ALT OSM(MOD_LALT) #define OSM_SFT OSM(MOD_LSFT) -// tap dance keys -#define TD_SCLN TD(TDK_SCLN) -#define TD_COMM TD(TDK_COMM) -#define TD_DOT TD(TDK_DOT) -#define TD_SLSH TD(TDK_SLSH) - -// macros -#define ACTION_TAP_DANCE_FN_KEYCODE(user_fn, kc) { \ - .fn = { NULL, user_fn, NULL }, \ - .user_data = (void *)&((qk_tap_dance_pair_t) { kc, 0 }) \ -} - -#define ACTION_TAP_DANCE_FN_KEYCODE2(user_fn, kc1, kc2) { \ - .fn = { NULL, user_fn, NULL }, \ - .user_data = (void *)&((qk_tap_dance_pair_t) { kc1, kc2 }) \ -} - -#define TAP(keycode) register_code16(keycode); unregister_code16(keycode) +// mod-tap keys +#define MT_SPC SFT_T(KC_SPC) #endif diff --git a/keyboards/planck/keymaps/dshields/keymap.c b/keyboards/planck/keymaps/dshields/keymap.c index a13c261e..a9977791 100644 --- a/keyboards/planck/keymaps/dshields/keymap.c +++ b/keyboards/planck/keymaps/dshields/keymap.c @@ -6,7 +6,6 @@ extern keymap_config_t keymap_config; enum planck_layers { DEF, LWR, RSE, FUN }; enum planck_keycodes { DYNAMIC_MACRO_RANGE = SAFE_RANGE }; -enum tap_dance_keys { TDK_SCLN, TDK_COMM, TDK_DOT, TDK_SLSH }; #include "dynamic_macro.h" @@ -24,9 +23,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [DEF] = { {KC_Q, KC_W, KC_E, KC_R, KC_T, KC_ESC, KC_BSPC, KC_Y, KC_U, KC_I, KC_O, KC_P }, - {KC_A, KC_S, KC_D, KC_F, KC_G, KC_TAB, KC_ENT, KC_H, KC_J, KC_K, KC_L, TD_SCLN}, - {KC_Z, KC_X, KC_C, KC_V, KC_B, OSM_SFT, DM_PLAY, KC_N, KC_M, TD_COMM, TD_DOT, TD_SLSH}, - {OSM_CTL, KC_LGUI, OSM_ALT, OSL_FUN, OSL_LWR, KC_SPC, KC_SPC, OSL_RSE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {KC_A, KC_S, KC_D, KC_F, KC_G, KC_TAB, KC_ENT, KC_H, KC_J, KC_K, KC_L, KC_SCLN}, + {KC_Z, KC_X, KC_C, KC_V, KC_B, OSM_SFT, DM_PLAY, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH}, + {OSM_CTL, KC_LGUI, OSM_ALT, OSL_FUN, OSL_LWR, MT_SPC, MT_SPC, OSL_RSE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, /* Lower * ,-----------------------------------------------------------------------------------. @@ -81,33 +80,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }, }; -void tap_dance_triple(qk_tap_dance_state_t *state, void *user_data) { - qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data; - uint16_t keycode = pair->kc1; - - switch(state->count) { - case 2: - register_code(KC_LSFT); - TAP(keycode); - unregister_code(KC_LSFT); - break; - case 3: // fall through - if (pair->kc2) { - keycode = pair->kc2; - } - TAP(keycode); - default: - TAP(keycode); - } -} - -qk_tap_dance_action_t tap_dance_actions[] = { - [TDK_SCLN] = ACTION_TAP_DANCE_FN_KEYCODE2(tap_dance_triple, KC_SCLN, KC_COLN), - [TDK_COMM] = ACTION_TAP_DANCE_FN_KEYCODE2(tap_dance_triple, KC_COMM, KC_LABK), - [TDK_DOT] = ACTION_TAP_DANCE_FN_KEYCODE (tap_dance_triple, KC_DOT), - [TDK_SLSH] = ACTION_TAP_DANCE_FN_KEYCODE (tap_dance_triple, KC_SLSH) -}; - bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_dynamic_macro(keycode, record)) { return false; diff --git a/keyboards/planck/keymaps/dshields/rules.mk b/keyboards/planck/keymaps/dshields/rules.mk index 57144283..c266b939 100644 --- a/keyboards/planck/keymaps/dshields/rules.mk +++ b/keyboards/planck/keymaps/dshields/rules.mk @@ -4,10 +4,9 @@ endif MOUSEKEY_ENABLE = yes # Mouse keys(+4700) COMMAND_ENABLE = yes # Commands for debug and configuration -CONSOLE_ENABLE = yes # Console for debug(+400) +CONSOLE_ENABLE = no # Console for debug(+400) BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend -TAP_DANCE_ENABLE = yes AUDIO_ENABLE = no API_SYSEX_ENABLE = no From 087fa37b7af7873cec74752bcbca3455a4b66cb5 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Fri, 2 Feb 2018 07:00:09 +0100 Subject: [PATCH 035/173] Added us based keyboard layout with cursor keys and mouse functionality for SATAN GH60 (#2180) * Add chaser keymap * Added missing readme * Add missing mousewheel und mousebutton 3 --- keyboards/satan/keymaps/chaser/keymap.c | 89 ++++++++++++++++++++++++ keyboards/satan/keymaps/chaser/readme.md | 38 ++++++++++ keyboards/satan/keymaps/chaser/rules.mk | 21 ++++++ 3 files changed, 148 insertions(+) create mode 100644 keyboards/satan/keymaps/chaser/keymap.c create mode 100644 keyboards/satan/keymaps/chaser/readme.md create mode 100644 keyboards/satan/keymaps/chaser/rules.mk diff --git a/keyboards/satan/keymaps/chaser/keymap.c b/keyboards/satan/keymaps/chaser/keymap.c new file mode 100644 index 00000000..63028f1c --- /dev/null +++ b/keyboards/satan/keymaps/chaser/keymap.c @@ -0,0 +1,89 @@ +#include "satan.h" + + +// Used for SHIFT_ESC +#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _BL 0 +#define _FL 1 + +#define _______ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap _BL: (Base Layer) Default Layer + * ,-----------------------------------------------------------. + * |Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | + * |-----------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | + * |-----------------------------------------------------------| + * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return | + * |-----------------------------------------------------------| + * |Shift | Z| X| C| V| B| N| M| ,| .| /| Up |FN | + * |-----------------------------------------------------------| + * |Ctrl|Gui |Alt | Space |Alt |Left |Down|Right| + * `-----------------------------------------------------------' + */ +[_BL] = KEYMAP( + F(0) ,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 , _______, \ + KC_TAB ,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 , \ + KC_CAPS ,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_LSHIFT ,_______,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH,KC_UP ,MO(_FL) , \ + KC_LCTL ,KC_LGUI,KC_LALT, KC_SPC ,KC_RALT,KC_LEFT,KC_DOWN,KC_RIGHT), + /* Keymap _FL: Function Layer + * ,-----------------------------------------------------------. + * |GRV|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12| DEL | + * |-----------------------------------------------------------| + * | MB3|MB2|MUP|MB1|MWU| | | |INS| |RST| | |Print| + * |-----------------------------------------------------------| + * | | ML|MDN|MR |MWD| | | | | | | | + * |-----------------------------------------------------------| + * | | | | | | | | | | | |PGUP| | + * |-----------------------------------------------------------| + * | | | | |Ctrl|HOME|PGD |END | + * `-----------------------------------------------------------' + */ +[_FL] = KEYMAP( + 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 ,_______, \ + KC_MS_BTN3 ,KC_MS_BTN2 ,KC_MS_UP ,KC_MS_BTN1 ,KC_MS_WH_UP ,_______,_______,_______,KC_INS ,_______,RESET ,_______,_______ ,KC_PSCREEN , \ + _______ ,KC_MS_LEFT ,KC_MS_DOWN ,KC_MS_RIGHT,KC_MS_WH_DOWN,_______,_______,_______,_______,_______,_______,_______,_______ ,_______ , \ + _______ ,_______ ,_______ ,_______ ,_______ ,_______,_______,_______,_______,_______,_______,_______,KC_PGUP ,_______ , \ + KC_LCTL ,_______ ,KC_LALT , _______, KC_RCTL,KC_HOME,KC_PGDOWN ,KC_END ), +}; + +enum function_id { + SHIFT_ESC, +}; + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_FUNCTION(SHIFT_ESC), +}; + +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { + static uint8_t shift_esc_shift_mask; + switch (id) { + case SHIFT_ESC: + shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK; + if (record->event.pressed) { + if (shift_esc_shift_mask) { + add_key(KC_GRV); + send_keyboard_report(); + } else { + add_key(KC_ESC); + send_keyboard_report(); + } + } else { + if (shift_esc_shift_mask) { + del_key(KC_GRV); + send_keyboard_report(); + } else { + del_key(KC_ESC); + send_keyboard_report(); + } + } + break; + } +} diff --git a/keyboards/satan/keymaps/chaser/readme.md b/keyboards/satan/keymaps/chaser/readme.md new file mode 100644 index 00000000..c6e70b18 --- /dev/null +++ b/keyboards/satan/keymaps/chaser/readme.md @@ -0,0 +1,38 @@ +# [dragonchasers](https://github.com/dragonchaser) Satan GH60 layout + +Layout derived from the default Satan GH60 keymap. + +![Photo of the keyboard](https://pbs.twimg.com/media/DQzlD0yX0AA8spX.jpg) + +## Layers + +### Base +``` +,-----------------------------------------------------------. +|Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | +|-----------------------------------------------------------| +|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | +|-----------------------------------------------------------| +|CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return | +|-----------------------------------------------------------| +|Shift | Z| X| C| V| B| N| M| ,| .| /| Up |FN | +|-----------------------------------------------------------| +|Ctrl|Gui |Alt | Space |Alt |Left |Down|Right| +`-----------------------------------------------------------' +``` + +### Function Layer + +``` +,-----------------------------------------------------------. +|GRV|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12| DEL | +|-----------------------------------------------------------| +| MB3|MB2|MUP|MB1|MWU| | | |INS| |RST| | |Print| +|-----------------------------------------------------------| +| | ML|MDN|MR |MWD| | | | | | | | +|-----------------------------------------------------------| +| | | | | | | | | | | |PGUP| | +|-----------------------------------------------------------| +| | | | |Ctrl|HOME|PGD |END | +`-----------------------------------------------------------' +``` diff --git a/keyboards/satan/keymaps/chaser/rules.mk b/keyboards/satan/keymaps/chaser/rules.mk new file mode 100644 index 00000000..2a7ff277 --- /dev/null +++ b/keyboards/satan/keymaps/chaser/rules.mk @@ -0,0 +1,21 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif From 3cf752f83f1bd8fbdeab18563f9ec39bb1aa205a Mon Sep 17 00:00:00 2001 From: Brosseau Valentin Date: Fri, 2 Feb 2018 07:00:39 +0100 Subject: [PATCH 036/173] =?UTF-8?q?Xd75=20:=20B=C3=A9po=20layout=20for=20t?= =?UTF-8?q?he=20XD75=20(#2166)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add xd75 layout * Add Readme * Update layout * Remove Backlight keys * Move ENTER / BACKSP / DEL * Commit my bepo layout instead of the qwerty version since i will not use it * Use 0 instead of 00 * Fix TODO key * Update the readme * Replace wrong key placment * Update center column * Update the layout with 2-u key * Adjust the fn layer * Adjust the main layer * Adjust the fn layer --- .../xd75/keymaps/c4software_bepo/README.md | 37 ++++++++ .../xd75/keymaps/c4software_bepo/config.h | 24 +++++ .../xd75/keymaps/c4software_bepo/keymap.c | 90 +++++++++++++++++++ .../xd75/keymaps/c4software_bepo/rules.mk | 18 ++++ 4 files changed, 169 insertions(+) create mode 100644 keyboards/xd75/keymaps/c4software_bepo/README.md create mode 100644 keyboards/xd75/keymaps/c4software_bepo/config.h create mode 100644 keyboards/xd75/keymaps/c4software_bepo/keymap.c create mode 100644 keyboards/xd75/keymaps/c4software_bepo/rules.mk diff --git a/keyboards/xd75/keymaps/c4software_bepo/README.md b/keyboards/xd75/keymaps/c4software_bepo/README.md new file mode 100644 index 00000000..7a852962 --- /dev/null +++ b/keyboards/xd75/keymaps/c4software_bepo/README.md @@ -0,0 +1,37 @@ +# c4software Custom Keyboard + +Layout for Bépo Dev + +``` +/* Native BepoDev for compatible computer + * .--------------------------------------------------------------------------------------------------------------------------------------. + * | ESC | " | < | > | ( | ) | % | VOL- | VOL+ | @ | + | - | / | * | = | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| + * | TAB | B | E_ACUT | P | O | $ | E_GRAV | DEL | E_CIRC | V | D | L | J | Z | C_CEDIL| + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------+--------| + * | RALT | A | U | I | E | , | | | C | T | S | R | N | M | W | + * |--------+--------+--------+--------+--------+--------+ BACKSP + ENTER +--------+--------+--------+--------------------------+--------| + * | LSHIFT | A_GRAV | Y | X | . | K | | | ’ | Q | G | H | F | UP | RSHIFT | + * |--------+--------+--------+--------+--------+-----------------+--------+--------+--------+--------+-----------------+--------+--------| + * | LALT | LCTRL | FN | LGUI | SPACE | RALT | SPACE | RGUI | FN | LEFT | DOWN | RIGHT | + * '--------------------------------------------------------------------------------------------------------------------------------------' + */ + ``` + + The FN layer : + + ``` +/* FUNCTION + * .--------------------------------------------------------------------------------------------------------------------------------------. + * | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | P/ | P* | F9 | F10 | F11 | F12 | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | P7 | P8 | P9 | - | RGB_TOG| RGB_MOD| RGB_HUI| + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | PREV | PLAY | NEXT | STOP | | | | P4 | P5 | P6 | + | RGB_SAI| RGB_SAD| RGB_VAI| + * |--------+--------+--------+--------+--------+--------+ + +--------+--------+--------+--------+--------+--------+--------| + * | | VOL- | MUTE | VOL+ | | | | | P1 | P2 | P3 | ENT | RGB_VAD| Home | RGB_HUD| + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | RESET | | FN | | | | P0 | . | FN | | End | | + * '--------------------------------------------------------------------------------------------------------------------------------------' + */ + ``` \ No newline at end of file diff --git a/keyboards/xd75/keymaps/c4software_bepo/config.h b/keyboards/xd75/keymaps/c4software_bepo/config.h new file mode 100644 index 00000000..015377b5 --- /dev/null +++ b/keyboards/xd75/keymaps/c4software_bepo/config.h @@ -0,0 +1,24 @@ +/* Copyright 2017 Benjamin Kesselring + * + * 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 CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +// place overrides here + +#endif diff --git a/keyboards/xd75/keymaps/c4software_bepo/keymap.c b/keyboards/xd75/keymaps/c4software_bepo/keymap.c new file mode 100644 index 00000000..28f032a7 --- /dev/null +++ b/keyboards/xd75/keymaps/c4software_bepo/keymap.c @@ -0,0 +1,90 @@ +/* Copyright 2017 Valentin Brosseau + * + * 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 "xd75.h" +#include "keymap_bepo.h" + +// Layer shorthand +#define _BP 0 +#define _FN 1 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Native BepoDev for compatible computer + * .--------------------------------------------------------------------------------------------------------------------------------------. + * | ESC | " | < | > | ( | ) | % | VOL- | VOL+ | @ | + | - | / | * | = | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| + * | TAB | B | E_ACUT | P | O | $ | E_GRAV | DEL | E_CIRC | V | D | L | J | Z | C_CEDIL| + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------+--------| + * | RALT | A | U | I | E | , | | | C | T | S | R | N | M | W | + * |--------+--------+--------+--------+--------+--------+ BACKSP + ENTER +--------+--------+--------+--------------------------+--------| + * | LSHIFT | A_GRAV | Y | X | . | K | | | ’ | Q | G | H | F | UP | RSHIFT | + * |--------+--------+--------+--------+--------+-----------------+--------+--------+--------+--------+-----------------+--------+--------| + * | LALT | LCTRL | FN | LGUI | SPACE | RALT | SPACE | RGUI | FN | LEFT | DOWN | RIGHT | + * '--------------------------------------------------------------------------------------------------------------------------------------' + */ + + [_BP] = { /* BepoDev */ + { KC_ESC, BP_DQOT, BP_LGIL, BP_RGIL, BP_LPRN, BP_RPRN, BP_PERCENT, KC_VOLD, KC_VOLU, BP_AT, BP_PLUS, BP_MINUS, BP_SLASH, BP_ASTR, BP_EQUAL }, + { KC_TAB, BP_B, BP_E_ACUTE, BP_P, BP_O, BP_DOLLAR, BP_E_GRAVE, KC_DEL, BP_DCRC, BP_V, BP_D, BP_L, BP_J, BP_Z, BP_CCED }, + { KC_RALT, BP_A, BP_U, BP_I, BP_E, BP_COMMA, KC_BSPC, KC_ENT, BP_C, BP_T, BP_S, BP_R, BP_N, BP_M, BP_W }, + { KC_LSFT, BP_A_GRAVE, BP_Y, BP_X, BP_DOT, BP_K, KC_TRNS, KC_TRNS, BP_APOS, BP_Q, BP_G, BP_H, BP_F, KC_UP, KC_RSFT }, + { KC_LALT, KC_LCTL, MO(_FN), KC_LGUI, KC_TRNS, KC_SPC, KC_TRNS, KC_RALT, KC_SPC, KC_TRNS, KC_RGUI, MO(_FN), KC_LEFT, KC_DOWN, KC_RGHT }, + }, + +/* FUNCTION + * .--------------------------------------------------------------------------------------------------------------------------------------. + * | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | P/ | P* | F9 | F10 | F11 | F12 | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | P7 | P8 | P9 | - | RGB_TOG| RGB_MOD| RGB_HUI| + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | PREV | PLAY | NEXT | STOP | | | | P4 | P5 | P6 | + | RGB_SAI| RGB_SAD| RGB_VAI| + * |--------+--------+--------+--------+--------+--------+ + +--------+--------+--------+--------+--------+--------+--------| + * | | VOL- | MUTE | VOL+ | | | | | P1 | P2 | P3 | ENT | RGB_VAD| Home | RGB_HUD| + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | RESET | | FN | | | | P0 | . | FN | | End | | + * '--------------------------------------------------------------------------------------------------------------------------------------' + */ + + [_FN] = { /* FUNCTION */ + { KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_SLSH, KC_ASTR, 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_P7, KC_P8, KC_P9, KC_MINS, RGB_TOG, RGB_MOD, RGB_HUI }, + { KC_TRNS, KC_MPRV, KC_MPLY, KC_MNXT, KC_MSTP, KC_TRNS, KC_TRNS, KC_TRNS, KC_P4, KC_P5, KC_P6, KC_PLUS, RGB_SAI, RGB_SAD, RGB_VAI }, + { KC_TRNS, KC_VOLD, KC_MUTE, KC_VOLU, KC_APP, KC_TRNS, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_ENT, RGB_VAD, KC_HOME, RGB_HUD }, + { RESET, KC_TRNS, MO(_FN), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_KP_0, KC_TRNS, KC_PDOT, MO(_FN), KC_TRNS, KC_END, KC_TRNS }, + } +}; + +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: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; diff --git a/keyboards/xd75/keymaps/c4software_bepo/rules.mk b/keyboards/xd75/keymaps/c4software_bepo/rules.mk new file mode 100644 index 00000000..d4e08cfb --- /dev/null +++ b/keyboards/xd75/keymaps/c4software_bepo/rules.mk @@ -0,0 +1,18 @@ +# Copyright 2013 Jun Wako +# +# 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 QUANTUM_DIR + include ../../../../Makefile +endif From 9f0aac22e9d9b22ebc95e44a77734104ee27d755 Mon Sep 17 00:00:00 2001 From: adiabatic Date: Thu, 1 Feb 2018 22:01:18 -0800 Subject: [PATCH 037/173] =?UTF-8?q?zweihander:=20rename,=20=E2=8C=83=20?= =?UTF-8?q?=E2=86=92=20=E2=8C=A5,=20README=20revamp=20(#2311)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * zweihander-osx: Remove app keys, etc. - add right command keys - add F16 on ;' for Siri - remove command-Q (too easy to hit) * Rename zweihander-osx to zweihander-macos zweihander-macos: / / ^ → / / ⌥; README revamp zweihander: rename, ⌃ → ⌥, README revamp --- .../keymap.c | 8 +- .../ergodox/zweihander-macos/readme.markdown | 73 +++++++++++++++++++ .../ergodox/zweihander-macos/rules.mk | 3 + .../ergodox/zweihander-osx/readme.markdown | 45 ------------ .../community/ergodox/zweihander-osx/rules.mk | 2 - 5 files changed, 80 insertions(+), 51 deletions(-) rename layouts/community/ergodox/{zweihander-osx => zweihander-macos}/keymap.c (97%) create mode 100644 layouts/community/ergodox/zweihander-macos/readme.markdown create mode 100644 layouts/community/ergodox/zweihander-macos/rules.mk delete mode 100644 layouts/community/ergodox/zweihander-osx/readme.markdown delete mode 100644 layouts/community/ergodox/zweihander-osx/rules.mk diff --git a/layouts/community/ergodox/zweihander-osx/keymap.c b/layouts/community/ergodox/zweihander-macos/keymap.c similarity index 97% rename from layouts/community/ergodox/zweihander-osx/keymap.c rename to layouts/community/ergodox/zweihander-macos/keymap.c index 8c216b09..6dd2b04f 100644 --- a/layouts/community/ergodox/zweihander-osx/keymap.c +++ b/layouts/community/ergodox/zweihander-macos/keymap.c @@ -16,9 +16,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| * | ⌦ | Q | W | E | R | T | ~L1 | | ~L1 | Y | U | I | O | P | \ | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | ⌫ | A | S | D | F | G |------| |------| H | J | K | L |; / L2| ' / L⌘ | + * | ⌫ | A | S | D | F | G |------| |------| H | J | K | L |; / L2| ' / R⌘ | * |--------+------+------+------+------+------| L⌘ | | R⌘ |------+------+------+------+------+--------| - * | L⇧ | Z | X | C | V | B | | | | N | M | , | . | / / ⌃| R⇧ | + * | L⇧ | Z | X | C | V | B | | | | N | M | , | . | / /R⌥| R⇧ | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' * | L⌃ | L⌥ | L⌘ | ← | → | | ↑ | ↓ | [ | ] | | * `----------------------------------' `----------------------------------' @@ -45,8 +45,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // right hand TG(SYMB), KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, MO(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, - KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT), - KC_RGUI, KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT, + KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),RGUI_T(KC_QUOT), + KC_RGUI, KC_N, KC_M, KC_COMM,KC_DOT, RALT_T(KC_SLSH), KC_RSFT, KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_SPC , KC_ESC, KC_BSPC, KC_PGDN, diff --git a/layouts/community/ergodox/zweihander-macos/readme.markdown b/layouts/community/ergodox/zweihander-macos/readme.markdown new file mode 100644 index 00000000..8921647b --- /dev/null +++ b/layouts/community/ergodox/zweihander-macos/readme.markdown @@ -0,0 +1,73 @@ +# The Zweihander Layout + +NB: the backtick (\`) is special in Markdown. If I write ⌘\` in this readme, I mean “Command-backtick”, not “Command-backslash-backtick”. + +This README refers to two secondary layers: the Media Layer and the Symbol Layer. The Media Layer is accessed by holding ; (the semicolon) and has cursor-movement, window-management, and volume-adjustment keys on it. The Symbol Layer is accessed by holding either of the two tall keys between T and Y, or by tapping one of the small keys between 5 and 6. It has a 10-key keypad, parentheses and similar grouping punctuation, and F1–F12. + +This layout is tuned for people who… + + +## use macOS + +While this layout works fine in Windows, it’s not tuned for it. No sane person who primarily uses Windows would put this many Windows keys on a keyboard layout. That said, Print Screen, Scroll Lock, and Pause are available in their usual order on the Media Layer if you need them. + + +## mouse left-handed while doing other things with the right hand + +I tend to have my mouse in my left hand, but I like to use my other hand to make things go faster. I’ve added a bunch of buttons to the Media Layer (hold ;) to speed up browsing in applications like Safari and Finder: + +- ⌘[ — Back +- ⌘] — Forward +- ⌥⌘↓ — Open Selection and Close Parent Folder +- ⌥⌘↑ — Go Up and Close Just-Left Folder + +I also have a few keys dedicated to window management: + +- ⌘W — Close Window +- ⌘\` — Move Focus to Next Window +- ⌘⇧\` — Move Focus to Previous Window + +Cut, Copy, and Paste (⌘X, ⌘C, and ⌘V) are also available on the three bottommost right-thumb buttons if you hold ;. + + +## use lots of modifier keys in OS X menu-item shortcuts + +I wanted to preserve the feel of a number of shortcuts that involve pressing lots of modifier keys at once. This is why the bottom left of the keyboard has Shift, Control, Option, and Command in the usual spots. Further I’ve added affordances so some key combinations are easier to press with just the right hand. + +I also put a second Backspace (⌫) key on the right half of the keyboard to make some particularly commonly-used keyboard shortcuts faster and more convenient for right-handed use: + +- ⌘⌫ — Move to Trash / Delete +- ⇧⌥⌘⌫ — Empty Trash Without Asking for Confirmation + +⇧⌥⌘⌫ is much more satisfying to press when you do it like on a normal keyboard: one left-hand finger on each of ⇧, ⌥, and ⌘, and the right index finger on ⌫. + +Pressing and holding / will give you Option. This makes a number of keyboard shortcuts easy to press with just the right hand: + +- ⌥↑ — Move Line Up +- ⌥↓ — Move Line Down +- ⌥⇧↑ — Copy Line Up / Go To Previous Channel With Unread Messages +- ⌥⇧↓ — Copy Line Down / Go To Next Channel With Unread Messages + + +## use Emacs-style shortcuts + +I press C-a, C-e, and C-k all the time. It’s difficult to press these key combinations with the Control key on the far left, so the leftmost thumb button on the right side is another Control key. + +Having trouble remembering which innermost thumb key is Alt and which is Control? The two’re like on the lower right of a normal keyboard — leftmost is Alt, rightmost is Control. + + +## use spreadsheets + +All the common spreadsheet operations (+-*/=) are on the right side of the Symbol Layer. Make-numbers-bigger (+, \*) operations on the right; make-numbers-smaller (-, /) on the left. There’s also a colon there for entering times and maybe IPv6 addresses. + + +## know the ↑↓←→ fn-key shortcuts for MacBooks + +Have you looked at the Page Up, Page Down, Home, and End keys on the EDSF keys and wondered why they’re arranged that way? They’re arranged the same way as the fn-key shortcuts on an Apple laptop’s arrow keys. On Apple keyboards with an\* fn key, if you press fn-↑, you’ll get Page Up; if you press fn-← you’ll get Home. Similarly, on Zweihander, ;-E is Page Up and ;-S is Home. + + +## use Siri + +F16, accessed by holding ; and pressing the ' key next to it, is intended for Siri. + +\* I pronounce “fn” as “effin’”. Your mileage may vary. diff --git a/layouts/community/ergodox/zweihander-macos/rules.mk b/layouts/community/ergodox/zweihander-macos/rules.mk new file mode 100644 index 00000000..8011660c --- /dev/null +++ b/layouts/community/ergodox/zweihander-macos/rules.mk @@ -0,0 +1,3 @@ +# Don’t do a tricolor flashing-light wave when the computer is shut down in Windows, +# or when the machine is sleeping in macOS +SLEEP_LED_ENABLE = no diff --git a/layouts/community/ergodox/zweihander-osx/readme.markdown b/layouts/community/ergodox/zweihander-osx/readme.markdown deleted file mode 100644 index e88f7c05..00000000 --- a/layouts/community/ergodox/zweihander-osx/readme.markdown +++ /dev/null @@ -1,45 +0,0 @@ -# The Zweihander Layout - -NB: the backtick (\`) is special in Markdown. If I write ⌘\` in this readme, I mean “command-backtick”, not “command-backslash-backtick”. - -This layout is tuned for people who… - - -## use OS X - -While this layout should work fine in Windows, it’s not tuned for it. No sane person who primarily uses Windows would put this many Windows keys on a keyboard layout. - - -## mouse left-handed while doing other things with the right hand - -I tend to have my mouse in my left hand, but I like to use my other hand to make things go faster. I’ve added a bunch of buttons to the media layer to speed up browsing in Safari and Finder: - -- Close Window (⌘W) -- Back (⌘[) -- Forward (⌘]) -- Open and Close Parent Folder (⌥⌘↓) -- Go Up and Close Just-Left Folder (⌥⌘↑) -- Cycle through open windows in current application (⌘\` and ⌘⇧\`) - -Because moving letter-by-letter is way slower than moving word-by-word, I added Option (⌥) to the bottommost button on the left side. This key can be held easily while holding ; (activate media layer) and pressing J and L to move left and right by word. - - -## use lots of modifier keys in OS X menu-item shortcuts - -I wanted to preserve the feel of a number of shortcuts that involve pressing lots of modifier keys at once; this is why the bottom left of the keyboard has shift, control, option, and command in the usual spaces. Further, some common shortcuts I press have a key on the right side of the keyboard. These shortcuts include: - -- Empty Trash Without Asking for Confirmation (⇧⌥⌘⌫) - -⇧⌥⌘⌫, when you press the backspace on the right half of the keyboard, is much more satisfying than if you curl your left hand into a claw to press all the keys on the left. Try both; you’ll agree. - - -## use Emacs-style shortcuts - -I press C-a, C-e, and C-k all the time. It’s difficult to press these key combinations with the control key on the bottom left and I’m too quick on the draw for the control function on the / key to work reliably, so the bottommost thumb button on the right side is another control key. - -Having trouble remembering which thumb key is alt and which is ctrl? It’s like on the lower right of a normal keyboard — leftmost is alt, rightmost is ctrl. - - -## use spreadsheets - -All the common spreadsheet operations (+-*/=) are now on the right side of the symbol layer. There’s also a colon there for entering times and maybe IPv6 addresses. Not that I expect people to type IPv6 addresses into a spreadsheet, but, y’know. diff --git a/layouts/community/ergodox/zweihander-osx/rules.mk b/layouts/community/ergodox/zweihander-osx/rules.mk deleted file mode 100644 index 6e3d088a..00000000 --- a/layouts/community/ergodox/zweihander-osx/rules.mk +++ /dev/null @@ -1,2 +0,0 @@ -# Don’t do a tricolor wave when the computer is shut down in Windows -SLEEP_LED_ENABLE = no From f2459997ba5a2f4e14c17bcba301ca6624780aa2 Mon Sep 17 00:00:00 2001 From: Stephen Tudor Date: Sun, 7 Jan 2018 16:59:56 -0500 Subject: [PATCH 038/173] Add smt keymap for KBD75 --- keyboards/kbd75/keymaps/smt/keymap.c | 180 +++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 keyboards/kbd75/keymaps/smt/keymap.c diff --git a/keyboards/kbd75/keymaps/smt/keymap.c b/keyboards/kbd75/keymaps/smt/keymap.c new file mode 100644 index 00000000..7dc55766 --- /dev/null +++ b/keyboards/kbd75/keymaps/smt/keymap.c @@ -0,0 +1,180 @@ +#include "kbd75.h" + +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _FL 3 +#define _CL 4 + +enum planck_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK +}; + +// Helpful defines +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +// Custom macros +#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl +#define HPR_TAB ALL_T(KC_TAB) // Tap for Tab, hold for Hyper (Super+Ctrl+Shift+Alt) +#define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* 0: Qwerty layer + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │ ESC │ F1 │ F2 │ F3 │ F4 │ F5 │ F6 │ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │PRSCR│PAUSE│ DEL │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ \ │ INS │HOME │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │H_TAB│ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │BKSPC│█████│PG_UP│ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │C_ESC│ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │▒▒▒▒▒│ENTER│█████│PG_DN│ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │LSHFT│▒▒▒▒▒│ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │▒▒▒▒▒│RSHFT│ UP │ END │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │LCTRL│L_GUI│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ _FL │R_GUI│LEFT │DOWN │RIGHT│ + * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + */ + + /* 0: ANSI qwerty */ + [_QWERTY] = KEYMAP( + KC_ESC, 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_PSCR, KC_PAUS, 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_MINS, KC_EQL, KC_BSLS, KC_INS, KC_HOME, \ + HPR_TAB, 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_BSPC, KC_PGUP, \ + CTL_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_PGDN, \ + KC_LSFT, _______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, KC_UP, KC_END, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(_FL), KC_RGUI, KC_LEFT, KC_DOWN, KC_RGHT), + + /* 1: Colemak layer + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │ ESC │ F1 │ F2 │ F3 │ F4 │ F5 │ F6 │ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │PRSCR│PAUSE│ DEL │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ \ │ INS │HOME │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │H_TAB│ Q │ W │ F │ P │ G │ J │ L │ U │ Y │ ; │ [ │ ] │BKSPC│█████│PG_UP│ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │C_ESC│ A │ R │ S │ T │ D │ H │ N │ E │ I │ O │ ' │▒▒▒▒▒│ENTER│█████│PG_DN│ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │LSHFT│▒▒▒▒▒│ Z │ X │ C │ V │ B │ K │ M │ , │ . │ / │▒▒▒▒▒│RSHFT│ UP │ END │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │LCTRL│L_GUI│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ _FL │R_GUI│LEFT │DOWN │RIGHT│ + * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + */ + + /* 1: ANSI colemak */ + [_COLEMAK] = KEYMAP( + KC_ESC, 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_PSCR, KC_PAUS, 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_MINS, KC_EQL, KC_BSLS, KC_INS, KC_HOME, \ + HPR_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, KC_RBRC, KC_BSPC, KC_PGUP, \ + CTL_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT, KC_PGDN, \ + KC_LSFT, _______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, KC_UP, KC_END, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(_FL), KC_RGUI, KC_LEFT, KC_DOWN, KC_RGHT), + + /* 2: Dvorak layer + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │ ESC │ F1 │ F2 │ F3 │ F4 │ F5 │ F6 │ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │PRSCR│PAUSE│ DEL │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ \ │ INS │HOME │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │H_TAB│ ' │ , │ . │ P │ Y │ F │ G │ C │ R │ L │ / │ = │BKSPC│█████│PG_UP│ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │C_ESC│ A │ O │ E │ U │ I │ D │ H │ T │ N │ S │ - │▒▒▒▒▒│ENTER│█████│PG_DN│ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │LSHFT│▒▒▒▒▒│ ; │ Q │ J │ K │ X │ B │ M │ W │ V │ Z │▒▒▒▒▒│RSHFT│ UP │ END │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │LCTRL│L_GUI│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ _FL │R_GUI│LEFT │DOWN │RIGHT│ + * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + */ + + /* 2: ANSI dvorak */ + [_DVORAK] = KEYMAP( + KC_ESC, 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_PSCR, KC_PAUS, 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_LBRC, KC_RBRC, KC_BSLS, KC_INS, KC_HOME, \ + HPR_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSPC, KC_PGUP, \ + CTL_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_ENT, KC_PGDN, \ + KC_LSFT, _______, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_ENT, KC_UP, KC_END, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(_FL), KC_RGUI, KC_LEFT, KC_DOWN, KC_RGHT), + + /* 3: Function layer + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │█████│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ _CL │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │█████│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │▒▒▒▒▒│ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │PG_UP│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ _FL │ │HOME │PG_DN│ END │ + * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + */ + + /* 3: ANSI Fn layer */ + [_FL] = KEYMAP( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, MO(_CL), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, _______, \ + _______, _______, _______, _______, _______, _______, _______, MO(_FL), _______, KC_HOME, KC_PGDN, KC_END), + + /* 4: Control layer + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ RGB │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ │ │RESET│ │ │QWRTY│COLMK│DVORK│ │ │ │ │█████│RGBV+│ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ _CL │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │█████│RGBV-│ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ _FL │▒▒▒▒▒│ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │RGBS+│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ │█████│█████│█████│RGB_M│█████│█████│█████│ │ _FL │ │RGBH-│RGBS-│RGBH+│ + * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + */ + + /* 4: ANSI control layer */ + [_CL] = KEYMAP( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, \ + _______, _______, _______, _______, RESET, _______, _______, QWERTY, COLEMAK, DVORAK, _______, _______, _______, _______, RGB_VAI, \ + _______, _______, MO(_CL), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAD, \ + MO(_FL), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAI, _______, \ + _______, _______, _______, _______, RGB_MOD, _______, _______, MO(_FL), _______, RGB_HUD, RGB_SAD, RGB_HUI), +}; + + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + persistent_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + persistent_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + persistent_default_layer_set(1UL<<_DVORAK); + } + return false; + break; + } + return true; +} From 0310eafdcf3fd372f6804f209d42b5baf927eee3 Mon Sep 17 00:00:00 2001 From: mvs Date: Wed, 17 Jan 2018 19:21:31 -0500 Subject: [PATCH 039/173] QWERTY based layout with thumb-chording (SHIFT + SPECIAL) and programming layer. --- keyboards/ergodox_ez/keymaps/saha/keymap.c | 255 +++++++++++++++++++++ 1 file changed, 255 insertions(+) create mode 100644 keyboards/ergodox_ez/keymaps/saha/keymap.c diff --git a/keyboards/ergodox_ez/keymaps/saha/keymap.c b/keyboards/ergodox_ez/keymaps/saha/keymap.c new file mode 100644 index 00000000..4df9e883 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/saha/keymap.c @@ -0,0 +1,255 @@ +#include QMK_KEYBOARD_H + +#include "ergodox_ez.h" +#include "debug.h" +#include "action_layer.h" + +#define BASE 0 // Base layer - QWERTY +#define SPEC 1 // Special keys favoring programming in c-like languages +#define NUM 2 // Numeric layer with number row functional keys + +#define ___ KC_TRNS +#define BSLASH LSFT(KC_SLSH) + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [BASE] = LAYOUT_ergodox( + + // Left side + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ KC_VOLU, /**/ KC_1, /**/ KC_2, /**/ KC_3, /**/ KC_4, /**/ KC_5, /**/ KC_F11, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ KC_VOLD, /**/ KC_Q, /**/ KC_W, /**/ KC_E, /**/ KC_R, /**/ KC_T, /**/ KC_ESC, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*==========================================================================================*/ /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ KC_MPLY, /**/ KC_A, /**/ KC_S, /**/ KC_D, /**/ KC_F, /**/ KC_G, /*===============*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*==========================================================================================*/ /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ KC_MUTE, /**/ KC_Z, /**/ KC_X, /**/ KC_C, /**/ KC_V, /**/ KC_B, /**/ KC_BSPC, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ ___, /**/ ___, /**/ KC_RALT, /**/ KC_LCTRL, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ + /*=======================================================================*/ + + + /*==============================*/ + /**/ /**/ /**/ + /**/ ___, /**/ KC_DEL, /**/ + /**/ /**/ /**/ + /*=============================================*/ + /**/ /**/ /**/ /**/ + /**/ /**/ /**/ KC_LALT, /**/ + /**/ /**/ /**/ /**/ + /**/ /**/ /*===============*/ + /**/ /**/ /**/ /**/ + /**/ KC_SPACE, /**/ KC_LGUI, /**/ KC_LCTRL, /**/ + /**/ /**/ /**/ /**/ + /*=============================================*/ + + // Right side + // + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ KC_F12, /**/ KC_1, /**/ KC_2, /**/ KC_3, /**/ KC_4, /**/ KC_5, /**/ ___, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ KC_Y, /**/ KC_U, /**/ KC_I, /**/ KC_O, /**/ KC_P, /**/ ___, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ /*==========================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*===============*/ KC_H, /**/ KC_J, /**/ KC_K, /**/ KC_L, /**/ KC_SCLN, /**/ ___, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ /*==========================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ KC_ENT, /**/ KC_N, /**/ KC_M, /**/ KC_COMM, /**/ KC_DOT, /**/ KC_SLSH, /**/ ___, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ + /**/ MO(NUM), /**/ ___, /**/ ___, /**/ ___, /**/ ___, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ + /*=======================================================================*/ + + /*==============================*/ + /**/ /**/ /**/ + /**/ ___, /**/ ___, /**/ + /**/ /**/ /**/ + /*=============================================*/ + /**/ /**/ /**/ /**/ + /**/ ___, /**/ /**/ /**/ + /**/ /**/ /**/ /**/ + /*===============*/ /**/ /**/ + /**/ /**/ /**/ /**/ + /**/ ___, /**/ KC_RSFT, /**/ MO(SPEC) /**/ + /**/ /**/ /**/ /**/ + /*=============================================*/ + ), + + + [SPEC] = LAYOUT_ergodox( + + // Left side + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ KC_EXLM, /**/ KC_AT, /**/ KC_HASH, /**/ KC_DLR, /**/ KC_PERC, /**/ ___, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ KC_GRV, /**/ KC_QUOT, /**/ KC_LCBR, /**/ KC_RCBR, /**/ KC_PLUS, /**/ KC_ESC, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*==========================================================================================*/ /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ KC_TAB, /**/ KC_ASTR, /**/ KC_LPRN, /**/ KC_RPRN, /**/ KC_EQUAL, /*===============*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*==========================================================================================*/ /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ KC_HASH, /**/ KC_PERC, /**/ KC_LBRC, /**/ KC_RBRC, /**/ KC_MINUS, /**/ KC_BSPC, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ ___, /**/ ___, /**/ KC_LALT, /**/ KC_LCTRL, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ + /*=======================================================================*/ + + + /*==============================*/ + /**/ /**/ /**/ + /**/ ___, /**/ KC_DEL, /**/ + /**/ /**/ /**/ + /*=============================================*/ + /**/ /**/ /**/ /**/ + /**/ /**/ /**/ KC_LALT, /**/ + /**/ /**/ /**/ /**/ + /**/ /**/ /*===============*/ + /**/ /**/ /**/ /**/ + /**/ KC_SPACE, /**/ KC_LGUI, /**/ KC_LCTRL, /**/ + /**/ /**/ /**/ /**/ + /*=============================================*/ + + // Right side + // + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ KC_CIRC, /**/ KC_AMPR, /**/ KC_ASTR, /**/ KC_LPRN, /**/ KC_RPRN, /**/ ___, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ KC_AMPR, /**/ KC_HOME, /**/ KC_UP, /**/ KC_END, /**/ KC_CIRC, /**/ KC_F7, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ /*==========================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*===============*/ KC_EXLM, /**/ KC_LEFT, /**/ KC_DOWN, /**/ KC_RIGHT, /**/ KC_COLN, /**/ KC_F8, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ /*==========================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ KC_ENT, /**/ KC_PIPE, /**/ KC_UNDS, /**/ KC_LT, /**/ KC_GT, /**/ KC_BSLS, /**/ KC_F9, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ ___, /**/ ___, /**/ ___, /**/KC_F10,/**/ + /**/ /**/ /**/ /**/ /**/ /**/ + /*=======================================================================*/ + + /*==============================*/ + /**/ /**/ /**/ + /**/ ___, /**/ ___, /**/ + /**/ /**/ /**/ + /*=============================================*/ + /**/ /**/ /**/ /**/ + /**/ ___, /**/ /**/ /**/ + /**/ /**/ /**/ /**/ + /*===============*/ /**/ /**/ + /**/ /**/ /**/ /**/ + /**/ ___, /**/ KC_RSFT, /**/ ___ /**/ + /**/ /**/ /**/ /**/ + /*=============================================*/ + ), + + [NUM] = LAYOUT_ergodox( + + // Left side + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ KC_F1, /**/ KC_F2, /**/ KC_F3, /**/ KC_F4, /**/ KC_F5, /**/ KC_F11, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ KC_EXLM, /**/ KC_AT, /**/ KC_HASH, /**/ KC_DLR, /**/ KC_PERC, /**/ KC_ESC, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*==========================================================================================*/ /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ KC_1, /**/ KC_2, /**/ KC_3, /**/ KC_4, /**/ KC_5, /*===============*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*==========================================================================================*/ /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ KC_HASH, /**/ KC_PERC, /**/ KC_LBRC, /**/ KC_RBRC, /**/ KC_MINUS, /**/ KC_BSPC, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ ___, /**/ ___, /**/ KC_LALT, /**/ KC_LCTRL, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ + /*=======================================================================*/ + + + /*==============================*/ + /**/ /**/ /**/ + /**/ ___, /**/ KC_DEL, /**/ + /**/ /**/ /**/ + /*=============================================*/ + /**/ /**/ /**/ /**/ + /**/ /**/ /**/ KC_LALT, /**/ + /**/ /**/ /**/ /**/ + /**/ /**/ /*===============*/ + /**/ /**/ /**/ /**/ + /**/ KC_SPACE, /**/ KC_LGUI, /**/ KC_LCTRL, /**/ + /**/ /**/ /**/ /**/ + /*=============================================*/ + + // Right side + // + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ KC_F12, /**/ KC_F6, /**/ KC_F7, /**/ KC_F8, /**/ KC_F9, /**/ KC_F10, /**/ ___, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ KC_CIRC, /**/ KC_AMPR, /**/ KC_ASTR, /**/ KC_LPRN, /**/ KC_RPRN, /**/ ___, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ /*==========================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*===============*/ KC_6, /**/ KC_7, /**/ KC_8, /**/ KC_9, /**/ KC_0, /**/ ___, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ /*==========================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /**/ KC_ENT, /**/ KC_PIPE, /**/ KC_UNDS, /**/ KC_COMM, /**/ KC_DOT, /**/ KC_BSLS, /**/ ___, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ + /*=========================================================================================================*/ + /**/ /**/ /**/ /**/ /**/ /**/ + /**/ ___, /**/ ___, /**/ ___, /**/ ___, /**/ ___, /**/ + /**/ /**/ /**/ /**/ /**/ /**/ + /*=======================================================================*/ + + /*==============================*/ + /**/ /**/ /**/ + /**/ ___, /**/ ___, /**/ + /**/ /**/ /**/ + /*=============================================*/ + /**/ /**/ /**/ /**/ + /**/ ___, /**/ /**/ /**/ + /**/ /**/ /**/ /**/ + /*===============*/ /**/ /**/ + /**/ /**/ /**/ /**/ + /**/ ___, /**/ KC_RSFT, /**/ ___ /**/ + /**/ /**/ /**/ /**/ + /*=============================================*/ + ), + +}; From 904b1b3f99201f4bead195e2b777a71cb25736d8 Mon Sep 17 00:00:00 2001 From: Erin Call Date: Mon, 22 Jan 2018 14:11:46 -0800 Subject: [PATCH 040/173] Use perl directly instead of grep -P BSD grep (the one on OSX) lacks a -P flag. The grep -P command thus fails and prints a usage message to the terminal. This fixes that. --- tmk_core/rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index 7a282cac..a1df7fc2 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk @@ -371,7 +371,7 @@ show_path: @echo OBJ=$(OBJ) check-size: - $(eval MAX_SIZE=$(shell n=`avr-gcc -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | grep -oP "(?<=AVR_SIZE: ).+"`; echo $$(($$n)) || echo 0)) + $(eval MAX_SIZE=$(shell n=`avr-gcc -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | perl -ne 'print "$&\n" if /(?<=AVR_SIZE: ).+/'`; echo $$(($$n)) || echo 0)) $(eval CURRENT_SIZE=$(shell if [ -f $(BUILD_DIR)/$(TARGET).hex ]; then $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(AWK) 'NR==2 {print $$4}'; else printf 0; fi)) if [ $(MAX_SIZE) -gt 0 ] && [ $(CURRENT_SIZE) -gt 0 ]; then \ $(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \ From 55d4c9b162b505695597a87d64ef04e29120118e Mon Sep 17 00:00:00 2001 From: Louis Orleans Date: Thu, 1 Feb 2018 22:11:57 -0800 Subject: [PATCH 041/173] =?UTF-8?q?=F0=9F=94=A7=20create=20info.json=20for?= =?UTF-8?q?=20Infinity=20Ergodox=20(#2267)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🔧 create info.json for Infinity Ergodox I'm not sure if the bootloader key is set correctly. * 🐛 fix layout name --- keyboards/ergodox_infinity/info.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 keyboards/ergodox_infinity/info.json diff --git a/keyboards/ergodox_infinity/info.json b/keyboards/ergodox_infinity/info.json new file mode 100644 index 00000000..72d035c5 --- /dev/null +++ b/keyboards/ergodox_infinity/info.json @@ -0,0 +1,14 @@ +{ + "keyboard_name": "Infinity Ergodox", + "manufacturer": "Input Club", + "identifier": "FEED:6464:0001", + "processor": "MK20DX256VLH7", + "bootloader": "KIIBOHD_BOOTLOADER", + "width": 19.5, + "height": 9.375, + "layouts": { + "KEYMAP": { + "layout": [{"label":"#", "x":3.5, "y":0}, {"label":"*", "x":15, "y":0}, {"label":"@", "x":2.5, "y":0.125}, {"label":"$", "x":4.5, "y":0.125}, {"label":"&", "x":14, "y":0.125}, {"label":"(", "x":16, "y":0.125}, {"label":"%", "x":5.5, "y":0.25}, {"x":6.5, "y":0.25}, {"x":12, "y":0.25}, {"label":"^", "x":13, "y":0.25}, {"x":0, "y":0.375, "w":1.5}, {"label":"!", "x":1.5, "y":0.375}, {"label":")", "x":17, "y":0.375}, {"x":18, "y":0.375, "w":1.5}, {"label":"E", "x":3.5, "y":1}, {"label":"I", "x":15, "y":1}, {"label":"W", "x":2.5, "y":1.125}, {"label":"R", "x":4.5, "y":1.125}, {"label":"U", "x":14, "y":1.125}, {"label":"O", "x":16, "y":1.125}, {"label":"T", "x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5}, {"x":12, "y":1.25, "h":1.5}, {"label":"Y", "x":13, "y":1.25}, {"x":0, "y":1.375, "w":1.5}, {"label":"Q", "x":1.5, "y":1.375}, {"label":"P", "x":17, "y":1.375}, {"x":18, "y":1.375, "w":1.5}, {"label":"D", "x":3.5, "y":2}, {"label":"K", "x":15, "y":2}, {"label":"S", "x":2.5, "y":2.125}, {"label":"F", "x":4.5, "y":2.125}, {"label":"J", "x":14, "y":2.125}, {"label":"L", "x":16, "y":2.125}, {"label":"G", "x":5.5, "y":2.25}, {"label":"H", "x":13, "y":2.25}, {"x":0, "y":2.375, "w":1.5}, {"label":"A", "x":1.5, "y":2.375}, {"label":":", "x":17, "y":2.375}, {"x":18, "y":2.375, "w":1.5}, {"x":6.5, "y":2.75, "h":1.5}, {"x":12, "y":2.75, "h":1.5}, {"label":"C", "x":3.5, "y":3}, {"label":"<", "x":15, "y":3}, {"label":"X", "x":2.5, "y":3.125}, {"label":"V", "x":4.5, "y":3.125}, {"label":"M", "x":14, "y":3.125}, {"label":">", "x":16, "y":3.125}, {"label":"B", "x":5.5, "y":3.25}, {"label":"N", "x":13, "y":3.25}, {"x":0, "y":3.375, "w":1.5}, {"label":"Z", "x":1.5, "y":3.375}, {"label":"?", "x":17, "y":3.375}, {"x":18, "y":3.375, "w":1.5}, {"x":3.5, "y":4}, {"x":15, "y":4}, {"x":2.5, "y":4.125}, {"x":4.5, "y":4.125}, {"x":14, "y":4.125}, {"x":16, "y":4.125}, {"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":17, "y":4.375}, {"x":18, "y":4.375}, {"x":1, "y":4.375}, {"x":2, "y":4.375}, {"x":0, "y":5.375, "h":2}, {"x":1, "y":5.375, "h":2}, {"x":2, "y":5.375}, {"x":2, "y":6.375}, {"x":-3.0, "y":6.375}, {"x":-2, "y":6.375}, {"x":-3.0, "y":7.375}, {"x":-2, "y":7.375, "h":2}, {"x":-1.0, "y":7.375, "h":2}, {"x":-3.0, "y":8.375}] + } + } +} From 2917e55bd4c8e25d79981ec997037b89478d402c Mon Sep 17 00:00:00 2001 From: Donald Date: Fri, 2 Feb 2018 01:13:44 -0500 Subject: [PATCH 042/173] Added info.json and updated README for Deltasplit75 (#2266) * Added info.json and updated README * Updated info.json --- keyboards/deltasplit75/info.json | 18 ++++++++++++++++++ keyboards/deltasplit75/readme.md | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 keyboards/deltasplit75/info.json diff --git a/keyboards/deltasplit75/info.json b/keyboards/deltasplit75/info.json new file mode 100644 index 00000000..53b06e0f --- /dev/null +++ b/keyboards/deltasplit75/info.json @@ -0,0 +1,18 @@ +{ + "keyboard_name": "DeltaSplit75", + "identifier":"FEED:3060:0001", + "manufacturer": "xyxjj", + "maintainer": "xyxjj & itsaferbie", + "processor": "atmega32u4", + "bootloader": "n/a", + "width": 17, + "height": 6, + "layouts": { + "KEYMAP_V2": { + "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":1, "y":0}, {"label":"F2", "x":2, "y":0}, {"label":"F3", "x":3, "y":0}, {"label":"F4", "x":4, "y":0}, {"label":"F5", "x":5, "y":0}, {"label":"F6", "x":6, "y":0}, {"label":"F7", "x":8, "y":0}, {"label":"F8", "x":9, "y":0}, {"label":"F9", "x":10, "y":0}, {"label":"F10", "x":11, "y":0}, {"label":"F11", "x":12, "y":0}, {"label":"F12", "x":13, "y":0}, {"label":"Print", "x":14, "y":0}, {"label":"Scroll", "x":15, "y":0}, {"label":"Pause", "x":16, "y":0}, {"label":"~", "x":0, "y":1}, {"label":"!", "x":1, "y":1}, {"label":"@", "x":2, "y":1}, {"label":"#", "x":3, "y":1}, {"label":"$", "x":4, "y":1}, {"label":"%", "x":5, "y":1}, {"label":"^", "x":6, "y":1}, {"label":"&", "x":8, "y":1}, {"label":"*", "x":9, "y":1}, {"label":"(", "x":10, "y":1}, {"label":")", "x":11, "y":1}, {"label":"_", "x":12, "y":1}, {"label":"+", "x":13, "y":1}, {"label":"Back", "x":14, "y":1}, {"label":"Trns", "x":15, "y":1}, {"label":"Home", "x":16, "y":1}, {"label":"Tab", "x":0, "y":2, "w":1.5}, {"label":"Q", "x":1.5, "y":2}, {"label":"W", "x":2.5, "y":2}, {"label":"E", "x":3.5, "y":2}, {"label":"R", "x":4.5, "y":2}, {"label":"T", "x":5.5, "y":2}, {"label":"Y", "x":7.5, "y":2}, {"label":"U", "x":8.5, "y":2}, {"label":"I", "x":9.5, "y":2}, {"label":"O", "x":10.5, "y":2}, {"label":"P", "x":11.5, "y":2}, {"label":"{", "x":12.5, "y":2}, {"label":"}", "x":13.5, "y":2}, {"label":"Back", "x":14.5, "y":2, "w":1.5}, {"label":"PgUp", "x":16, "y":2}, {"label":"Ctrl", "x":0, "y":3, "w":1.75}, {"label":"A", "x":1.75, "y":3}, {"label":"S", "x":2.75, "y":3}, {"label":"D", "x":3.75, "y":3}, {"label":"F", "x":4.75, "y":3}, {"label":"G", "x":5.75, "y":3}, {"label":"H", "x":7.75, "y":3}, {"label":"J", "x":8.75, "y":3}, {"label":"K", "x":9.75, "y":3}, {"label":"L", "x":10.75, "y":3}, {"label":":", "x":11.75, "y":3}, {"label":"\"", "x":12.75, "y":3}, {"label":"Trns", "x":13.75, "y":3}, {"label":"Enter", "x":14.75, "y":3, "w":1.25}, {"label":"PgDn", "x":16, "y":3}, {"label":"Shift", "x":0, "y":4, "w":1.25}, {"label":"Trns", "x":1.25, "y":4}, {"label":"Z", "x":2.25, "y":4}, {"label":"X", "x":3.25, "y":4}, {"label":"C", "x":4.25, "y":4}, {"label":"V", "x":5.25, "y":4}, {"label":"B", "x":6.25, "y":4}, {"label":"B", "x":7.25, "y":4}, {"label":"N", "x":8.25, "y":4}, {"label":"M", "x":9.25, "y":4}, {"label":"<", "x":10.25, "y":4}, {"label":">", "x":11.25, "y":4}, {"label":"?", "x":12.25, "y":4}, {"label":"Shift", "x":13.25, "y":4, "w":1.75}, {"label":"Up", "x":15, "y":4}, {"label":"End", "x":16, "y":4}, {"label":"Ctrl", "x":0, "y":5, "w":1.25}, {"label":"Win", "x":1.25, "y":5, "w":1.25}, {"label":"Alt", "x":2.5, "y":5, "w":1.25}, {"label":"Space", "x":3.75, "y":5, "w":2}, {"label":"Fn", "x":5.75, "y":5}, {"label":"Space", "x":7.75, "y":5, "w":2.75}, {"label":"Alt", "x":10.5, "y":5, "w":1.25}, {"label":"Win", "x":11.75, "y":5}, {"label":"Ctrl", "x":12.75, "y":5, "w":1.25}, {"label":"Left", "x":14, "y":5}, {"label":"Down", "x":15, "y":5}, {"label":"Right", "x":16, "y":5}] + }, + "KEYMAP_PROTOSPLIT": { + "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":1, "y":0}, {"label":"F2", "x":2, "y":0}, {"label":"F3", "x":3, "y":0}, {"label":"F4", "x":4, "y":0}, {"label":"F5", "x":5, "y":0}, {"label":"F6", "x":6, "y":0}, {"label":"F7", "x":8, "y":0}, {"label":"F8", "x":9, "y":0}, {"label":"F9", "x":10, "y":0}, {"label":"F10", "x":11, "y":0}, {"label":"F11", "x":12, "y":0}, {"label":"F12", "x":13, "y":0}, {"label":"Insert", "x":14, "y":0}, {"label":"Home", "x":15, "y":0}, {"label":"PgUp", "x":16, "y":0}, {"label":"~", "x":0, "y":1}, {"label":"!", "x":1, "y":1}, {"label":"@", "x":2, "y":1}, {"label":"#", "x":3, "y":1}, {"label":"$", "x":4, "y":1}, {"label":"%", "x":5, "y":1}, {"label":"^", "x":6, "y":1}, {"label":"&", "x":8, "y":1}, {"label":"*", "x":9, "y":1}, {"label":"(", "x":10, "y":1}, {"label":")", "x":11, "y":1}, {"label":"_", "x":12, "y":1}, {"label":"+", "x":13, "y":1}, {"label":"Delete", "x":14, "y":1}, {"label":"End", "x":15, "y":1}, {"label":"PgDn", "x":16, "y":1}, {"label":"Tab", "x":0, "y":2, "w":1.5}, {"label":"Q", "x":1.5, "y":2}, {"label":"W", "x":2.5, "y":2}, {"label":"E", "x":3.5, "y":2}, {"label":"R", "x":4.5, "y":2}, {"label":"T", "x":5.5, "y":2}, {"label":"Y", "x":7.5, "y":2}, {"label":"U", "x":8.5, "y":2}, {"label":"I", "x":9.5, "y":2}, {"label":"O", "x":10.5, "y":2}, {"label":"P", "x":11.5, "y":2}, {"label":"{", "x":12.5, "y":2}, {"label":"}", "x":13.5, "y":2}, {"label":"Back", "x":14.5, "y":2, "w":1.5}, {"label":"Scroll", "x":16, "y":2}, {"label":"Ctrl", "x":0, "y":3, "w":1.75}, {"label":"A", "x":1.75, "y":3}, {"label":"S", "x":2.75, "y":3}, {"label":"D", "x":3.75, "y":3}, {"label":"F", "x":4.75, "y":3}, {"label":"G", "x":5.75, "y":3}, {"label":"H", "x":7.75, "y":3}, {"label":"J", "x":8.75, "y":3}, {"label":"K", "x":9.75, "y":3}, {"label":"L", "x":10.75, "y":3}, {"label":":", "x":11.75, "y":3}, {"label":"\"", "x":12.75, "y":3}, {"label":"Enter", "x":13.75, "y":3, "w":2.25}, {"label":"Pause", "x":16, "y":3}, {"label":"Shift", "x":0, "y":4, "w":2.25}, {"label":"Z", "x":2.25, "y":4}, {"label":"X", "x":3.25, "y":4}, {"label":"C", "x":4.25, "y":4}, {"label":"V", "x":5.25, "y":4}, {"label":"B", "x":6.25, "y":4}, {"label":"B", "x":7.25, "y":4}, {"label":"N", "x":8.25, "y":4}, {"label":"M", "x":9.25, "y":4}, {"label":"<", "x":10.25, "y":4}, {"label":">", "x":11.25, "y":4}, {"label":"?", "x":12.25, "y":4}, {"label":"Shift", "x":13.25, "y":4, "w":1.75}, {"label":"Up", "x":15, "y":4}, {"label":"Print", "x":16, "y":4}, {"label":"Ctrl", "x":0, "y":5, "w":1.25}, {"label":"Win", "x":1.25, "y":5, "w":1.25}, {"label":"Alt", "x":2.5, "y":5, "w":1.25}, {"label":"Space", "x":3.75, "y":5, "w":2}, {"label":"Fn", "x":5.75, "y":5}, {"label":"Space", "x":7.75, "y":5, "w":2.75}, {"label":"Alt", "x":10.5, "y":5, "w":1.25}, {"label":"Win", "x":11.75, "y":5}, {"label":"Ctrl", "x":12.75, "y":5, "w":1.25}, {"label":"Left", "x":14, "y":5}, {"label":"Down", "x":15, "y":5}, {"label":"Right", "x":16, "y":5}] + } + } +} diff --git a/keyboards/deltasplit75/readme.md b/keyboards/deltasplit75/readme.md index f911f787..990f8902 100644 --- a/keyboards/deltasplit75/readme.md +++ b/keyboards/deltasplit75/readme.md @@ -3,7 +3,7 @@ DeltaSplit75 A split 75% keyboard made by xyxjj. [More info on qmk.fm](http://qmk.fm/deltasplit75/) -Keyboard Maintainer: [xyxjj](https://github.com/xyxjj) +Keyboard Maintainer: [xyxjj](https://github.com/xyxjj) & [itsaferbie](https://github.com/itsaferbie) Hardware Supported: Pro Micro Hardware Availability: Group Buy From 2cf6bfe9ac10663181aa3ba32087da956bb7ec1e Mon Sep 17 00:00:00 2001 From: jola5 Date: Fri, 2 Feb 2018 07:21:41 +0100 Subject: [PATCH 043/173] Not quite neo (#2318) * planck with a not-quite-neo layout for a de-DE OS/SW keymap * ergodox infinity with a not-quite-neo layout for a de-DE OS/SW keymap * add documentation --- .../keymaps/not-quite-neo/keymap.c | 292 ++++++++++++++++++ .../keymaps/not-quite-neo/readme.md | 5 + .../keymaps/not-quite-neo/rules.mk | 2 + .../planck/keymaps/not-quite-neo/config.h | 6 + .../planck/keymaps/not-quite-neo/keymap.c | 129 ++++++++ .../planck/keymaps/not-quite-neo/readme.md | 5 + .../planck/keymaps/not-quite-neo/rules.mk | 29 ++ users/not-quite-neo/nqn-basic-layout.h | 124 ++++++++ users/not-quite-neo/nqn-common.h | 14 + .../nqn-keys-on-quertz-de-latin1.h | 73 +++++ users/not-quite-neo/readme.md | 24 ++ 11 files changed, 703 insertions(+) create mode 100644 keyboards/ergodox_infinity/keymaps/not-quite-neo/keymap.c create mode 100644 keyboards/ergodox_infinity/keymaps/not-quite-neo/readme.md create mode 100644 keyboards/ergodox_infinity/keymaps/not-quite-neo/rules.mk create mode 100644 keyboards/planck/keymaps/not-quite-neo/config.h create mode 100644 keyboards/planck/keymaps/not-quite-neo/keymap.c create mode 100644 keyboards/planck/keymaps/not-quite-neo/readme.md create mode 100644 keyboards/planck/keymaps/not-quite-neo/rules.mk create mode 100644 users/not-quite-neo/nqn-basic-layout.h create mode 100644 users/not-quite-neo/nqn-common.h create mode 100644 users/not-quite-neo/nqn-keys-on-quertz-de-latin1.h create mode 100644 users/not-quite-neo/readme.md diff --git a/keyboards/ergodox_infinity/keymaps/not-quite-neo/keymap.c b/keyboards/ergodox_infinity/keymaps/not-quite-neo/keymap.c new file mode 100644 index 00000000..8cf51842 --- /dev/null +++ b/keyboards/ergodox_infinity/keymaps/not-quite-neo/keymap.c @@ -0,0 +1,292 @@ +#include QMK_KEYBOARD_H + +/* +NQN is not-quite-neo +A layout based on neo2 +*/ + +#include "action_layer.h" +#include "version.h" + +#include "nqn-keys-on-quertz-de-latin1.h" +#include "nqn-basic-layout.h" + +// Since our quirky block definitions are basically a list of comma separated +// arguments, we need a wrapper in order for these definitions to be +// expanded before being used as arguments to the LAYOUT_xxx macro. +#define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__) + +#ifdef LEADER_TIMEOUT +#undef LEADER_TIMEOUT +#endif +#define LEADER_TIMEOUT 300 + +#define TAP_ONCE(code) \ + register_code (code); \ + unregister_code (code) + + +// Automatic number generation of important keywords +enum my_keycodes{ + // Layer numbers follow the neo2 terminology, i.e. base layer = layer 1 + L01 = 0, + /* L02, SHIFT is not (yet) implemented as a fully customizable layer */ + L03, + L04, + L05, + /* L06, UNSPECIFIED not (yet) needed */ + LFN +}; + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* L01 -> default: BASE LAYER + * ,--------------------------------------------------. ,--------------------------------------------------. + * | TAB | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | BACKSP | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | ESC | | LEADR| | LEADR| | ENTER | + * |--------+ | | | | +--------| + * | L03 | L01_LEFT |------| |------| L01_RIGHT | L03 | + * |--------+ | LFN | | LFN | +--------| + * | SHIFT | | | | | | SHIFT | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | CTRL | GUI | ALT | L05 | L04 | | L04 | L05 | ALTGR| LFN | CTRL | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | HOME | END | | LEFT | RIGHT| + * ,------|------|------| |------+------+------. + * | | | PGUP | | UP | | | + * | SPACE| SHIFT|------| |------| SHIFT| SPACE| + * | | | PGDN | | DOWN | | | + * `--------------------' `--------------------' + */ +[L01] = LAYOUT_ergodox_wrapper( + KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, XXXXXXX, + KC_ESC, L01_LEFT_01, KC_LEAD, + MO(L03), L01_LEFT_02, + KC_LSHIFT, L01_LEFT_03, MO(LFN), + KC_LCTRL,KC_LGUI,KC_LALT, MO(L05), MO(L04), + XXXXXXX, XXXXXXX, + KC_PGUP, + KC_SPACE,KC_LSHIFT,KC_PGDN, + //-- + XXXXXXX, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPACE, + KC_LEAD, L01_RIGHT_01, KC_ENTER, + L01_RIGHT_02, MO(L03), + MO(LFN), L01_RIGHT_03, KC_RSHIFT, + MO(L04), MO(L05), KC_RALT, MO(LFN), KC_RCTRL, + KC_LEFT, KC_RIGHT, + KC_UP, + KC_DOWN, KC_RSHIFT, KC_SPACE +), + + +/* +L02 -> MO(L02): SHIFT (as a layer not used, not defined, not reachable) + */ + + +/* L03 -> MO(L03): PROGRAMMING + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | | | | | | + * |--------+ | | | | +--------| + * | | L03_LEFT |------| |------| L03_RIGHT | | + * |--------+ | | | | +--------| + * | | | | | | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | | | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +[L03] = LAYOUT_ergodox_wrapper( + _______, _______, _______, _______, _______, _______, _______, + _______, L03_LEFT_01, _______, + _______, L03_LEFT_02, + _______, L03_LEFT_03, _______, + _______, _______, _______, _______, _______, + _______, _______, + _______, + _______, _______, _______, + //-- + _______, _______, _______, _______, _______, _______, _______, + _______, L03_RIGHT_01, _______, + L03_RIGHT_02, _______, + _______, L03_RIGHT_03, _______, + _______, _______, _______, _______, _______, + _______, _______, + _______, + _______, _______, _______ +), + +/* L04 -> MO(L04): NAVIGATION AND NUMBERS + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | | | | | | + * |--------+ | | | | +--------| + * | | L04_LEFT |------| |------| L04_RIGHT | | + * |--------+ | | | | +--------| + * | | | | | | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | | | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | 0 | |------| |------| | 0 | + * | | | | | | | | + * `--------------------' `--------------------' + */ +[L04] = LAYOUT_ergodox_wrapper( + _______, _______, _______, _______, _______, _______, _______, + _______, L04_LEFT_01, _______, + _______, L04_LEFT_02, + _______, L04_LEFT_03, _______, + _______, _______, _______, _______, _______, + _______, _______, + _______, + KC_0, _______, _______, + //-- + _______, _______, _______, _______, _______, _______, _______, + _______, L04_RIGHT_01, _______, + L04_RIGHT_02, _______, + _______, L04_RIGHT_03, _______, + _______, _______, _______, _______, _______, + _______, _______, + _______, + _______, _______, KC_0 +), + + +/* L05 -> MO(L05): ALTERNATE + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | | | | | | + * |--------+ | | | | +--------| + * | | L05_LEFT |------| |------| L05_RIGHT | | + * |--------+ | | | | +--------| + * | | | | | | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | | | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +[L05] = LAYOUT_ergodox_wrapper( + _______, _______, _______, _______, _______, _______, _______, + _______, L05_LEFT_01, _______, + _______, L05_LEFT_02, + _______, L05_LEFT_03, _______, + _______, _______, _______, _______, _______, + _______, _______, + _______, + _______, _______, _______, + //-- + _______, _______, _______, _______, _______, _______, _______, + _______, L05_RIGHT_01, _______, + L05_RIGHT_02, _______, + _______, L05_RIGHT_03, _______, + _______, _______, _______, _______, _______, + _______, _______, + _______, + _______, _______, _______ +), + + +/* +L06 -> : UNSPECIFIED +*/ + + +/* LFN -> MO(FN): FUNCTION + * ,--------------------------------------------------. ,--------------------------------------------------. + * | RESET | | | | | | | | | | | | | | RESET | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | | | | | BACKSPC| + * |--------+ | | | | +--------| + * | | L06_LEFT |------| |------| L06_RIGHT | INSERT | + * |--------+ | | | | +--------| + * | | | | | | | DELETE | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | VOL+ | VOL- | MUTE | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +[LFN] = LAYOUT_ergodox_wrapper( + RESET, _______, _______, _______, _______, _______, _______, + _______, L06_LEFT_01, _______, + _______, L06_LEFT_02, + _______, L06_LEFT_03, _______, + _______, _______, _______, _______, _______, + _______, _______, + _______, + _______, _______, _______, + //-- + _______, _______, _______, _______, _______, _______, RESET, + _______, L06_RIGHT_01, KC_BSPACE, + L06_RIGHT_02, KC_INSERT, + _______, L06_RIGHT_03, KC_DELETE, + KC_VOLU, KC_VOLD, KC_MUTE, _______, _______, + _______, _______, + _______, + _______, _______, _______ +) + +}; + + +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { + set_unicode_input_mode(UC_LNX); +}; + + +LEADER_EXTERNS(); + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void) { + LEADER_DICTIONARY() { + leading = false; + leader_end(); + + SEQ_ONE_KEY (KC_1) { + // ¯\_(ツ)_/¯ + unicode_input_start(); register_hex(0xaf); unicode_input_finish(); + register_code (KC_RALT); TAP_ONCE (KC_MINS); unregister_code (KC_RALT); + register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT); + unicode_input_start (); register_hex(0x30c4); unicode_input_finish(); + register_code (KC_RSFT); TAP_ONCE (KC_9); TAP_ONCE(KC_7); unregister_code (KC_RSFT); + unicode_input_start (); register_hex(0xaf); unicode_input_finish(); + } + + SEQ_ONE_KEY (KC_2) { + // 凸(ツ)凸 + unicode_input_start(); register_hex(0x51F8); unicode_input_finish(); + register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT); + unicode_input_start (); register_hex(0x30c4); unicode_input_finish(); + register_code (KC_RSFT); TAP_ONCE (KC_9); unregister_code (KC_RSFT); + unicode_input_start (); register_hex(0x51F8); unicode_input_finish(); + } + } +} diff --git a/keyboards/ergodox_infinity/keymaps/not-quite-neo/readme.md b/keyboards/ergodox_infinity/keymaps/not-quite-neo/readme.md new file mode 100644 index 00000000..3fcb4edf --- /dev/null +++ b/keyboards/ergodox_infinity/keymaps/not-quite-neo/readme.md @@ -0,0 +1,5 @@ +# not-quite-neo + +This is my personal take on porting the [neo2 layout](https://www.neo-layout.org/) to support multiple keyboards. + +Refer to the [readme.md](../../../../users/not-quite-neo/readme.md) of the generic parts of the implementation. \ No newline at end of file diff --git a/keyboards/ergodox_infinity/keymaps/not-quite-neo/rules.mk b/keyboards/ergodox_infinity/keymaps/not-quite-neo/rules.mk new file mode 100644 index 00000000..75624bb8 --- /dev/null +++ b/keyboards/ergodox_infinity/keymaps/not-quite-neo/rules.mk @@ -0,0 +1,2 @@ +BACKLIGHT_ENABLE = yes +UNICODE_ENABLE = yes \ No newline at end of file diff --git a/keyboards/planck/keymaps/not-quite-neo/config.h b/keyboards/planck/keymaps/not-quite-neo/config.h new file mode 100644 index 00000000..7fa3bf32 --- /dev/null +++ b/keyboards/planck/keymaps/not-quite-neo/config.h @@ -0,0 +1,6 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#endif diff --git a/keyboards/planck/keymaps/not-quite-neo/keymap.c b/keyboards/planck/keymaps/not-quite-neo/keymap.c new file mode 100644 index 00000000..8ea7679e --- /dev/null +++ b/keyboards/planck/keymaps/not-quite-neo/keymap.c @@ -0,0 +1,129 @@ +/* +NQN is not-quite-neo +A layout based on the +*/ + + +#include "planck.h" +#include "nqn-keys-on-quertz-de-latin1.h" +#include "nqn-basic-layout.h" + + +// Automatic number generation of important keywords +enum my_keycodes{ + // Layer numbers follow the neo2 terminology, i.e. base layer = layer 1 + L01 = 0, + /* L02, SHIFT is not (yet) implemented as a fully customizable layer */ + L03, + L04, + L05, + /* L06, UNSPECIFIED not (yet) needed */ + LFN +}; + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* L01 -> default: BASE LAYER + * ,-----------------------------------------------------------------------------------. + * | ESC | | | ENTER| + * |------+ | +------| + * | L03 | L01_LEFT | L01_RIGHT | L03 | + * |------+ | +------| + * | SHIFT| | | SHIFT| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | CTLR | GUI | ALT | L05 | L04 | SPACE| SPACE| L04 | L05 | ALTGR| LFN | CTLR | + * `-----------------------------------------------------------------------------------' + */ +[L01] = { + {KC_ESC, L01_LEFT_01, L01_RIGHT_01, KC_ENTER}, + {MO(L03), L01_LEFT_02, L01_RIGHT_02, MO(L03)}, + {KC_LSHIFT, L01_LEFT_03, L01_RIGHT_03, KC_RSFT}, + {KC_LCTRL,KC_LGUI, KC_LALT, MO(L05), MO(L04), KC_SPC, KC_SPC, MO(L04), MO(L05), KC_RALT, MO(LFN), KC_RCTRL} +}, + + +/* +L02 -> MO(L02): SHIFT (as a layer not used, not defined, not reachable) + */ + + +/* L03 -> MO(L03): PROGRAMMING + * ,-----------------------------------------------------------------------------------. + * | | | | | + * |------+ | +------| + * | | L03_LEFT | L03_RIGHT | | + * |------+ | +------| + * | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[L03] = { + {_______, L03_LEFT_01, L03_RIGHT_01, _______}, + {_______, L03_LEFT_02, L03_RIGHT_02, _______}, + {_______, L03_LEFT_03, L03_RIGHT_03, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +}, + + +/* L04 -> MO(L04): NAVIGATION AND NUMBERS + * ,-----------------------------------------------------------------------------------. + * | | | | | + * |------+ | +------| + * | | L04_LEFT | L04_RIGHT | | + * |------+ | +------| + * | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | 0 | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[L04] = { + {_______, L04_LEFT_01, L04_RIGHT_01, _______}, + {_______, L04_LEFT_02, L04_RIGHT_02, _______}, + {_______, L04_LEFT_03, L04_RIGHT_03, _______}, + {_______, _______, _______, _______, _______, _______, KC_0, _______, _______, _______, _______, _______} +}, + + +/* L05 -> MO(L05): ALTERNATE + * ,-----------------------------------------------------------------------------------. + * | | | | | + * |------+ | +------| + * | | L05_LEFT | L05_RIGHT | | + * |------+ | +------| + * | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[L05] = { + {_______, L05_LEFT_01, L05_RIGHT_01, _______}, + {_______, L05_LEFT_02, L05_RIGHT_02, _______}, + {_______, L05_LEFT_03, L05_RIGHT_03, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +}, + + +/* +L06 -> : UNSPECIFIED +*/ + + +/* LFN -> MO(FN): FUNCTION + * ,-----------------------------------------------------------------------------------. + * | RESET| | | BACKS| + * |------+ | +------| + * | | L06_LEFT | L06_RIGHT |INSERT| + * |------+ | +------| + * | | | |DELETE| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |VOICE-|VOICE+|MUS ON|MUS OF| LIGHT| | | VOL+ | VOL- | MUTE | | | + * `-----------------------------------------------------------------------------------' + */ +[LFN] = { + {RESET, L06_LEFT_01, L06_RIGHT_01, KC_BSPC}, + {_______, L06_LEFT_02, L06_RIGHT_02, KC_INS}, + {_______, L06_LEFT_03, L06_RIGHT_03, KC_DEL}, + {MUV_DE, MUV_IN, MU_ON, MU_OFF, _______, _______, _______, KC_VOLU, KC_VOLD, KC_MUTE, _______, _______} +} +}; diff --git a/keyboards/planck/keymaps/not-quite-neo/readme.md b/keyboards/planck/keymaps/not-quite-neo/readme.md new file mode 100644 index 00000000..3fcb4edf --- /dev/null +++ b/keyboards/planck/keymaps/not-quite-neo/readme.md @@ -0,0 +1,5 @@ +# not-quite-neo + +This is my personal take on porting the [neo2 layout](https://www.neo-layout.org/) to support multiple keyboards. + +Refer to the [readme.md](../../../../users/not-quite-neo/readme.md) of the generic parts of the implementation. \ No newline at end of file diff --git a/keyboards/planck/keymaps/not-quite-neo/rules.mk b/keyboards/planck/keymaps/not-quite-neo/rules.mk new file mode 100644 index 00000000..316a3ea7 --- /dev/null +++ b/keyboards/planck/keymaps/not-quite-neo/rules.mk @@ -0,0 +1,29 @@ +# Based on Zach's Planck Makefile +# Max .hex size is about 28636 bytes + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +TAP_DANCE_ENABLE = no # Enable TapDance functionality +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +USB_6KRO_ENABLE = no # 6key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +#VARIABLE_TRACE = no # Debug changes to variable values +UNICODE_ENABLE = no # Unicode (can't be used with unicodemap) +UNICODEMAP_ENABLE = no # Enable extended unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/users/not-quite-neo/nqn-basic-layout.h b/users/not-quite-neo/nqn-basic-layout.h new file mode 100644 index 00000000..d1b9a1c4 --- /dev/null +++ b/users/not-quite-neo/nqn-basic-layout.h @@ -0,0 +1,124 @@ +#ifndef NQN_BASIC_LAYOUT_H +#define NQN_BASIC_LAYOUT_H + +/* +This is the basic NQN layout + +It consists of a block of 5x3, 5x4, 6x3, or 6x4 for each hand. This allows us +to use these blocks for a variety of keyboards like the planck, preonic and +even splits like the ergodox. + +You can see that we use some quirky preprocessor defines to achive what we +desire. In the future I would like to see qmk taking a more generic approach +like the KLL. + +The naming convention for these blocks is + L__ + + The LAYER is a number following the neo2 manner starting at 1 for the base + layer, 2 is shift, 3 is for special chars etc. + + SIDE is, well either the left or right side/half of a keyboard. + + The ROW is starting from the top, numbering beginning at 1. +*/ + + +#include "nqn-common.h" + + +/* + * + * LEFT RIGHT + * ,----------------------------------. ,----------------------------------. + * 01 | x | v | l | c | w | | k | h | g | f | q | + * |------+------+------+------+------| |------+------+------+------+------| + * 02 | u | i | a | e | o | | s | n | r | t | d | + * |------+------+------+------+------| |------+------+------+------+------| + * 03 | y | < | # | p | z | | b | m | , | . | j | + * `----------------------------------' `----------------------------------' + */ +#define L01_LEFT_01 KC_X, KC_V, KC_L, KC_C, KC_W +#define L01_LEFT_02 KC_U, KC_I, KC_A, KC_E, KC_O +#define L01_LEFT_03 N_Y, N_LT, N_HS, KC_P, N_Z +#define L01_RIGHT_02 KC_S, KC_N, KC_R, KC_T, KC_D +#define L01_RIGHT_01 KC_K, KC_H, KC_G, KC_F, KC_Q +#define L01_RIGHT_03 KC_B, KC_M, KC_COMM, KC_DOT, KC_J + + +/* + * + * LEFT RIGHT + * ,----------------------------------. ,----------------------------------. + * 01 | … | _ | [ | ] | ^ | | ! | < | > | = | & | + * |------+------+------+------+------| |------+------+------+------+------| + * 02 | \ | / | { | } | * | | ? | ( | ) | - | @ | + * |------+------+------+------+------| |------+------+------+------+------| + * 03 | # | $ | | | ~ | ` | | + | % | " | ' | ° | + * `----------------------------------' `----------------------------------' + */ +#define L03_LEFT_01 N_DOTS, N_USC, N_LSQBR, N_RSQBR, N_CIRC +#define L03_LEFT_02 N_BSLS, N_SLSH, N_LCUBR, N_RCUBR, N_ASTR +#define L03_LEFT_03 N_HASH, N_DLR, N_PIPE, N_TILD, N_GRAVE +#define L03_RIGHT_01 N_EXKL, N_LT, N_GT, N_EQ, N_AMP +#define L03_RIGHT_02 N_QUES, N_LPARN, N_RPARN, N_MINS, N_AT +#define L03_RIGHT_03 N_PLUS, N_PERC, N_QUOT, N_SING, N_DEGRE + + +/* + * + * LEFT RIGHT + * ,----------------------------------. ,----------------------------------. + * 01 | PAGEU| BACKS| UP | DELET| PAGED| | / | 7 | 8 | 9 | - | + * |------+------+------+------+------| |------+------+------+------+------| + * 02 | HOME | LEFT | DOWN | RIGHT| END | | * | 4 | 5 | 6 | + | + * |------+------+------+------+------| |------+------+------+------+------| + * 03 | ESC | TAB | INSRT| ENTER| UNDO | | ENTER| 1 | 2 | 3 | , | + * `----------------------------------' `----------------------------------' + */ +#define L04_LEFT_01 KC_PGUP, KC_BSPC, KC_UP, KC_DEL, KC_PGDN +#define L04_LEFT_02 KC_HOME, KC_LEFT, KC_DOWN, KC_RIGHT, KC_END +#define L04_LEFT_03 KC_ESC, KC_TAB, KC_INS, KC_ENTER, N_UNDO +#define L04_RIGHT_01 KC_KP_SLASH, KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_MINUS +#define L04_RIGHT_02 KC_KP_ASTERISK, KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_PLUS +#define L04_RIGHT_03 KC_KP_ENTER, KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_DOT + + +/* + * LEFT RIGHT + * ,----------------------------------. ,----------------------------------. + * 01 | | | | | | | | | | | | + * |------+------+------+------+------| |------+------+------+------+------| + * 02 | ü | | ä | € | ö | | ß | | | | | + * |------+------+------+------+------| |------+------+------+------+------| + * 03 | | | | | | | | µ | | | | + * `----------------------------------' `----------------------------------' + */ +#define L05_LEFT_01 _______, _______, _______, _______, _______ +#define L05_LEFT_02 N_UE, _______, N_AE, N_EURO, N_OE +#define L05_LEFT_03 _______, _______, _______, _______, _______ +#define L05_RIGHT_01 _______, _______, _______, _______, _______ +#define L05_RIGHT_02 N_SS, _______, _______, _______, _______ +#define L05_RIGHT_03 _______, N_MU, _______, _______, _______ + + +/* + * + * LEFT RIGHT + * ,----------------------------------. ,----------------------------------. + * 01 | F1 | F2 | F3 | F4 | | | MAIL | MUSIC| FILES| CALC | PASTE| + * |------+------+------+------+------| |------+------+------+------+------| + * 02 | F5 | F6 | F7 | F8 | | | PREV |PLAY/P| NEXT | STOP | COPY | + * |------+------+------+------+------| |------+------+------+------+------| + * 03 | F9 | F10 | F11 | F12 | | | PRINT| SCROL| PAUSE| NUMLK| CUT | + * `----------------------------------' `----------------------------------' + */ +#define L06_LEFT_01 KC_F1, KC_F2, KC_F3, KC_F4, _______ +#define L06_LEFT_02 KC_F5, KC_F6, KC_F7, KC_F8, _______ +#define L06_LEFT_03 KC_F9, KC_F10, KC_F11, KC_F12, _______ +#define L06_RIGHT_01 KC_MAIL, KC_MSEL, KC_MY_COMPUTER, KC_CALCULATOR, N_PASTE +#define L06_RIGHT_02 KC_MPRV, KC_MPLY, KC_MNXT, KC_MSTP, N_COPY +#define L06_RIGHT_03 KC_PSCR, KC_SLCK, KC_PAUS, KC_NLCK, N_CUT + + +#endif diff --git a/users/not-quite-neo/nqn-common.h b/users/not-quite-neo/nqn-common.h new file mode 100644 index 00000000..a04dc7a1 --- /dev/null +++ b/users/not-quite-neo/nqn-common.h @@ -0,0 +1,14 @@ +#ifndef NQN_COMMON_H +#define NQN_COMMON_H + + +/* +This file holds some commen NQN definitions +*/ + + +#define _______ KC_TRNS +#define XXXXXXX KC_NO + + +#endif diff --git a/users/not-quite-neo/nqn-keys-on-quertz-de-latin1.h b/users/not-quite-neo/nqn-keys-on-quertz-de-latin1.h new file mode 100644 index 00000000..8276cf20 --- /dev/null +++ b/users/not-quite-neo/nqn-keys-on-quertz-de-latin1.h @@ -0,0 +1,73 @@ +#ifndef NQN_KEYS_ON_QUERTZ_DE_LATIN1_H +#define NQN_KEYS_ON_QUERTZ_DE_LATIN1_H + + +/* +This file defines the desierd NQN keys if you use a software (operating sysetm) +configured for a QUERTZ layout (de-latin1). + +These chars can be created by using ALTGR on linux and a few of them on windows +with a German de-latin1 layout (depending on desktop environment and/or +application). + ′¹²³¼½¬{[]}\¸ + @ł€¶ŧ←↓→øþ¨~ + æſðđŋħ̣ĸł˝^’ + |»«¢„“”µ·…– + +Additionally, there are some common chars that we dit not yet define: + § +*/ + + +#include "nqn-common.h" + + +// NQN key definitions in no particular order +#define N_LT KC_NONUS_BSLASH +#define N_HS KC_NONUS_HASH +#define N_DOTS RALT(KC_DOT) // … +#define N_USC LSFT(KC_SLASH) // _ +#define N_LSQBR RALT(KC_8) // [ +#define N_RSQBR RALT(KC_9) // ] +#define N_CIRC KC_GRAVE // ^ +#define N_EXKL LSFT(KC_1) // ! +#define N_GT LSFT(KC_NONUS_BSLASH) // > +#define N_EQ LSFT(KC_0) // = +#define N_AMP LSFT(KC_6) // & +#define N_BSLS RALT(KC_MINS) // \ backslash +#define N_SLSH LSFT(KC_7) // / +#define N_LCUBR RALT(KC_7) // { +#define N_RCUBR RALT(KC_0) // } +#define N_ASTR LSFT(KC_RBRC) // * +#define N_QUES LSFT(KC_MINS) // ? +#define N_LPARN LSFT(KC_8) // ( +#define N_RPARN LSFT(KC_9) // ) +#define N_MINS KC_SLASH // - +#define N_COLN LSFT(KC_DOT) // : +#define N_HASH KC_BSLASH // # +#define N_DLR LSFT(KC_4) // $ +#define N_PIPE RALT(KC_NONUS_BSLASH) // | +#define N_TILD RALT(KC_RBRC) // ~ +#define N_GRAVE LSFT(KC_EQUAL) // ` +#define N_PLUS KC_RBRC // + +#define N_PERC LSFT(KC_5) // % +#define N_QUOT LSFT(KC_2) // " +#define N_SING LSFT(KC_BSLASH) // ' +#define N_SEMI LSFT(KC_COMM) // ; +#define N_EURO RALT(KC_E) // € +#define N_AT RALT(KC_Q) // @ +#define N_Z KC_Y +#define N_Y KC_Z +#define N_AE KC_QUOTE // ä +#define N_OE KC_SCOLON // ö +#define N_UE KC_LBRACKET // ü +#define N_MU RALT(KC_M) // µ +#define N_SS KC_MINS // ß +#define N_DEGRE LSFT(KC_GRAVE) // ° +#define N_PASTE LCTL(KC_V) // CTRL+V +#define N_COPY LCTL(KC_C) // CTRL+C +#define N_CUT LCTL(KC_X) // CTRL+X +#define N_UNDO LCTL(N_Z) // CTRL+Z + + +#endif diff --git a/users/not-quite-neo/readme.md b/users/not-quite-neo/readme.md new file mode 100644 index 00000000..85a29ecc --- /dev/null +++ b/users/not-quite-neo/readme.md @@ -0,0 +1,24 @@ +# not-quite-neo + +This is my personal take on porting the [neo2 layout](https://www.neo-layout.org/) to support both a ergodox (infinity) and a planck keyboard. Some sacrifices needed to be made, hence this layout is not-quite-neo. + +## Use case +My use case is simple: + +* I want to use neo2 (or a keymap as close as possible) on any computer I can plug my keyboards in. Because installing the neo2 SW driver is often not a acceptable solution. +* Since most computers I work on (colleagues, family, etc.) use a de-DE keymap, I can not use the official neo2 implementation, because it relies on a us layout and I often times do not even posses the administration rights to change that. +* neo2 makes use of most of the keys of a standard 104 key keyboard, especially for supporting the planck I needed to deviate from the original neo2 layout in order to fit everything I wanted. + +Therefore, I put all reusable code in the users/not-quite-neo directory and created a custom not-quite-neo keymap for the planck and the ergodox infinity keyboard respectively. + +## Pitfalls +Mind, since neo2 is a SW driver supported layout it offers a lot of features that are hard to support in hardware (especially the fancy utf stuff with math symbols and greek letters etc.). + +Right now this implementation only incompletely supports neo2 layers 1 to 4. + +The biggest difference is probably the support for the German Umlauts ä, ö, ü and the ß. Since we rely on a smaller number of keys some glyphs needed to be created otherwise. See the implementation in [nqn-basic-layout.h](nqn-basic-layout.h) for details. + +## Keyboards and keymaps + +You can find the *not-quite-neo* keymap for the ergodox infinity under [qmk_firmware/keyboards/ergodox_infinity/keymaps/not-quite-neo/](../../keyboards/ergodox_infinity/keymaps/not-quite-neo/readme.md). Respectively the keymap for the planck resides in [qmk_firmware/keyboards/planck/keymaps/not-quite-neo/](../../keyboards/planck/keymaps/not-quite-neo/readme.md) + . \ No newline at end of file From 042a450e24ad84c4a08b9e5435f97fe7bbd653a4 Mon Sep 17 00:00:00 2001 From: kifinnsson Date: Thu, 1 Feb 2018 23:22:37 -0700 Subject: [PATCH 044/173] Personal BEAKL9 based keymap (#2304) * Adding personal BEAKL9 based keymap Initial commit, very much a WIP/Proof of concept. * Updating personal BEAKL9 based layout * F-keys added to upper layer --- keyboards/miuni32/keymaps/ki/config.h | 8 ++ keyboards/miuni32/keymaps/ki/keymap.c | 149 +++++++++++++++++++++++++ keyboards/miuni32/keymaps/ki/readme.md | 4 + keyboards/miuni32/keymaps/ki/rules.mk | 21 ++++ 4 files changed, 182 insertions(+) create mode 100644 keyboards/miuni32/keymaps/ki/config.h create mode 100644 keyboards/miuni32/keymaps/ki/keymap.c create mode 100644 keyboards/miuni32/keymaps/ki/readme.md create mode 100644 keyboards/miuni32/keymaps/ki/rules.mk diff --git a/keyboards/miuni32/keymaps/ki/config.h b/keyboards/miuni32/keymaps/ki/config.h new file mode 100644 index 00000000..df06a262 --- /dev/null +++ b/keyboards/miuni32/keymaps/ki/config.h @@ -0,0 +1,8 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +// place overrides here + +#endif \ No newline at end of file diff --git a/keyboards/miuni32/keymaps/ki/keymap.c b/keyboards/miuni32/keymaps/ki/keymap.c new file mode 100644 index 00000000..1df93b08 --- /dev/null +++ b/keyboards/miuni32/keymaps/ki/keymap.c @@ -0,0 +1,149 @@ +#include "miuni32.h" +#include "action_layer.h" + +enum miuni32_layers { + _BEAKL, + _LOWER, + _RAISE, + _UNION +}; + +enum miuni32_keycodes { + BEAKL = SAFE_RANGE, + LOWER, + RAISE +}; + +#define SPC_SHF SFT_T(KC_SPC) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Level 0: BEAKL + * ,---------------------------------------------------------------------------------------. + * | J | H | O | U | K | LOWER | G | C | R | F | Z | + * |---------------------------------------------------------------------------------------| + * | Q | I | E | A | Y | RAISE | D | S | T | N | B | + * |---------------------------------------------------------------------------------------| + * | / | , | ' | . | X |SPC\SHF| W | M | L | P | V | + * |---------------------------------------------------------------------------------------| + */ + [_BEAKL] ={ + {KC_J, KC_H, KC_O, KC_U, KC_K, KC_NO, KC_G, KC_C, KC_R, KC_F, KC_Z}, + {KC_Q, KC_I, KC_E, KC_A, KC_Y, RAISE, KC_D, KC_S, KC_T, KC_N, KC_B}, + {KC_SLSH, KC_COMM, KC_QUOT, KC_DOT, KC_X, SPC_SHF, KC_W, KC_M, KC_L, KC_P, KC_V} + }, + /* Lower + * ,---------------------------------------------------------------------------------------. + * | Tab | { | _ | } | & | | Gui | [ | % | ] | Bkspc | + * |---------------------------------------------------------------------------------------| + * | \ | ( | 1 | ) | # | | $ | < | 0 | > | | | + * |---------------------------------------------------------------------------------------| + * | 5 | 4 | 3 | 2 | Ctl | | Alt | 9 | 8 | 7 | 6 | + * |---------------------------------------------------------------------------------------| + */ + [_LOWER] ={ + {KC_TAB, KC_LCBR, KC_UNDS, KC_RBRC, KC_AMPR, _______, KC_RGUI, KC_LBRC, KC_PERC, KC_RBRC, KC_BSPC}, + {KC_BSLS, KC_LPRN, KC_1, KC_RPRN, KC_HASH, _______, KC_DLR, KC_LT, KC_0, KC_GT, KC_PIPE}, + {KC_5, KC_4, KC_3, KC_2, KC_LCTL, _______, KC_RALT, KC_9, KC_8, KC_7, KC_6} + }, + /* Raise + * ,---------------------------------------------------------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | + * |---------------------------------------------------------------------------------------| + * | F11 | F12 | ! | - | + | | = | ; | ) | ` | ? | + * |------------------------------- -------------------------------------------------------| + * | % | $ | # | @ | | | | ( | * | & | ^ | + * |---------------------------------------------------------------------------------------| + */ + [_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_EXLM, KC_MINS, KC_PLUS, _______, KC_EQL, KC_SCLN, KC_RPRN, KC_GRV, KC_QUES}, + {KC_PERC, KC_DLR, KC_HASH, KC_AT, _______, _______, _______, KC_LPRN, KC_ASTR, KC_AMPR, KC_CIRC} + }, + /* Union + * ,---------------------------------------------------------------------------------------. + * | RESET | | | | | | | | | | Del | + * |---------------------------------------------------------------------------------------| + * | | | | | | | | | | | | + * |---------------------------------------------------------------------------------------| + * | | | | | | | | | | | | + * |---------------------------------------------------------------------------------------| + */ + [_UNION] ={ + {RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} + } +}; + +void matrix_init_user(void) { +} + +void matrix_scan_user(void) { +} + +//planck like tri layer +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case BEAKL: + if (record->event.pressed) { + set_single_persistent_default_layer(_BEAKL); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _UNION); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _UNION); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _UNION); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _UNION); + } + return false; + break; + } + return true; +} + +void led_set_user(uint8_t usb_led) { + + if (usb_led & (1 << USB_LED_NUM_LOCK)) { + + } else { + + } + + if (usb_led & (1 << USB_LED_CAPS_LOCK)) { + + } else { + + } + + if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { + + } else { + + } + + if (usb_led & (1 << USB_LED_COMPOSE)) { + + } else { + + } + + if (usb_led & (1 << USB_LED_KANA)) { + + } else { + + } + +} diff --git a/keyboards/miuni32/keymaps/ki/readme.md b/keyboards/miuni32/keymaps/ki/readme.md new file mode 100644 index 00000000..7615d1c6 --- /dev/null +++ b/keyboards/miuni32/keymaps/ki/readme.md @@ -0,0 +1,4 @@ +# A BEAKL9-ish keymap for miuni32 +A major WIP +Using planck like tri layer switching with a single center control column +No mousekey support diff --git a/keyboards/miuni32/keymaps/ki/rules.mk b/keyboards/miuni32/keymaps/ki/rules.mk new file mode 100644 index 00000000..8a72a6e4 --- /dev/null +++ b/keyboards/miuni32/keymaps/ki/rules.mk @@ -0,0 +1,21 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif From 9303b42e690f5668e29b874d88e2bb3564bd93a2 Mon Sep 17 00:00:00 2001 From: Kenneth Aloysius Date: Fri, 2 Feb 2018 17:30:47 +1100 Subject: [PATCH 045/173] Update personal layouts, free up matrix_scan_user for JJ40 (#2319) * Add NIU Mini keymap from Planck keymap * Remove old keymap files * Fix README, removed Planck references * Add default layout, move Planck layout to separate folder * Update README * Add my XD60 keymap * Change RShift to slash * Fix keymap: stuck on MO(1) * Move RESET to Fn+Enter * Add: RGB saturation cycle * Add numpad layer to keymap * Fix last case * Cleanup Mechmini keymap. Once the custom RGB function is defined, there is no need to manually handle RGB code. * Change default to KEYMAP_MIT, not KEYMAP_OFFSET * Add custom RGB code for JJ40 * Reset Mechmini advertised power draw to 500. Will have to test actual maximum power draw later. * RGB working on JJ40. * Fix: saturation increase/decrease flipped * Add new directory for my custom keymap with RGB keycodes * Swap LAlt and LGUI * Update JJ40 max power draw with measured value * Update: fun40 rules.mk to enable underglow; earlier failed Travis CI * Fix: init RGB LEDs on boot. Also added HHKB-like keymap for XD60. * Super rudimentary backlight test, init RGB LEDs on boot * Backlighting works - stays on for now * Toggling working * Now can override backlight.c functions. Problem was functions in backlight.c weren't called before due to a lack of matrix_scan_quantum() in matrix.c * Timers not working * Delete global.h * Cleanup * Compiles * Good sign: LEDs stop working again * Handle timer1 overflow * Progress: fix: forgot to init * Backlighting fully working now except breathing. * Revert keymap to original keycodes * Update XD60 keymap README * Update JJ40 keymap with backlight toggles * Breathing working just fine. * Update references * Add backlight_set() call * Cleanup code to disable backlight * Fix: does not compile * Fix: missing call to rgblight_task. * Testing with BACKLIGHT_BREATHING * Cleanup * Cleanup comments * More commenting cleanup. * Do not enable BACKLIGHT_BREATHING by default * Update XD60 keymap * Update: move matrix_scan_kb out from matrix.c to jj40.c (kb-level) * Cleanup for PR * Fix conflict in readme.md for NIU mini * Restore original power consumption figure * Fix: matrix_scan_user() now has to be defined in the keymaps * Add weak `matrix_scan_user` so it does not have to be defined in keymap * Add weak matrix_init_user() --- keyboards/jj40/jj40.c | 18 ++++++++++++++++-- keyboards/jj40/keymaps/default/keymap.c | 5 +++++ keyboards/jj40/keymaps/fun40/keymap.c | 7 ++++++- keyboards/jj40/keymaps/krusli/config.h | 1 + keyboards/jj40/keymaps/krusli/keymap.c | 20 ++++++++++++++++---- keyboards/jj40/keymaps/krusli/rules.mk | 1 + keyboards/jj40/keymaps/oscillope/keymap.c | 6 ++++++ keyboards/jj40/matrix.c | 6 ------ keyboards/jj40/rules.mk | 1 - keyboards/niu_mini/keymaps/default/keymap.c | 0 keyboards/niu_mini/keymaps/readme.md | 2 +- keyboards/xd60/keymaps/krusli/readme.md | 9 +++++++-- tmk_core/protocol/lufa/descriptor.c | 2 +- 13 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 keyboards/jj40/keymaps/krusli/rules.mk mode change 100755 => 100644 keyboards/niu_mini/keymaps/default/keymap.c diff --git a/keyboards/jj40/jj40.c b/keyboards/jj40/jj40.c index 9c1775d6..4affe199 100644 --- a/keyboards/jj40/jj40.c +++ b/keyboards/jj40/jj40.c @@ -34,7 +34,7 @@ extern rgblight_config_t rgblight_config; // @Override void matrix_init_kb(void) { // call user level keymaps, if any - // matrix_init_user(); + matrix_init_user(); } #ifdef BACKLIGHT_ENABLE @@ -67,7 +67,8 @@ void rgblight_set(void) { } bool rgb_init = false; -void matrix_scan_user(void) { + +void matrix_scan_kb(void) { // if LEDs were previously on before poweroff, turn them back on if (rgb_init == false && rgblight_config.enable) { i2c_init(); @@ -76,5 +77,18 @@ void matrix_scan_user(void) { } rgblight_task(); + + matrix_scan_user(); /* Nothing else for now. */ } + +__attribute__((weak)) // overridable +void matrix_init_user(void) { + +} + + +__attribute__((weak)) // overridable +void matrix_scan_user(void) { + +} diff --git a/keyboards/jj40/keymaps/default/keymap.c b/keyboards/jj40/keymaps/default/keymap.c index e02dd902..70c73c96 100644 --- a/keyboards/jj40/keymaps/default/keymap.c +++ b/keyboards/jj40/keymaps/default/keymap.c @@ -66,3 +66,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ ) }; + +// Loop +void matrix_scan_user(void) { + // Empty +}; diff --git a/keyboards/jj40/keymaps/fun40/keymap.c b/keyboards/jj40/keymaps/fun40/keymap.c index f5641e29..d6fcfe7c 100644 --- a/keyboards/jj40/keymaps/fun40/keymap.c +++ b/keyboards/jj40/keymaps/fun40/keymap.c @@ -42,7 +42,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ,-----------------------------------------------------------------------------------. * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | ! | @ | # | $ | % | ^ | & | * | ( | ) | | | + * | ! | @ | # | $ | % | ^ | & | * | ( | ) | | | * |------+------+------+------+------+-------------+------+------+------+------+------| * | Shift|PrScr |ISO ~ |ISO | | | | | | |bl_on |bl_stp| Enter| * |------+------+------+------+------+------+------+------+------+------+------+------| @@ -121,3 +121,8 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) } return MACRO_NONE; }; + +// Loop +void matrix_scan_user(void) { + // Empty +}; diff --git a/keyboards/jj40/keymaps/krusli/config.h b/keyboards/jj40/keymaps/krusli/config.h index 11cafbef..52aaa8f2 100644 --- a/keyboards/jj40/keymaps/krusli/config.h +++ b/keyboards/jj40/keymaps/krusli/config.h @@ -4,5 +4,6 @@ #include "../../config.h" #define PREVENT_STUCK_MODIFIERS +#define TAPPING_TERM 300 #endif diff --git a/keyboards/jj40/keymaps/krusli/keymap.c b/keyboards/jj40/keymaps/krusli/keymap.c index 5a985199..df692cc4 100644 --- a/keyboards/jj40/keymaps/krusli/keymap.c +++ b/keyboards/jj40/keymaps/krusli/keymap.c @@ -11,6 +11,18 @@ enum custom_keycodes { RAISE, }; +void matrix_scan_user(void) { + // runs at every matrix scan. +} + +enum { + TD_H_E = 0 +}; + +qk_tap_dance_action_t tap_dance_actions[] = { + [TD_H_E] = ACTION_TAP_DANCE_DOUBLE(KC_HOME, KC_END) +}; + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Qwerty * ,-----------------------------------------------------------------------------------. @@ -24,10 +36,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_QWERTY] = KEYMAP( \ - 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 , \ - _______, KC_LCTL, KC_LGUI, KC_LALT, MO(_LOWER), KC_SPC, MO(_RAISE), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + 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 , \ + TD(TD_H_E), KC_LCTL, KC_LGUI, KC_LALT, MO(_LOWER), KC_SPC, MO(_RAISE), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ ), /* Lower diff --git a/keyboards/jj40/keymaps/krusli/rules.mk b/keyboards/jj40/keymaps/krusli/rules.mk new file mode 100644 index 00000000..e5ddcae8 --- /dev/null +++ b/keyboards/jj40/keymaps/krusli/rules.mk @@ -0,0 +1 @@ +TAP_DANCE_ENABLE = yes diff --git a/keyboards/jj40/keymaps/oscillope/keymap.c b/keyboards/jj40/keymaps/oscillope/keymap.c index 2eaecd7e..5d2f400a 100644 --- a/keyboards/jj40/keymaps/oscillope/keymap.c +++ b/keyboards/jj40/keymaps/oscillope/keymap.c @@ -107,3 +107,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } + + +// Loop +void matrix_scan_user(void) { + // Empty +}; diff --git a/keyboards/jj40/matrix.c b/keyboards/jj40/matrix.c index a9e9cb53..2932976d 100644 --- a/keyboards/jj40/matrix.c +++ b/keyboards/jj40/matrix.c @@ -91,12 +91,6 @@ uint8_t matrix_scan(void) { return 1; } -void matrix_scan_kb(void) { - // Looping keyboard code goes here - // This runs every cycle (a lot) - matrix_scan_user(); -}; - // declarations void matrix_set_row_status(uint8_t row) { DDRB = (1 << row); diff --git a/keyboards/jj40/rules.mk b/keyboards/jj40/rules.mk index 670967fb..42b3d115 100644 --- a/keyboards/jj40/rules.mk +++ b/keyboards/jj40/rules.mk @@ -42,7 +42,6 @@ BACKLIGHT_CUSTOM_DRIVER = yes RGBLIGHT_ENABLE = yes RGBLIGHT_CUSTOM_DRIVER = yes -# DISABLE_WS2812 = no KEY_LOCK_ENABLE = yes diff --git a/keyboards/niu_mini/keymaps/default/keymap.c b/keyboards/niu_mini/keymaps/default/keymap.c old mode 100755 new mode 100644 diff --git a/keyboards/niu_mini/keymaps/readme.md b/keyboards/niu_mini/keymaps/readme.md index 804a657e..d4c2bbc8 100644 --- a/keyboards/niu_mini/keymaps/readme.md +++ b/keyboards/niu_mini/keymaps/readme.md @@ -18,6 +18,6 @@ When adding your keymap to this list, keep it organised alphabetically (select l * **folder_name** description # List of keymaps - - **default** default layout from KBDFans +- **mason** - **planck** Planck default layout diff --git a/keyboards/xd60/keymaps/krusli/readme.md b/keyboards/xd60/keymaps/krusli/readme.md index 7b6bce9c..aefb23cc 100644 --- a/keyboards/xd60/keymaps/krusli/readme.md +++ b/keyboards/xd60/keymaps/krusli/readme.md @@ -1,2 +1,7 @@ -# krusli's HHKB-style keymap for the XD60 -HHKB-style keymap for the XD60. The board was not built with split backspace but still has Backspace and |\\ swapped. +# krusli's Keymap for XIUDI's 60% XD60 PCB + +## Additional Notes +Keymap for the XD60 with 2.25u left shift and split backspace. HHKB-like function layer. + +## Build +To build this keymap, simply run `make xd60:krusli` on the top-level directory for QMK. diff --git a/tmk_core/protocol/lufa/descriptor.c b/tmk_core/protocol/lufa/descriptor.c index e9f7f873..bfa91f25 100644 --- a/tmk_core/protocol/lufa/descriptor.c +++ b/tmk_core/protocol/lufa/descriptor.c @@ -1,4 +1,4 @@ -/* +/* * Copyright 2012 Jun Wako * This file is based on: * LUFA-120219/Demos/Device/Lowlevel/KeyboardMouse From e9944bfc8e89dc772fa04be90638cab1e722ece1 Mon Sep 17 00:00:00 2001 From: HagVcom Date: Fri, 2 Feb 2018 07:50:22 +0100 Subject: [PATCH 046/173] Added "hag" keymap to Iris (#2313) * Create keymap.c Add Hag keymap, a heavily modified dvorak swedish keymap with multiple layouts and often used stuff under the alpha cluster. * Create config.h * Create rules.mk --- keyboards/iris/keymaps/hag/config.h | 41 ++++ keyboards/iris/keymaps/hag/keymap.c | 297 ++++++++++++++++++++++++++++ keyboards/iris/keymaps/hag/rules.mk | 6 + 3 files changed, 344 insertions(+) create mode 100644 keyboards/iris/keymaps/hag/config.h create mode 100644 keyboards/iris/keymaps/hag/keymap.c create mode 100644 keyboards/iris/keymaps/hag/rules.mk diff --git a/keyboards/iris/keymaps/hag/config.h b/keyboards/iris/keymaps/hag/config.h new file mode 100644 index 00000000..c4604af4 --- /dev/null +++ b/keyboards/iris/keymaps/hag/config.h @@ -0,0 +1,41 @@ +/* +Copyright 2017 Danny Nguyen + +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 CONFIG_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +// #define USE_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define MASTER_RIGHT +// #define EE_HANDS + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 12 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +#endif diff --git a/keyboards/iris/keymaps/hag/keymap.c b/keyboards/iris/keymaps/hag/keymap.c new file mode 100644 index 00000000..3aac1394 --- /dev/null +++ b/keyboards/iris/keymaps/hag/keymap.c @@ -0,0 +1,297 @@ +#include "iris.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + + +//Heavily modified keymap. Some features: +//Multiple layouts, I use dvorak as main. +//Nordic(swedish) signs +//Symbols, numpad, arrows/navigation reachable under the alpas via the layers +//Mirrored ctl, alt and shift to be able to use both hands when doing commands +//Gaming layer, qwerty with space on left half. + +#define _QWERTY 2 +#define _DVORAK 0 +#define _COLEMAK 1 +#define _WORKMAN 3 +#define _GAMING 4 +#define _NUMPAD 5 +#define _LOWER 6 +#define _RAISE 7 + +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + DVORAK, + COLEMAK, + WORKMAN, + GAMING, + NUMPAD, + LOWER, + RAISE, + ADJUST, +}; + +#define KC_ KC_TRNS +#define _______ KC_TRNS +#define KC_XXXX KC_NO + +#define KC_Sw2 RALT(KC_2) // Nordic @ +#define KC_Sw3 RALT(KC_3) // Nordic something +#define KC_Sw4 RALT(KC_4) // Nordic something +#define KC_Sw5 RALT(KC_5) // Nordic something +#define KC_Sw6 RALT(KC_6) // ... +#define KC_Sw7 RALT(KC_7) +#define KC_Sw8 RALT(KC_8) +#define KC_Sw9 RALT(KC_9) +#define KC_Sw0 RALT(KC_0) +#define KC_Tild RALT(KC_RBRC) +#define KC_Bsls RALT(KC_MINS) +#define KC_Bar RALT(KC_NUBS) +#define KC_Less S(KC_NUBS) +#define KC_CATDEL LCTL(LALT(KC_DEL)) // Ctrl alt del +#define KC_TSKMGR LCTL(S(KC_ESC)) // Ctrl shift esc +#define KC_NUMP TG(_NUMPAD) // Toggle layer NUMPAD for use in KC_keymaps +#define KC_Close RALT(KC_F4) // Alt F4 +#define KC_Great S(KC_NUBS) +#define KC_MEH1 MEH(KC_1) +#define KC_MEH2 MEH(KC_2) +#define KC_MEH3 MEH(KC_3) +#define KC_MEH4 MEH(KC_4) +#define KC_MEH5 MEH(KC_5) + +#define KC_LOWR LOWER +#define KC_RASE RAISE +#define KC_RST RESET +#define KC_BL_S BL_STEP + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + DEL ,APP, VOLD,MUTE,VOLU,LGUI, RGUI,MPRV,MPLY,MNXT,DOWN,ESC , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + TAB , Q , W , E , R , T , Y , U , I , O , P ,LBRC, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + LCTL, A , S , D , F , G , H , J , K , L ,SCLN,QUOT, + //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| + LSFT, Z , X , C , V , B ,NUMP, ENT , N , M ,COMM,DOT ,SLSH,RSFT, + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + LALT,LOWR,BSPC, SPC ,RASE,LALT + // `----+----+----' `----+----+----' + ), + + [_GAMING] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + ESC , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,ESC , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + TAB , Q , W , E , R , T , Y , U , I , O , P ,DEL, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + LCTL, A , S , D , F , G , H , J , K , L ,SCLN,RCTL, + //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| + LSFT, Z , X , C , V , B , Y , ENT , N , M ,COMM,DOT ,SLSH,RSFT, + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + LALT,LOWR,SPC, BSPC ,RASE,LALT + // `----+----+----' `----+----+----' + ), + + [_DVORAK] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + DEL ,APP ,VOLD,MUTE,VOLU,LGUI, RGUI,MPRV,MPLY,MNXT,DOWN,ESC , + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + TAB ,LBRC,QUOT,SCLN, P , Y , F , G , C , R , L ,DEL, + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + LCTL, A , O , E , U , I , D , H , T , N , S ,RCTL, + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + LSFT,DOT , Q , J , K , X ,NUMP, ENT , B , M , W , V , Z ,RSFT, + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + LALT,LOWR,BSPC, SPC ,RASE,LALT + // `----+----+----' `----+----+----' + ), + + [_COLEMAK] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + DEL ,APP, VOLD,MUTE,VOLU,LGUI, RGUI,MPRV,MPLY,MNXT,DOWN,ESC , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + TAB , Q , W , F , P , G , J , L , U , Y ,LBRC,QUOT, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + LCTL, A , R , S , T , D , H , N , E , I , O ,SCLN, + //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| + LSFT, Z , X , C , V , B ,NUMP, ENT , K , M ,COMM, DOT,SLSH,RSFT, + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + LALT,LOWR,BSPC, SPC ,RASE,LALT + // `----+----+----' `----+----+----' + ), + +[_WORKMAN] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + DEL ,APP, VOLD,MUTE,VOLU,LGUI, RGUI,MPRV,MPLY,MNXT,DOWN,ESC , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + TAB , Q , W , R , W , B , J , F , U , P ,LBRC,SCLN, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + LCTL, A , S , H , T , G , Y , N , E , O , I ,RCTL, + //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| + LSFT, Z , X , M , C , V ,NUMP, ENT , K , L ,QUOT, DOT,SLSH,RSFT, + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + LALT,LOWR,BSPC, SPC ,RASE,LALT + // `----+----+----' `----+----+----' + ), + + [_NUMPAD] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 ,F12 , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + ,MEH1,BTN2,MS_U,BTN1,CATDEL, PIPE, P7 , P8 , P9 ,SLSH, , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + ,MEH4,MS_L,MS_D,MS_R,TSKMGR, COMM, P4 , P5 , P6 ,MINS, , + //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| + ,MEH5,ACL0,ACL1,ACL2,MEH3, , PENT,DOT , P1 , P2 , P3 , P0 , , + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + LALT,LOWR,BSPC, , P0 ,NLCK + // `----+----+----' `----+----+----' + ), + + + [_LOWER] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 ,F12 , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + ,CAPS,PGUP, UP ,PGDN, ESC, RCBR,EXLM,ASTR,LPRN,UNDS, , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + ,HOME,LEFT,DOWN,RGHT, END, RPRN,QUES,Sw8 ,Sw9 ,LABK, , + //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| + , ENT, , , , DEL, , ,RABK,NUBS,Sw7 ,Sw0 ,Great, , + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + , , , , , + // `----+----+----' `----+----+----' + ), + + [_RAISE] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + TILD,EXLM,GRV ,EQL, DLR ,PERC, Sw3 ,Sw5 ,Sw6 ,Sw0 ,RPRN, , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + ,Bar ,Sw2 ,HASH, AT ,PERC, PIPE, 7 , 8 , 9 ,PMNS,PSLS, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + ,Bsls,Tild,SLSH,AMPR,BSLS, COMM, 4 , 5 , 6 ,PPLS,PAST, + //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| + ,PIPE,Sw4 ,PLUS,CIRC,TILD, , PENT,DOT , 1 , 2 , 3 , 0 ,PEQL, + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + , ,DEL , , , + // `----+----+----' `----+----+----' + ), + + [_ADJUST] = KEYMAP( + //,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------. + GAMING , DVORAK, WORKMAN, COLEMAK, QWERTY , KC_RST, _______, _______, _______, _______, KC_PWR, RESET, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + _______, _______, _______,LGUI(KC_UP),_______,LALT(KC_F4), _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + _______, _______,LGUI(KC_LEFT),LGUI(KC_DOWN),LGUI(KC_RGHT),_______, _______, DEBUG , RGB_HUD, RGB_SAD, RGB_VAD, BL_STEP, + //|--------+--------+--------+--------+--------+--------+--------. ,--------|--------+--------+--------+--------+--------+--------| + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + //`--------+--------+--------+----+---+--------+--------+--------/ \--------+--------+--------+---+----+--------+--------+--------' + _______, _______, _______, _______, _______, _______ + // `--------+--------+--------' `--------+--------+--------' + ) + +}; + +#ifdef AUDIO_ENABLE +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +#endif + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE +// PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_DVORAK); + } + return false; + break; + case NUMPAD: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE +// PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_NUMPAD); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE +// PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case WORKMAN: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE +// PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_WORKMAN); + } + return false; + break; + case GAMING: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE +// PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_GAMING); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + } + return true; +} diff --git a/keyboards/iris/keymaps/hag/rules.mk b/keyboards/iris/keymaps/hag/rules.mk new file mode 100644 index 00000000..22b6ec47 --- /dev/null +++ b/keyboards/iris/keymaps/hag/rules.mk @@ -0,0 +1,6 @@ +RGBLIGHT_ENABLE = yes +BACKLIGHT_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif From a6be48681a92cd47c63cbe763b723c13cc443399 Mon Sep 17 00:00:00 2001 From: Emily Soldal Date: Thu, 4 Jan 2018 19:20:40 +0100 Subject: [PATCH 047/173] Map num lock and caps lock LED events to the RXLED and TXLED --- keyboards/sweet16/keymaps/default/keymap.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/keyboards/sweet16/keymaps/default/keymap.c b/keyboards/sweet16/keymaps/default/keymap.c index c429d245..7fa86154 100644 --- a/keyboards/sweet16/keymaps/default/keymap.c +++ b/keyboards/sweet16/keymaps/default/keymap.c @@ -23,4 +23,21 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; } return true; -} \ No newline at end of file +} + +void led_set_user(uint8_t usb_led) { + + /* Map RXLED to USB_LED_NUM_LOCK */ + if (usb_led & (1 << USB_LED_NUM_LOCK)) { + DDRB |= (1 << 0); PORTB &= ~(1 << 0); + } else { + DDRB &= ~(1 << 0); PORTB &= ~(1 << 0); + } + + /* Map TXLED to USB_LED_CAPS_LOCK */ + if (usb_led & (1 << USB_LED_CAPS_LOCK)) { + DDRD |= (1 << 5); PORTD &= ~(1 << 5); + } else { + DDRD &= ~(1 << 5); PORTD &= ~(1 << 5); + } +} From e7bb9754823ae7a09f7ba3bf4ecd7b45663ae382 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sat, 3 Feb 2018 17:47:28 +0200 Subject: [PATCH 048/173] Fix .editorconfig to not mess with line endings --- .editorconfig | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 82837f7f..4cd051ce 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,7 +8,6 @@ indent_style = space indent_size = 2 # We recommend you to keep these unchanged -end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true @@ -16,3 +15,22 @@ insert_final_newline = true [*.md] trim_trailing_whitespace = false indent_size = 4 + +# Make these match what we have in .gitattributes +[*.mk] +end_of_line = lf + +[Makefile] +end_of_line = lf + +[*.sh] +end_of_line = lf + +# The gitattributes file will handle the line endings conversion properly according to the operating system settings for other files + + +# We don't have gitattributes properly for these +# So if the user have for example core.autocrlf set to true +# the line endings would be wrong. +[lib/**] +end_of_line = unset From 8350d7e607704d6736271256f20640e8f3deae75 Mon Sep 17 00:00:00 2001 From: yiancar Date: Sat, 3 Feb 2018 20:21:24 +0000 Subject: [PATCH 049/173] Cu24 keyboard addition (#2330) * Added Modular keyboards L,R and NUM Created code modules for the 3 modules of the modular keyboard. Original idea by MechboardsUK. Uses i2c implementation similar to lets split * CU24 Support Addes Support for the upcoming CU24 keyboard sold by CapsUnlocked * Removed modular keyboards to make stuff clear * Lower Case folders * Remove CU24 - Rename Folder * Add CU24 - Renamed * Fixed ignore list I am stupid --- .gitignore | 2 +- keyboards/cu24/config.h | 192 +++++++++++++++++++++++ keyboards/cu24/cu24.c | 16 ++ keyboards/cu24/cu24.h | 42 +++++ keyboards/cu24/keymaps/default/keymap.c | 56 +++++++ keyboards/cu24/keymaps/default/readme.md | 10 ++ keyboards/cu24/readme.md | 15 ++ keyboards/cu24/rules.mk | 69 ++++++++ 8 files changed, 401 insertions(+), 1 deletion(-) create mode 100644 keyboards/cu24/config.h create mode 100644 keyboards/cu24/cu24.c create mode 100644 keyboards/cu24/cu24.h create mode 100644 keyboards/cu24/keymaps/default/keymap.c create mode 100644 keyboards/cu24/keymaps/default/readme.md create mode 100644 keyboards/cu24/readme.md create mode 100644 keyboards/cu24/rules.mk diff --git a/.gitignore b/.gitignore index 90f29a29..226f1186 100644 --- a/.gitignore +++ b/.gitignore @@ -64,4 +64,4 @@ util/Win_Check_Output.txt # things travis sees secrets.tar id_rsa_* -/.vs +/.vs \ No newline at end of file diff --git a/keyboards/cu24/config.h b/keyboards/cu24/config.h new file mode 100644 index 00000000..df009c95 --- /dev/null +++ b/keyboards/cu24/config.h @@ -0,0 +1,192 @@ +/* Copyright 2018 Yiancar + * + * 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 CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x0000 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Yiancar/CapsUnlocked +#define PRODUCT CU24 +#define DESCRIPTION A luxurious fully customisable numpad + +/* key matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 4 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ +#define MATRIX_ROW_PINS { E6, F5, B4, B6, C6, C7 } +#define MATRIX_COL_PINS { F0, F1, D0, D1 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ +#define DIODE_DIRECTION ROW2COL + +/* Backlight */ +#define BACKLIGHT_PIN B5 +#define BACKLIGHT_BREATHING +#define BACKLIGHT_LEVELS 5 + +/* RGB Glow */ +#define RGB_DI_PIN F4 // The pin the LED strip is connected to +#define RGBLED_NUM 5 // Number of LEDs in your strip +#define RGBLIGHT_ANIMATIONS + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. + * This is userful for the Windows task manager shortcut (ctrl+shift+esc). + */ +// #define GRAVE_ESC_CTRL_OVERRIDE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Magic Key Options + * + * Magic keys are hotkey commands that allow control over firmware functions of + * the keyboard. They are best used in combination with the HID Listen program, + * found here: https://www.pjrc.com/teensy/hid_listen.html + * + * The options below allow the magic key functionality to be changed. This is + * useful if your keyboard/keypad is missing keys and you want magic key support. + * + */ + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* control how magic key switches layers */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false + +/* override magic key keymap */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM +//#define MAGIC_KEY_HELP1 H +//#define MAGIC_KEY_HELP2 SLASH +//#define MAGIC_KEY_DEBUG D +//#define MAGIC_KEY_DEBUG_MATRIX X +//#define MAGIC_KEY_DEBUG_KBD K +//#define MAGIC_KEY_DEBUG_MOUSE M +//#define MAGIC_KEY_VERSION V +//#define MAGIC_KEY_STATUS S +//#define MAGIC_KEY_CONSOLE C +//#define MAGIC_KEY_LAYER0_ALT1 ESC +//#define MAGIC_KEY_LAYER0_ALT2 GRAVE +//#define MAGIC_KEY_LAYER0 0 +//#define MAGIC_KEY_LAYER1 1 +//#define MAGIC_KEY_LAYER2 2 +//#define MAGIC_KEY_LAYER3 3 +//#define MAGIC_KEY_LAYER4 4 +//#define MAGIC_KEY_LAYER5 5 +//#define MAGIC_KEY_LAYER6 6 +//#define MAGIC_KEY_LAYER7 7 +//#define MAGIC_KEY_LAYER8 8 +//#define MAGIC_KEY_LAYER9 9 +//#define MAGIC_KEY_BOOTLOADER PAUSE +//#define MAGIC_KEY_LOCK CAPS +//#define MAGIC_KEY_EEPROM E +//#define MAGIC_KEY_NKRO N +//#define MAGIC_KEY_SLEEP_LED Z + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ +//#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 1 + +#endif diff --git a/keyboards/cu24/cu24.c b/keyboards/cu24/cu24.c new file mode 100644 index 00000000..0c976f07 --- /dev/null +++ b/keyboards/cu24/cu24.c @@ -0,0 +1,16 @@ +/* Copyright 2018 Yiancar + * + * 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 "cu24.h" diff --git a/keyboards/cu24/cu24.h b/keyboards/cu24/cu24.h new file mode 100644 index 00000000..e8e6b46e --- /dev/null +++ b/keyboards/cu24/cu24.h @@ -0,0 +1,42 @@ +/* Copyright 2018 Yiancar + * + * 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 CU24_H +#define CU24_H + +#include "quantum.h" + +// This a shortcut to help you visually see your layout. +// The following is an example using the Planck MIT layout +// The first section contains all of the arguments +// The second converts the arguments into a two-dimensional array +#define KEYMAP( \ + k00, k01, k02, k03, \ + k10, k11, k12, k13, \ + k20, k21, k22, k23, \ + k30, k31, k32, k33, \ + k40, k41, k42, k43, \ + k50, k51, k52, k53 \ +) \ +{ \ + { k00, k01, k02, k03 }, \ + { k10, k11, k12, k13 }, \ + { k20, k21, k22, k23 }, \ + { k30, k31, k32, k33 }, \ + { k40, k41, k42, k43 }, \ + { k50, k51, k52, k53 } \ +} + +#endif diff --git a/keyboards/cu24/keymaps/default/keymap.c b/keyboards/cu24/keymaps/default/keymap.c new file mode 100644 index 00000000..8e2f6563 --- /dev/null +++ b/keyboards/cu24/keymaps/default/keymap.c @@ -0,0 +1,56 @@ +/* Copyright 2018 Yiancar + * + * 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 "cu24.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = KEYMAP( /* Base */ + KC_MPLY, KC_MUTE, KC_VOLD, KC_VOLU, \ + MO(1) , KC_PSLS, KC_PAST, KC_PMNS, \ + KC_P7 , KC_P8 , KC_P9 , KC_PPLS, \ + KC_P4 , KC_P5 , KC_P6 , KC_PPLS, \ + KC_P1 , KC_P2 , KC_P3 , KC_PENT, \ + KC_P0 , KC_P0 , KC_PDOT, KC_PENT +), + +[1] = KEYMAP( /* FN */ + RGB_TOG, RGB_MOD, BL_STEP, BL_BRTG, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + RGB_HUI, RGB_SAI, RGB_VAI, KC_TRNS, \ + RGB_HUD, RGB_SAD, RGB_VAD, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, RESET , KC_TRNS +), +}; + +/* Use this function to add macros */ +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); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/cu24/keymaps/default/readme.md b/keyboards/cu24/keymaps/default/readme.md new file mode 100644 index 00000000..5528d6c0 --- /dev/null +++ b/keyboards/cu24/keymaps/default/readme.md @@ -0,0 +1,10 @@ +https://imgur.com/a/vpHFj + +![CU24 Layout Image](https://imgur.com/X1c1qeY) + +# Default CU24 Layout + +This is the default layout that comes flashed on every CU24. It is like a normal numpad, +with all the led customization on the Fn layer. + +See [All Layouts](https://imgur.com/trwO7dN) for all supported configurations! \ No newline at end of file diff --git a/keyboards/cu24/readme.md b/keyboards/cu24/readme.md new file mode 100644 index 00000000..a017cd66 --- /dev/null +++ b/keyboards/cu24/readme.md @@ -0,0 +1,15 @@ +# CU24 + +![CU24](https://geekhack.org/index.php?action=dlattach;topic=93289.0;attach=185492;image) + +A luxurious 24 key keypad with various layouts. Includes RGB underglow, backlight and an aluminium, brass and nylon case. + +Keyboard Maintainer: [Yiancar](https://github.com/yiancar) +Hardware Supported: PCB v1.0 (uses a 32u4) +Hardware Availability: http://caps-unlocked.com/ + +Make example for this keyboard (after setting up your build environment): + + make CU24:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. diff --git a/keyboards/cu24/rules.mk b/keyboards/cu24/rules.mk new file mode 100644 index 00000000..86f1a847 --- /dev/null +++ b/keyboards/cu24/rules.mk @@ -0,0 +1,69 @@ +# MCU name +#MCU = at90usb1286 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default +MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 +FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches +RGBLIGHT_ENABLE = yes # RGB drivers From 2f65ab183d8f820d5814482fcc9f58fa304b5d47 Mon Sep 17 00:00:00 2001 From: jirgn Date: Sat, 3 Feb 2018 21:22:00 +0100 Subject: [PATCH 050/173] just a planck layout (#2320) * added jirgn keymap from dotfiles * added jirgn s keymap as copy from default * [TASK] removed unnecessary colemak and dvorak layouts * [TASK] added right shift with tab to enter * [TASK] added ctrl keys beside homerow * [TASK] added Navigation Layer removed unnecessary BACKLIT removed Media Controls in Base Layers * [TASK] added left Navigation mode fixed some doc * [Fix] locked navigation layer by adding a transparent key for nav_mod keys * [TASK] added some more symbols and removed lower F1-F12 keys * [TASK] added some README and a layout design * [FIX] forced for adding to repo * [FIX] forced for adding to repo * [FIX] problem with layerswitching and hanging ctrl * removed image from repo * removed github image link with permalink from layout designer * removed github image link with permalink from layout designer * replaced image with permalink to layout editor --- .gitignore | 1 + .../planck/keymaps/jirgn/assets/layout.json | 168 +++++++++++++ keyboards/planck/keymaps/jirgn/config.h | 42 ++++ keyboards/planck/keymaps/jirgn/keymap.c | 221 ++++++++++++++++++ keyboards/planck/keymaps/jirgn/readme.md | 5 + keyboards/planck/keymaps/jirgn/rules.mk | 3 + 6 files changed, 440 insertions(+) create mode 100644 keyboards/planck/keymaps/jirgn/assets/layout.json create mode 100644 keyboards/planck/keymaps/jirgn/config.h create mode 100644 keyboards/planck/keymaps/jirgn/keymap.c create mode 100644 keyboards/planck/keymaps/jirgn/readme.md create mode 100644 keyboards/planck/keymaps/jirgn/rules.mk diff --git a/.gitignore b/.gitignore index 226f1186..a8dd97ef 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,7 @@ util/Win_Check_Output.txt .vscode/last.sql .vscode/temp.sql .stfolder +.tags # ignore image files *.png diff --git a/keyboards/planck/keymaps/jirgn/assets/layout.json b/keyboards/planck/keymaps/jirgn/assets/layout.json new file mode 100644 index 00000000..d5fc6f26 --- /dev/null +++ b/keyboards/planck/keymaps/jirgn/assets/layout.json @@ -0,0 +1,168 @@ +[ + { + "switchMount": "cherry", + "switchBrand": "cherry", + "switchType": "MX1A-C1xx", + "pcb": true, + "css": ".keylabel2 {\n color: #61ba5d !important;\n}\n.keylabel6 {\n color: #fa7a5f !important;\n}\n.keylabel8 {\n color: #7ab7f7 !important;\n}\n.keylabel7 {\n color: #999 !important;\n}" + }, + [ + { + "fa": [ + 0, + 2, + 0, + 2 + ] + }, + "\n~\n\n`\n\n\n\n\n\nTab", + { + "sm": "cherry", + "sb": "cherry", + "st": "MX1A-C1xx" + }, + "\n!\n\n1\n\n\n\n\n\nQ", + { + "sm": "", + "sb": "", + "st": "" + }, + "\n@\n\n2\n\n\n\n\n\nW", + "\n#\n\n3\n\n\n\n\n\nE", + "\n$\n\n4\n\n\n\n\n\nR", + "\n%\n\n5\n\n\n\n\n\nT", + "\n^\n\n6\n\n\n\n\n\nY", + "\n&\n\n7\n\n\n\n\n\nU", + "\n*\n\n8\n\n\n\n\n\nI", + "\n(\n\n9\n\n\n\n\n\nO", + "\n)\n\n0\n\n\n\n\n\nP", + { + "a": 7 + }, + "" + ], + [ + { + "c": "#b8b8b8", + "a": 5 + }, + "\n\n\n\nCtrl\n\n", + { + "c": "#61ba5d", + "a": 4 + }, + "\n¡\n\nF1\nNav\n\n\n\n\nA", + { + "c": "#cccccc", + "fa": [ + 0, + 2, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + "\n™\nHome\nF2\n\n\n\n\n\nS", + "\n€\nPg Up\nF3\n\n\n\n\n\nD", + "\n¢\nPg Dn\nF4\n\n\n\n\n\nF", + "\n∞\nEnd\nF5\n\n\n\n\n\nG", + { + "fa": [ + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + "\n§\n←\nF6\n\n\n\n\n\nH", + "\n_\n↓\n-\n\n\n\n\n\nJ", + "\n+\n↑\n=\n\n\n\n\n\nK", + "\n{\n→\n[\n\n\n\n\n\nL", + { + "c": "#61ba5d", + "fa": [ + 0, + 2, + 2, + 2, + 0, + 0, + 0, + 2 + ] + }, + "\n}\n\n]\nNav\n\n\n:\n\n;", + { + "c": "#cccccc" + }, + "\n|\n\n\\\n\n\n\n\"\n\n'" + ], + [ + { + "c": "#b8b8b8", + "a": 7 + }, + "Shift", + { + "c": "#cccccc", + "a": 4 + }, + "\n\n\nF7\n\n\n\n\n\nZ", + "\n\n\nF8\n\n\n\n\n\nX", + "\n\n\nF9\n\n\n\n\n\nC", + "\n\n\nF10\n\n\n\n\n\nV", + "\n\n\nF11\n\n\n\n\n\nB", + "\n\n\nF12\n\n\n\n\n\nN", + "\n~\n\n#\n\n\n\n\n\nM", + "\n|\n\n/\n\n\n\n<\n\n,", + { + "a": 6 + }, + "\n\n>\n\n\n\n\n\n.", + "\n\n?\n\n\n\n\n\n/", + { + "c": "#b8b8b8", + "a": 7 + }, + "\n\n\n\nShift" + ], + [ + "", + "Hyper", + "", + "", + { + "c": "#fa7a5f" + }, + "⇓", + { + "c": "#cccccc", + "w": 2 + }, + "", + { + "c": "#7ab7f7" + }, + "⇑", + { + "c": "#b8b8b8" + }, + "", + "", + "Hyper", + "" + ] +] \ No newline at end of file diff --git a/keyboards/planck/keymaps/jirgn/config.h b/keyboards/planck/keymaps/jirgn/config.h new file mode 100644 index 00000000..b406e2fe --- /dev/null +++ b/keyboards/planck/keymaps/jirgn/config.h @@ -0,0 +1,42 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#ifdef AUDIO_ENABLE + #define STARTUP_SONG SONG(PLANCK_SOUND) + // #define STARTUP_SONG SONG(NO_SOUND) + + #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ + SONG(COLEMAK_SOUND), \ + SONG(DVORAK_SOUND) \ + } +#endif + +#define MUSIC_MASK (keycode != KC_NO) + +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ + +#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 + +#endif \ No newline at end of file diff --git a/keyboards/planck/keymaps/jirgn/keymap.c b/keyboards/planck/keymaps/jirgn/keymap.c new file mode 100644 index 00000000..87a78d90 --- /dev/null +++ b/keyboards/planck/keymaps/jirgn/keymap.c @@ -0,0 +1,221 @@ +/* Copyright 2015-2017 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 "planck.h" +#include "action_layer.h" + +extern keymap_config_t keymap_config; + +enum planck_layers { + _QWERTY, + _LOWER, + _RAISE, + _PLOVER, + _ADJUST, + _NAVIGATION +}; + +enum planck_keycodes { + QWERTY = SAFE_RANGE, + PLOVER, + LOWER, + RAISE, + EXT_PLV +}; + +// keycode aliases +#define _______ KC_TRNS +#define ___x___ KC_NO +#define KC_EUR LALT(S(KC_2)) +#define KC_SEC LALT(KC_6) +#define CTL_DEL CTL_T(KC_DEL) +#define NAV_SCLN LT(_NAVIGATION, KC_SCLN) +#define NAV_A LT(_NAVIGATION, KC_A) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * Tab for Esc--| Ctrl | A Nav| S | D | F | G | H | J | K | L | ; Nav| Ctrl |--Tab for " + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / | Shift|--Tab for Enter + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | Hyper| Alt | Super| Lower| Space | Raise| Super| ALt | Hyper| | + * `-----------------------------------------------------------------------------------' + */ +[_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}, + {CTL_T(KC_ESC), NAV_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, NAV_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, SFT_T(KC_ENT)}, + {___x___, KC_HYPR, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LGUI, KC_LALT, KC_HYPR, ___x___} +}, + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * Tab to Del---| Ctrl | ¡ | ™ | € | ¢ | ∞ | § | _ | + | { | } | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | |ISO ~ |ISO | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = { + {KC_TILD, 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}, + {CTL_DEL, LALT(KC_1), LALT(KC_2), KC_EUR, LALT(KC_4), LALT(KC_5), LALT(KC_6), KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, + {_______, ___x___, ___x___, ___x___, ___x___, ___x___, ___x___, S(KC_NUHS), S(KC_NUBS), _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +}, + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * Tab to Del---| Ctrl | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_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}, + {CTL_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +}, + +/* Navigation + * ,-----------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | HOME | PGUP | PGDN | END | LEFT | DOWN | UP | RIGHT| | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_NAVIGATION] = { + {___x___, ___x___, ___x___, ___x___, ___x___, ___x___, ___x___, ___x___, ___x___, ___x___, ___x___, ___x___}, + {_______, _______, KC_HOME, KC_PGUP, KC_PGDN, KC_END , KC_LEFT, KC_DOWN, KC_UP , KC_RIGHT, _______, ___x___}, + {_______, ___x___, ___x___, ___x___, ___x___, ___x___, ___x___, ___x___, ___x___, ___x___, ___x___, _______}, + {___x___, _______, _______, _______, ___x___, ___x___, ___x___, ___x___, _______, _______, _______, ___x___} +}, + +/* Plover layer (http://opensteno.org) + * ,-----------------------------------------------------------------------------------. + * | # | # | # | # | # | # | # | # | # | # | # | # | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | S | T | P | H | * | * | F | P | L | T | D | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | S | K | W | R | * | * | R | B | G | S | Z | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Exit | | | A | O | | E | U | | | | + * `-----------------------------------------------------------------------------------' + */ + +[_PLOVER] = { + {KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 }, + {___x___, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC}, + {___x___, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {EXT_PLV, ___x___, ___x___, KC_C, KC_V, ___x___, ___x___, KC_N, KC_M, ___x___, ___x___, ___x___} +}, + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | Reset| | | | | | | | | | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Plover| | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = { + {_______, RESET, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL }, + {_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, PLOVER, _______, _______, _______}, + {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +} + + +}; + +#ifdef AUDIO_ENABLE + float plover_song[][2] = SONG(PLOVER_SOUND); + float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +#endif + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + print("mode just switched to qwerty and this is a huge string\n"); + set_single_persistent_default_layer(_QWERTY); + } + return false; break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; break; + case PLOVER: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + stop_all_notes(); + PLAY_SONG(plover_song); + #endif + layer_off(_RAISE); + layer_off(_LOWER); + layer_off(_ADJUST); + layer_on(_PLOVER); + if (!eeconfig_is_enabled()) { + eeconfig_init(); + } + keymap_config.raw = eeconfig_read_keymap(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + } + return false; break; + case EXT_PLV: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(plover_gb_song); + #endif + layer_off(_PLOVER); + } + return false; break; + } + return true; +} diff --git a/keyboards/planck/keymaps/jirgn/readme.md b/keyboards/planck/keymaps/jirgn/readme.md new file mode 100644 index 00000000..afc93d45 --- /dev/null +++ b/keyboards/planck/keymaps/jirgn/readme.md @@ -0,0 +1,5 @@ +# Jirgns Planck Layout + +This layout was designed with [Layout Designer](http://www.keyboard-layout-editor.com/#/) + +[Permalink to Layout](http://www.keyboard-layout-editor.com/##@_switchMount=cherry&switchBrand=cherry&switchType=MX1A-C1xx&pcb:true&css=.keylabel2%20%7B%0A%20%20%20%20color%2F:%20%2361ba5d%20!important%2F%3B%0A%7D%0A.keylabel6%20%7B%0A%20%20%20%20color%2F:%20%23fa7a5f%20!important%2F%3B%0A%7D%0A.keylabel8%20%7B%0A%20%20%20%20color%2F:%20%237ab7f7%20!important%2F%3B%0A%7D%0A.keylabel7%20%7B%0A%20%20%20%20color%2F:%20%23999%20!important%2F%3B%0A%7D%3B&@_fa@:0&:2&:0&:2%3B%3B&=%0A~%0A%0A%60%0A%0A%0A%0A%0A%0ATab&_sm=cherry&sb=cherry&st=MX1A-C1xx%3B&=%0A!%0A%0A1%0A%0A%0A%0A%0A%0AQ&=%0A%2F@%0A%0A2%0A%0A%0A%0A%0A%0AW&=%0A%23%0A%0A3%0A%0A%0A%0A%0A%0AE&=%0A$%0A%0A4%0A%0A%0A%0A%0A%0AR&=%0A%25%0A%0A5%0A%0A%0A%0A%0A%0AT&=%0A%5E%0A%0A6%0A%0A%0A%0A%0A%0AY&=%0A%2F&%0A%0A7%0A%0A%0A%0A%0A%0AU&=%0A*%0A%0A8%0A%0A%0A%0A%0A%0AI&=%0A(%0A%0A9%0A%0A%0A%0A%0A%0AO&=%0A)%0A%0A0%0A%0A%0A%0A%0A%0AP&_a:7%3B&=%3Ci%20class%2F='mss%20mss-Unicode-BackSpace-DeleteLeft-Big-2'%3E%3C%2F%2Fi%3E%3B&@_c=%23b8b8b8&a:5%3B&=%0A%3Ci%20class%2F='mss%20mss-Unicode-DeleteRight-Big-2'%3E%3C%2F%2Fi%3E%0A%0A%0ACtrl%0A%0A%3Ci%20class%2F='mss%20mss-Unicode-Escape-3'%3E%3C%2F%2Fi%3E&_c=%2361ba5d&a:4%3B&=%0A¡%0A%0AF1%0ANav%0A%0A%0A%0A%0AA&_c=%23cccccc&fa@:0&:2&:1&:2%3B%3B&=%0A™%0AHome%0AF2%0A%0A%0A%0A%0A%0AS&=%0A€%0APg%20Up%0AF3%0A%0A%0A%0A%0A%0AD&=%0A¢%0APg%20Dn%0AF4%0A%0A%0A%0A%0A%0AF&=%0A∞%0AEnd%0AF5%0A%0A%0A%0A%0A%0AG&_f2:2%3B&=%0A§%0A←%0AF6%0A%0A%0A%0A%0A%0AH&_f2:2%3B&=%0A%2F_%0A↓%0A-%0A%0A%0A%0A%0A%0AJ&_f2:2%3B&=%0A+%0A↑%0A%2F=%0A%0A%0A%0A%0A%0AK&_f2:2%3B&=%0A%7B%0A→%0A%5B%0A%0A%0A%0A%0A%0AL&_c=%2361ba5d&fa@:0&:2&:2&:2&:0&:2&:2&:2%3B%3B&=%0A%7D%0A%0A%5D%0ANav%0A%0A%0A%2F:%0A%0A%2F%3B&_c=%23cccccc%3B&=%0A%7C%0A%0A%5C%0A%0A%0A%0A%22%0A%0A'%3B&@_c=%23b8b8b8&a:7%3B&=Shift&_c=%23cccccc&a:4%3B&=%0A%0A%0AF7%0A%0A%0A%0A%0A%0AZ&=%0A%0A%0AF8%0A%0A%0A%0A%0A%0AX&=%0A%0A%0AF9%0A%0A%0A%0A%0A%0AC&=%0A%0A%0AF10%0A%0A%0A%0A%0A%0AV&=%0A%0A%0AF11%0A%0A%0A%0A%0A%0AB&=%0A%0A%0AF12%0A%0A%0A%0A%0A%0AN&=%0A~%0A%0A%23%0A%0A%0A%0A%0A%0AM&=%0A%7C%0A%0A%2F%2F%0A%0A%0A%0A%3C%0A%0A,&_a:6%3B&=%0A%0A%3E%0A%0A%0A%0A%0A%0A.&=%0A%0A%3F%0A%0A%0A%0A%0A%0A%2F%2F&_c=%23b8b8b8&a:7%3B&=%3Ci%20class%2F='kb%20kb-Return-2'%3E%3C%2F%2Fi%3E%0A%0A%0A%0AShift%3B&@=&=Hyper&=%3Ci%20class%2F='mss%20mss-Unicode-Option-3'%3E%3C%2F%2Fi%3E&=%3Ci%20class%2F='mss%20mss-Unicode-Command-3'%3E%3C%2F%2Fi%3E&_c=%23fa7a5f%3B&=%2F&dArr%2F%3B&_c=%23cccccc&w:2%3B&=&_c=%237ab7f7%3B&=%2F&uArr%2F%3B&_c=%23b8b8b8%3B&=%3Ci%20class%2F='mss%20mss-Unicode-Command-3'%3E%3C%2F%2Fi%3E&=%3Ci%20class%2F='mss%20mss-Unicode-Option-3'%3E%3C%2F%2Fi%3E&=Hyper&=) diff --git a/keyboards/planck/keymaps/jirgn/rules.mk b/keyboards/planck/keymaps/jirgn/rules.mk new file mode 100644 index 00000000..457a3d01 --- /dev/null +++ b/keyboards/planck/keymaps/jirgn/rules.mk @@ -0,0 +1,3 @@ +ifndef QUANTUM_DIR + include ../../../../Makefile +endif From 31f52291911e0e2d4a3626ceb5fad52657bb495f Mon Sep 17 00:00:00 2001 From: f3d3 Date: Sat, 3 Feb 2018 21:22:30 +0100 Subject: [PATCH 051/173] Added dz60 custom layout (#2302) * Add files via upload * Update keymap.c * Delete keymap.c * Added dz60 banana-split layout * Added dz60 custom layout Added layout for dz60 with split spacebar, arrows and other customizations. --- keyboards/dz60/keymaps/f3d3/keymap.c | 85 ++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 keyboards/dz60/keymaps/f3d3/keymap.c diff --git a/keyboards/dz60/keymaps/f3d3/keymap.c b/keyboards/dz60/keymaps/f3d3/keymap.c new file mode 100644 index 00000000..aefa2703 --- /dev/null +++ b/keyboards/dz60/keymaps/f3d3/keymap.c @@ -0,0 +1,85 @@ +#include "dz60.h" + +#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Layer 0 +* ,-----------------------------------------------------------------------------------------. +* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | ` | Bck | +* |-----------------------------------------------------------------------------------------+ +* | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | +* |-----------------------------------------------------------------------------------------+ +* | Caps | A | S | D | F | G | H | J | K | L | ; | ' | Enter | +* |-----------------------------------------------------------------------------------------+ +* | Shift | Z | X | C | V | B | N | M | , | . | RSh | U | / | +* |-----------------------------------------------------------------------------------------+ +* | Ctrl | GUI | Alt | Space | Fn1 | Play | Pscr | Fn1 | Left |Rght |Down | +* `-----------------------------------------------------------------------------------------' +*/ + + KEYMAP_2_SHIFTS( + 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_GRV, KC_BSPC, + KC_TAB, 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, + KC_CAPS, 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_TRNS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_TRNS, KC_RSFT, KC_UP, KC_SLSH, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_MPLY, KC_PSCR, MO(1), KC_LEFT, KC_DOWN, KC_RGHT), + + + + /* Layer 1 +* ,-----------------------------------------------------------------------------------------. +* | PWR | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | | Del | +* |-----------------------------------------------------------------------------------------+ +* | |RGBT |RGBM |Hue+ |Hue- |Sat+ |Sat- |Val+ |Val- | | | | | RESET | +* |-----------------------------------------------------------------------------------------+ +* | | | | | | | | | | | | | | +* |-----------------------------------------------------------------------------------------+ +* | | | | | BLT | BL- | BL+ | BLS | | | |Vol+ | | +* |-----------------------------------------------------------------------------------------+ +* | | | | | | Stop | | |Prev |Vol- |Next | +* `-----------------------------------------------------------------------------------------' +*/ + + + KEYMAP_2_SHIFTS( + KC_PWR, 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_DEL, + KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, + 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, BL_TOGG, BL_DEC, BL_INC, BL_STEP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLU, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MSTP, KC_TRNS, KC_TRNS, KC_MPRV, KC_VOLD, KC_MNXT), +}; + +enum function_id { + SHIFT_ESC, +}; + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_FUNCTION(SHIFT_ESC), +}; + +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { + static uint8_t shift_esc_shift_mask; + switch (id) { + case SHIFT_ESC: + shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK; + if (record->event.pressed) { + if (shift_esc_shift_mask) { + add_key(KC_GRV); + send_keyboard_report(); + } else { + add_key(KC_ESC); + send_keyboard_report(); + } + } else { + if (shift_esc_shift_mask) { + del_key(KC_GRV); + send_keyboard_report(); + } else { + del_key(KC_ESC); + send_keyboard_report(); + } + } + break; + } +} \ No newline at end of file From ac82cd1ba77f4ed8d38f17662864c6a56a8da293 Mon Sep 17 00:00:00 2001 From: Harley Laue Date: Fri, 6 Oct 2017 16:32:02 -0700 Subject: [PATCH 052/173] Added personal nyquist & levinson layouts --- .../keymaps/losinggeneration/README.md | 28 ++ .../keymaps/losinggeneration/config.h | 42 +++ .../keymaps/losinggeneration/keymap.c | 38 ++ .../keymaps/losinggeneration/rules.mk | 17 + .../keymaps/losinggeneration/README.md | 29 ++ .../nyquist/keymaps/losinggeneration/config.h | 35 ++ .../nyquist/keymaps/losinggeneration/keymap.c | 55 +++ .../nyquist/keymaps/losinggeneration/rules.mk | 17 + users/losinggeneration/README.md | 185 +++++++++ .../losinggeneration-common.h | 74 ++++ .../losinggeneration-config.h | 29 ++ .../losinggeneration-keymap.h | 352 ++++++++++++++++++ users/losinggeneration/rules.mk | 16 + 13 files changed, 917 insertions(+) create mode 100644 keyboards/levinson/keymaps/losinggeneration/README.md create mode 100644 keyboards/levinson/keymaps/losinggeneration/config.h create mode 100644 keyboards/levinson/keymaps/losinggeneration/keymap.c create mode 100644 keyboards/levinson/keymaps/losinggeneration/rules.mk create mode 100644 keyboards/nyquist/keymaps/losinggeneration/README.md create mode 100644 keyboards/nyquist/keymaps/losinggeneration/config.h create mode 100644 keyboards/nyquist/keymaps/losinggeneration/keymap.c create mode 100644 keyboards/nyquist/keymaps/losinggeneration/rules.mk create mode 100644 users/losinggeneration/README.md create mode 100644 users/losinggeneration/losinggeneration-common.h create mode 100644 users/losinggeneration/losinggeneration-config.h create mode 100644 users/losinggeneration/losinggeneration-keymap.h create mode 100644 users/losinggeneration/rules.mk diff --git a/keyboards/levinson/keymaps/losinggeneration/README.md b/keyboards/levinson/keymaps/losinggeneration/README.md new file mode 100644 index 00000000..b406d500 --- /dev/null +++ b/keyboards/levinson/keymaps/losinggeneration/README.md @@ -0,0 +1,28 @@ +losinggeneration's Levinson Layout +============================ + +See description of the layout in the common folder +[here](../../../../users/losinggeneration/README.md) + +## Features +- Adjust + - Removed AGSwap, AGNorm, & Del + - Added Caps Lock, F1-F12 in a 4x3 grid, backlight control, arrow cluster, + and layer transitions to the new layers. + - Moved Reset & Audio control to the right side + +## Layouts + +### Adjust (Lower + Raise) + +``` + ,-----------------------------------------..-----------------------------------------. + | | F1 | F2 | F3 | F4 |BL Off|| RESET| Game |Numpad|Mouse | | | + |------+------+------+------+------+------||------+------+------+------+------+------| + | | F5 | F6 | F7 | F8 |BL Tg ||Aud on|Qwerty|Colmak|Workmn|Dvorak| | + |------+------+------+------+------+------||------+------+------+------+------+------| + | CAPS | F9 | F10 | F11 | F12 |BL On ||Audoff| | | | Up | | + |------+------+------+------+------+------||------+------+------+------+------+------| + | | | | | | || | | XXX | Left | Down |Right | + `-----------------------------------------''-----------------------------------------' +``` diff --git a/keyboards/levinson/keymaps/losinggeneration/config.h b/keyboards/levinson/keymaps/losinggeneration/config.h new file mode 100644 index 00000000..917c6a98 --- /dev/null +++ b/keyboards/levinson/keymaps/losinggeneration/config.h @@ -0,0 +1,42 @@ +/* +Copyright 2017 Danny Nguyen +Copyright 2018 Harley Laue + +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 +long with this program. If not, see . +*/ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include QMK_KEYBOARD_CONFIG_H + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +/* #define USE_I2C */ + +/* Select hand configuration */ + +#define MASTER_LEFT +/* #define _MASTER_RIGHT */ +/* #define EE_HANDS */ + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 12 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +#endif diff --git a/keyboards/levinson/keymaps/losinggeneration/keymap.c b/keyboards/levinson/keymaps/losinggeneration/keymap.c new file mode 100644 index 00000000..3512f59f --- /dev/null +++ b/keyboards/levinson/keymaps/losinggeneration/keymap.c @@ -0,0 +1,38 @@ +#include QMK_KEYBOARD_H +#include "losinggeneration-config.h" +#include "losinggeneration-keymap.h" + +extern keymap_config_t keymap_config; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_QWERTY] = CATMAP( QWERTY_LAYER ), +[_COLEMAK] = CATMAP( COLEMAK_LAYER ), +[_WORKMAN] = CATMAP( WORKMAN_LAYER ), +[_DVORAK] = CATMAP( DVORAK_LAYER ), +[_GAME] = CATMAP( GAME_LAYER ), +[_NUMPAD] = CATMAP( NUMPAD_LAYER ), +[_MOUSE] = CATMAP( MOUSE_LAYER ), +[_LOWER] = CATMAP( LOWER_LAYER ), +[_RAISE] = CATMAP( RAISE_LAYER ), + +/* Adjust (Lower + Raise) + * ,-----------------------------------------..-----------------------------------------. + * | | F1 | F2 | F3 | F4 |BL Off|| RESET| Game |Numpad|Mouse | | | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | | F5 | F6 | F7 | F8 |BL Tg ||Aud on|Qwerty|Colmak|Workmn|Dvorak| | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | CAPS | F9 | F10 | F11 | F12 |BL On ||Audoff| | | | Up | | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | | | | | | || | | XXX | Left | Down |Right | + * `-----------------------------------------''-----------------------------------------' + */ +[_ADJUST] = CATMAP( \ + _______, KC_F1 , KC_F2 , KC_F3 , KC_F4 , BL_OFF , RESET , TO_GAME, TO_NUM , TO_MS , _______, _______, \ + _______, KC_F5 , KC_F6 , KC_F7 , KC_F8 , BL_TOGG, AU_ON , QWERTY , COLEMAK, WORKMAN, DVORAK , _______, \ + KC_CAPS, KC_F9 , KC_F10, KC_F11 , KC_F12 , BL_ON , AU_OFF , _______, _______, _______, KC_UP , _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT \ +) + +}; + diff --git a/keyboards/levinson/keymaps/losinggeneration/rules.mk b/keyboards/levinson/keymaps/losinggeneration/rules.mk new file mode 100644 index 00000000..f3e47b4c --- /dev/null +++ b/keyboards/levinson/keymaps/losinggeneration/rules.mk @@ -0,0 +1,17 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +AUDIO_ENABLE = no # Audio output on port C6 +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +COMMAND_ENABLE = no # Commands for debug and configuration +CONSOLE_ENABLE = no # Console for debug(+400) +MIDI_ENABLE = no # MIDI controls +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/nyquist/keymaps/losinggeneration/README.md b/keyboards/nyquist/keymaps/losinggeneration/README.md new file mode 100644 index 00000000..be55af2e --- /dev/null +++ b/keyboards/nyquist/keymaps/losinggeneration/README.md @@ -0,0 +1,29 @@ +losinggeneration's Nyquist Layout +============================ + +See description of the layout in the common folder +[here](../../../../users/losinggeneration/README.md) + +## Features +- Adjust + - Removed AGSwap, AGNorm, & Del + - Added Caps Lock, F1-F12 in a 4x3 grid, arrow cluster, and layer transitions + to the new layers. + +## Layouts + +### Adjust (Lower + Raise) + +``` + ,-----------------------------------------..-----------------------------------------. + | RESET|DEBUG | | | | || | | | | | | + |------+------+------+------+------+------||------+------+------+------+------+------| + | | F1 | F2 | F3 | F4 | || | Game |Numpad| Mouse| | | + |------+------+------+------+------+------||------+------+------+------+------+------| + | | F5 | F6 | F7 | F8 | || |Qwerty|Colmak|Workmn|Dvorak| | + |------+------+------+------+------+------||------+------+------+------+------+------| + | CAPS | F9 | F10 | F11 | F12 | || | | | | Up | | + |------+------+------+------+------+------||------+------+------+------+------+------| + | | | | | | || | | XXX | Left | Down |Right | + `-----------------------------------------''-----------------------------------------' +``` diff --git a/keyboards/nyquist/keymaps/losinggeneration/config.h b/keyboards/nyquist/keymaps/losinggeneration/config.h new file mode 100644 index 00000000..33037944 --- /dev/null +++ b/keyboards/nyquist/keymaps/losinggeneration/config.h @@ -0,0 +1,35 @@ +/* +Copyright 2017 Danny Nguyen +Copyright 2018 Harley Laue + +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 +long with this program. If not, see . +*/ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include QMK_KEYBOARD_CONFIG_H + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +/* #define USE_I2C */ + +/* Select hand configuration */ + +#define MASTER_LEFT +/* #define _MASTER_RIGHT */ +/* #define EE_HANDS */ + +#endif diff --git a/keyboards/nyquist/keymaps/losinggeneration/keymap.c b/keyboards/nyquist/keymaps/losinggeneration/keymap.c new file mode 100644 index 00000000..65fbb9cd --- /dev/null +++ b/keyboards/nyquist/keymaps/losinggeneration/keymap.c @@ -0,0 +1,55 @@ +#include QMK_KEYBOARD_H +#include "losinggeneration-config.h" +#include "losinggeneration-keymap.h" + +extern keymap_config_t keymap_config; + +#define NUMBER_ROW \ + KC_GRV ,KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_DEL + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_QWERTY] = CATMAP( NUMBER_ROW, QWERTY_LAYER ), +[_COLEMAK] = CATMAP( NUMBER_ROW, COLEMAK_LAYER ), +[_WORKMAN] = CATMAP( NUMBER_ROW, WORKMAN_LAYER ), +[_DVORAK] = CATMAP( NUMBER_ROW, DVORAK_LAYER ), +[_GAME] = CATMAP( NUMBER_ROW, GAME_LAYER ), +[_NUMPAD] = CATMAP( \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_NLCK, KC_PAST, KC_PSLS, KC_BSPC, KC_BSPC, \ + NUMPAD_LAYER \ +), + +[_MOUSE] = CATMAP( \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + MOUSE_LAYER \ +), + +[_LOWER] = CATMAP( \ + KC_TILD, KC_EXLM, KC_AT , KC_HASH, KC_DLR , KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL , \ + LOWER_LAYER \ +), + +[_RAISE] = CATMAP(NUMBER_ROW, RAISE_LAYER ), + +/* Adjust (Lower + Raise) + * ,-----------------------------------------..-----------------------------------------. + * | RESET|DEBUG | | | | || | | | | | | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | | F1 | F2 | F3 | F4 | || | Game |Numpad| Mouse| | | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | | F5 | F6 | F7 | F8 | || |Qwerty|Colmak|Workmn|Dvorak| | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | CAPS | F9 | F10 | F11 | F12 | || | | | | Up | | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | | | | | | || | | XXX | Left | Down |Right | + * `-----------------------------------------''-----------------------------------------' + */ +[_ADJUST] = CATMAP( \ + RESET , DEBUG , _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, KC_F1 , KC_F2 , KC_F3 , KC_F4 , _______, _______, TO_GAME, TO_NUM , TO_MS , _______, _______, \ + _______, KC_F5 , KC_F6 , KC_F7 , KC_F8 , _______, _______, QWERTY , COLEMAK, WORKMAN, DVORAK , _______, \ + KC_CAPS, KC_F9 , KC_F10, KC_F11 , KC_F12 , _______, _______, _______, _______, _______, KC_UP , _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT \ +) +}; + diff --git a/keyboards/nyquist/keymaps/losinggeneration/rules.mk b/keyboards/nyquist/keymaps/losinggeneration/rules.mk new file mode 100644 index 00000000..1728afd8 --- /dev/null +++ b/keyboards/nyquist/keymaps/losinggeneration/rules.mk @@ -0,0 +1,17 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +AUDIO_ENABLE = no # Audio output on port C6 +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +COMMAND_ENABLE = no # Commands for debug and configuration +CONSOLE_ENABLE = no # Console for debug(+400) +MIDI_ENABLE = no # MIDI controls +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/users/losinggeneration/README.md b/users/losinggeneration/README.md new file mode 100644 index 00000000..852103fc --- /dev/null +++ b/users/losinggeneration/README.md @@ -0,0 +1,185 @@ +losinggeneration's ortholinear layout +============================ + +### Features + +- Main layer(s) + - The left space bar key has been changed to delete to have backspace + & delete on the same main layer. + - Adujst is a tap dance with one tap goes to the Adjust layer, second tap + goes to the Numpad layer, a third tap goes to the Mouse layer. More taps + are an error and disables tapping until you stop and try again. + - Ctrl when tapped once & Ctrl+Alt when tapped twice + - Left Alt when tapped once & Right Alt when tapped twice. + - Left GUI when tapped once & right GUI when tapped twice. This is + because I have a compose key on the right GUI key. + - Left shift is a one shot modifier. + - Enter when tapped Shift when held. + - Esc when tapped Ctrl when held. +- Lower & Raise + - Removed ISO ~, ISO |, ISO #, ISO /, Media Next, & Media Play + - Added PgUp, PgDn, Home, & End under the home row + - Added Mute next to Vol- +- New layers: Workman, Game, Numpad, & Mouse + +## Layouts +These include the 5x12 layout since it's nearly identical to the 4x12 layout. +The only difference is the top row is removed for the 4x12 layout. + +The Adjust layer keyboard specific, so it's described with the specific +keyboard. + +### Qwerty + +``` + ,-----------------------------------------..-----------------------------------------. + | ` | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | Del | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Tab | Q | W | E | R | T || Y | U | I | O | P | Bksp | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Esc | A | S | D | F | G || H | J | K | L | ; | " | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Shift| Z | X | C | V | B || N | M | , | . | / |Enter | + |------+------+------+------+------+------||------+------+------+------+------+------| + |Adjust| Ctrl | Alt | GUI |Lower | Bksp ||Space |Raise | Left | Down | Up |Right | + `-----------------------------------------'`-----------------------------------------' +``` + +### Colemak + +``` + ,-----------------------------------------.,-----------------------------------------. + | ` | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | Del | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Tab | Q | W | F | P | G || J | L | U | Y | ; | Bksp | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Esc | A | R | S | T | D || H | N | E | I | O | " | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Shift| Z | X | C | V | B || K | M | , | . | / |Enter | + |------+------+------+------+------+------||------+------+------+------+------+------| + |Adjust| Ctrl | Alt | GUI |Lower | Bksp ||Space |Raise | Left | Down | Up |Right | + `-----------------------------------------'`-----------------------------------------' +``` + +### Workman + +``` + ,-----------------------------------------..-----------------------------------------. + | ` | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | Del | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Tab | Q | D | R | W | B || J | F | U | P | ; | Bksp | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Esc | A | S | H | T | G || Y | N | E | O | I | " | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Shift| Z | X | M | C | V || K | L | , | . | / |Enter | + |------+------+------+------+------+------||------+------+------+------+------+------| + |Adjust| Ctrl | Alt | GUI |Lower | Bksp ||Space |Raise | Left | Down | Up |Right | + `-----------------------------------------'`-----------------------------------------' +``` + +### Dvorak + +``` + ,-----------------------------------------..-----------------------------------------. + | ` | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | Del | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Tab | " | , | . | P | Y || F | G | C | R | L | Bksp | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Esc | A | O | E | U | I || D | H | T | N | S | / | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Shift| ; | Q | J | K | X || B | M | W | V | Z |Enter | + |------+------+------+------+------+------||------+------+------+------+------+------| + |Adjust| Ctrl | Alt | GUI |Lower | Bksp ||Space |Raise | Left | Down | Up |Right | + `-----------------------------------------'`-----------------------------------------' +``` + +### Game (Qwerty without one shot modifiers & tap dancing) + +``` + ,-----------------------------------------..-----------------------------------------. + | ` | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | Del | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Tab | Q | W | E | R | T || Y | U | I | O | P | Bksp | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Esc | A | S | D | F | G || H | J | K | L | ; | " | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Shift| Z | X | C | V | B || N | M | , | . | / |Enter | + |------+------+------+------+------+------||------+------+------+------+------+------| + |Adjust| Ctrl | Alt | GUI |Lower |Space ||Space |Raise | Left | Down | Up |Right | + `-----------------------------------------'`-----------------------------------------' +``` + +### Number pad + +``` + ,-----------------------------------------..-----------------------------------------. + | XXX | XXX | XXX | XXX | XXX | XXX || XXX | NLCK | * | / | BKSP | BKSP | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Tab | XXX | XXX | XXX | XXX | XXX || NLCK | 7 | 8 | 9 | - | BKSP | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Esc | XXX | XXX | XXX | XXX | XXX || * | 4 | 5 | 6 | + | BKSP | + |------+------+------+------+------+------||------+------+------+------+------+------| + |Shift | XXX | XXX | XXX | XXX | XXX || / | 1 | 2 | 3 | ENT | XXX | + |------+------+------+------+------+------||------+------+------+------+------+------| + |Adjust| Ctrl | Alt | GUI | XXX |Space ||Space | 0 | 0 | . | ENT | XXX | + `-----------------------------------------''-----------------------------------------' +``` + +### Mouse movement + +* M is short for Mouse +* MW is short for Mouse Wheel +* MB is short for Mouse Button +* MA is short for Mouse Acceleration + +  +* MB\_1 is the left click +* MB\_2 is the right click +* MB\_3 is the middle click + +``` + ,-----------------------------------------..-----------------------------------------. + | XXX | XXX | XXX | XXX | XXX | XXX || XXX | XXX | XXX | XXX | XXX | XXX | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Tab | MB_1 | MB_3 | MB_2 | MB_4 | MB_5 || MA_0 | MB_1 | MB_3 | MB_2 | MB_4 | MB_5 | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Esc | MW_L | MW_U | MW_D | MW_R | XXX || MA_1 | M_LT | M_UP | M_DN | M_RT | XXX | + |------+------+------+------+------+------||------+------+------+------+------+------| + |Shift | MA_0 | MA_1 | MA_2 | XXX | XXX || MA_2 | MW_L | MW_U | MW_D | MW_R | XXX | + |------+------+------+------+------+------||------+------+------+------+------+------| + |Adjust| Ctrl | Alt | GUI | XXX |Space || XXX | XXX | XXX | XXX | XXX | XXX | + `-----------------------------------------''-----------------------------------------' +``` + +### Lower + +``` + ,-----------------------------------------..-----------------------------------------. + | ~ | ! | @ | # | $ | % || ^ | & | * | ( | ) | Del | + |------+------+------+------+------+------||------+------+------+------+------+------| + | ~ | ! | @ | # | $ | % || ^ | & | * | ( | ) | Bksp | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Del | F1 | F2 | F3 | F4 | F5 || F6 | _ | + | | \ | | | + |------+------+------+------+------+------||------+------+------+------+------+------| + | | F7 | F8 | F9 | F10 | F11 || F12 | PgUp | PgDn | Home | End | ⏹ | + |------+------+------+------+------+------||------+------+------+------+------+------| + | | | | | | || | | Mute | Vol- | Vol+ | ⏯ | + `-----------------------------------------'`-----------------------------------------' +``` + +### Raise + +``` + ,-----------------------------------------..-----------------------------------------. + | ` | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | Del | + |------+------+------+------+------+------||------+------+------+------+------+------| + | ` | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | Bksp | + |------+------+------+------+------+------||------+------+------+------+------+------| + | Del | F1 | F2 | F3 | F4 | F5 || F6 | - | = | [ | ] | \ | + |------+------+------+------+------+------||------+------+------+------+------+------| + | | F7 | F8 | F9 | F10 | F11 || F12 | PgUp | PgDn | Home | End | ⏹ | + |------+------+------+------+------+------||------+------+------+------+------+------| + | | | | | | || | | Mute | Vol- | Vol+ | ⏯ | + `-----------------------------------------''-----------------------------------------' +``` + diff --git a/users/losinggeneration/losinggeneration-common.h b/users/losinggeneration/losinggeneration-common.h new file mode 100644 index 00000000..8f5b8b24 --- /dev/null +++ b/users/losinggeneration/losinggeneration-common.h @@ -0,0 +1,74 @@ +#ifndef LOSINGGENERATION_COMMON_H +#define LOSINGGENERATION_COMMON_H + +/* Custom keys & combinations to be shorter for keymaps */ +#define KC_LCA LCA(KC_NO) +/* Fillers to make layering more clear */ +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +#define OSM_LSFT OSM(MOD_LSFT) +#define TD_CTL TD(TD_CTL_CTLALT) +#define TD_GUI TD(TD_LGUI_RGUI) +#define TD_ALT TD(TD_LALT_RALT) +#define MT_ENT SFT_T(KC_ENT) +#define MT_ESC CTL_T(KC_ESC) + +/* Custom layer movements for keymaps */ +#define TD_ADJ TD(TD_ADJUST) +#define TO_GAME TO(_GAME) +#define TO_MS TO(_MOUSE) +#define TO_NUM TO(_NUMPAD) +#define MO_ADJ MO(_ADJUST) + +/* Mouse keys */ +#define MS_BTN1 KC_MS_BTN1 +#define MS_BTN2 KC_MS_BTN2 +#define MS_BTN3 KC_MS_BTN3 +#define MS_BTN4 KC_MS_BTN4 +#define MS_BTN5 KC_MS_BTN5 +#define MS_LEFT KC_MS_LEFT +#define MS_DOWN KC_MS_DOWN +#define MS_UP KC_MS_UP +#define MS_RGHT KC_MS_RIGHT +#define MW_LEFT KC_MS_WH_LEFT +#define MW_DOWN KC_MS_WH_DOWN +#define MW_UP KC_MS_WH_UP +#define MW_RGHT KC_MS_WH_RIGHT +#define MS_ACL0 KC_MS_ACCEL0 +#define MS_ACL1 KC_MS_ACCEL1 +#define MS_ACL2 KC_MS_ACCEL2 + +/* + * This will expand values sent to it to send to the KEYMAP macro so defines + * can be used by KEYMAP + */ +#define CATMAP(...) KEYMAP(__VA_ARGS__) + +/* + Each layer gets a name for readability, which is then used in the keymap matrix below. + The underscores don't mean anything - you can have a layer called STUFF or any other name. + Layer names don't all need to be of the same length, obviously, and you can also skip them + entirely and just use numbers. +*/ +#define _QWERTY 0 +#define _COLEMAK 1 +#define _WORKMAN 2 +#define _DVORAK 3 +#define _GAME 4 +#define _NUMPAD 5 +#define _MOUSE 6 +#define _LOWER 14 +#define _RAISE 15 +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + WORKMAN, + DVORAK, + LOWER, + RAISE, +}; + +#endif diff --git a/users/losinggeneration/losinggeneration-config.h b/users/losinggeneration/losinggeneration-config.h new file mode 100644 index 00000000..e1719aa9 --- /dev/null +++ b/users/losinggeneration/losinggeneration-config.h @@ -0,0 +1,29 @@ +/* +Copyright 2017 Danny Nguyen +Copyright 2018 Harley Laue + +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 +long with this program. If not, see . +*/ + +#ifndef LOSINGGENERATION_CONFIG_H +#define LOSINGGENERATION_CONFIG_H + +#define MOUSEKEY_DELAY 100 +#define MOUSEKEY_INTERVAL 20 +#define MOUSEKEY_MAX_SPEED 10 +#define MOUSEKEY_TIME_TO_MAX 20 +#define MOUSEKEY_WHEEL_MAX_SPEED 8 +#define MOUSEKEY_WHEEL_TIME_TO_MAX 20 + +#endif diff --git a/users/losinggeneration/losinggeneration-keymap.h b/users/losinggeneration/losinggeneration-keymap.h new file mode 100644 index 00000000..89827bc1 --- /dev/null +++ b/users/losinggeneration/losinggeneration-keymap.h @@ -0,0 +1,352 @@ +#ifndef LOSINGGENERATION_KEYMAP_H +#define LOSINGGENERATION_KEYMAP_H + +#include "action_layer.h" +#include "eeconfig.h" +#include "losinggeneration-common.h" + +/* Tap dance keycodes */ +enum tap_dance_keycodes { + TD_CTL_CTLALT = 0, + TD_LGUI_RGUI, + TD_LALT_RALT, + TD_ADJUST, +}; + +/* + Used to indicate a CTRL should be pressed on one press, or CTRL+ALT on + a double tap +*/ +void dance_ctl_ctlalt_each(qk_tap_dance_state_t *state, void *user_data) { + register_code(KC_LCTL); + if(state->count > 1) { + register_code(KC_LALT); + } +} + +/* Used to release CTRL or the double tapped variant CTRL+ALT */ +void dance_ctl_ctlalt_reset(qk_tap_dance_state_t *state, void *user_data) { + unregister_code(KC_LCTL); + if(state->count > 1) { + unregister_code(KC_LALT); + } +} + +/* + Set ADJUST layer on the first press and off after that. + Each is used to make sure ADJUST activates as soon as it's pressed the first + time. +*/ +void dance_adj_each(qk_tap_dance_state_t *state, void *user_data) { + if(state->count == 1) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } +} + +/* Set NUMPAD layer on second tap and MOUSE layer on 3rd */ +void dance_adj_finish(qk_tap_dance_state_t *state, void *user_data) { + switch(state->count) { + case 1: break; + case 2: + layer_on(_NUMPAD); + break; + case 3: + layer_on(_MOUSE); + break; + default: + reset_tap_dance(state); + break; + } +} + +/* Turn off any layer that may have been tapped on */ +void dance_adj_reset(qk_tap_dance_state_t *state, void *user_data) { + switch(state->count) { + case 1: + layer_off(_ADJUST); + break; + case 2: + layer_off(_NUMPAD); + break; + case 3: + layer_off(_MOUSE); + break; + } +} + +qk_tap_dance_action_t tap_dance_actions[] = { + [TD_CTL_CTLALT] = ACTION_TAP_DANCE_FN_ADVANCED(dance_ctl_ctlalt_each, NULL, dance_ctl_ctlalt_reset), + [TD_LGUI_RGUI] = ACTION_TAP_DANCE_DOUBLE(KC_LGUI, KC_RGUI), + [TD_LALT_RALT] = ACTION_TAP_DANCE_DOUBLE(KC_LALT, KC_RALT), + [TD_ADJUST] = ACTION_TAP_DANCE_FN_ADVANCED(dance_adj_each, dance_adj_finish, dance_adj_reset), +}; + +/* + * ,-----------------------------------------..-----------------------------------------. + * |Adjust| Ctrl | Alt | GUI |Lower | Del ||Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------'`-----------------------------------------' + */ +#define BOTTOM_40_ROW \ + TD_ADJ ,TD_CTL , TD_ALT , TD_GUI , LOWER , KC_DEL , KC_SPC , RAISE , KC_LEFT, KC_DOWN, KC_UP , KC_RGHT + +/* + * ,-----------------------------------------..-----------------------------------------. + * | | F7 | F8 | F9 | F10 | F11 || F12 | PgUp | PgDn | Home | End | ⏹ | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | | | | | | || | | Mute | Vol- | Vol+ | ⏯ | + * `-----------------------------------------'`-----------------------------------------' + */ +#define BOTTOM_RAISE_LOWER_ROWS \ + _______, KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , KC_PGUP, KC_PGDN, KC_HOME, KC_END , KC_MSTP, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY + +/* + * ,-----------------------------------------..-----------------------------------------. + * | Tab | || | Bksp | + * `-----------------------------------------'`-----------------------------------------' + */ +#define STD_TAB_ROW(...) KC_TAB, __VA_ARGS__, KC_BSPC + +/* + * ,-----------------------------------------..-----------------------------------------. + * | Esc | || | + * `-----------------------------------------'`-----------------------------------------' + */ + +#define STD_ESC_ROW(...) KC_ESC, __VA_ARGS__ + +/* + * ,-----------------------------------------..-----------------------------------------. + * | Shift| || |Enter | + * `-----------------------------------------'`-----------------------------------------' + */ +#define STD_LSFT_ROW(...) OSM_LSFT, __VA_ARGS__, MT_ENT + +/* Qwerty + * ,-----------------------------------------..-----------------------------------------. + * | Tab | Q | W | E | R | T || Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | Esc | A | S | D | F | G || H | J | K | L | ; | " | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | Shift| Z | X | C | V | B || N | M | , | . | / |Enter | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower | Del ||Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------'`-----------------------------------------' + */ +#define QWERTY_LAYER \ + STD_TAB_ROW( KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P ), \ + STD_ESC_ROW( KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN , KC_QUOT), \ + STD_LSFT_ROW(KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH), \ + BOTTOM_40_ROW + +/* Colemak + * ,-----------------------------------------.,-----------------------------------------. + * | Tab | Q | W | F | P | G || J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | Esc | A | R | S | T | D || H | N | E | I | O | " | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | Shift| Z | X | C | V | B || K | M | , | . | / |Enter | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower | Del ||Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------'`-----------------------------------------' + */ +#define COLEMAK_LAYER \ + STD_TAB_ROW( KC_Q , KC_W , KC_F , KC_P , KC_G , KC_J , KC_L , KC_U , KC_Y , KC_SCLN), \ + STD_ESC_ROW( KC_A , KC_R , KC_S , KC_T , KC_D , KC_H , KC_N , KC_E , KC_I , KC_O , KC_QUOT), \ + STD_LSFT_ROW(KC_Z , KC_X , KC_C , KC_V , KC_B , KC_K , KC_M , KC_COMM, KC_DOT , KC_SLSH), \ + BOTTOM_40_ROW + +/* Workman + * ,-----------------------------------------..-----------------------------------------. + * | Tab | Q | D | R | W | B || J | F | U | P | ; | Bksp | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | Esc | A | S | H | T | G || Y | N | E | O | I | " | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | Shift| Z | X | M | C | V || K | L | , | . | / |Enter | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower | Del ||Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------'`-----------------------------------------' + */ +#define WORKMAN_LAYER \ + STD_TAB_ROW( KC_Q , KC_D , KC_R , KC_W , KC_B , KC_J , KC_F , KC_U , KC_P , KC_SCLN), \ + STD_ESC_ROW( KC_A , KC_S , KC_H , KC_T , KC_G , KC_Y , KC_N , KC_E , KC_O , KC_I , KC_QUOT), \ + STD_LSFT_ROW(KC_Z , KC_X , KC_M , KC_C , KC_V , KC_K , KC_L , KC_COMM, KC_DOT , KC_SLSH), \ + BOTTOM_40_ROW + +/* Dvorak + * ,-----------------------------------------..-----------------------------------------. + * | Tab | " | , | . | P | Y || F | G | C | R | L | Bksp | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | Esc | A | O | E | U | I || D | H | T | N | S | / | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X || B | M | W | V | Z |Enter | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower | Del ||Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------'`-----------------------------------------' + */ +#define DVORAK_LAYER \ + STD_TAB_ROW( KC_QUOT, KC_COMM, KC_DOT , KC_P , KC_Y , KC_F , KC_G , KC_C , KC_R , KC_L), \ + STD_ESC_ROW( KC_A , KC_O , KC_E , KC_U , KC_I , KC_D , KC_H , KC_T , KC_N , KC_S , KC_SLSH), \ + STD_LSFT_ROW(KC_SCLN, KC_Q , KC_J , KC_K , KC_X , KC_B , KC_M , KC_W , KC_V , KC_Z), \ + BOTTOM_40_ROW + +/* Game (Qwerty without one shot modifiers & tap dancing) + * ,-----------------------------------------..-----------------------------------------. + * | Tab | Q | W | E | R | T || Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | Esc | A | S | D | F | G || H | J | K | L | ; | " | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | Shift| Z | X | C | V | B || N | M | , | . | / |Enter | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space ||Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------'`-----------------------------------------' + */ +#define GAME_LAYER \ + 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 , \ + MO_ADJ , KC_LCTL, KC_LALT, KC_LGUI, LOWER , KC_SPC , KC_SPC , RAISE , KC_LEFT, KC_DOWN, KC_UP , KC_RGHT + +/* Number pad + * ,-----------------------------------------..-----------------------------------------. + * | Tab | XXX | XXX | XXX | XXX | XXX || NLCK | 7 | 8 | 9 | - | BKSP | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | Esc | XXX | XXX | XXX | XXX | XXX || * | 4 | 5 | 6 | + | BKSP | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * |Shift | XXX | XXX | XXX | XXX | XXX || / | 1 | 2 | 3 | ENT | XXX | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI | XXX |Space ||Space | 0 | 0 | . | ENT | XXX | + * `-----------------------------------------''-----------------------------------------' + */ +#define NUMPAD_LAYER \ + KC_TAB , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_NLCK, KC_P7 , KC_P8 , KC_P9 , KC_PMNS, KC_BSPC, \ + KC_ESC , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PAST, KC_P4 , KC_P5 , KC_P6 , KC_PPLS, KC_BSPC, \ + KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PSLS, KC_P1 , KC_P2 , KC_P3 , KC_PENT, XXXXXXX, \ + TD_ADJ , TD_CTL , TD_ALT , TD_GUI , XXXXXXX, KC_SPC , KC_SPC , KC_P0 , KC_P0 , KC_PDOT, KC_PENT, XXXXXXX + +/* Mouse movement + * ,-----------------------------------------..-----------------------------------------. + * | Tab | MB_1 | MB_3 | MB_2 | MB_4 | MB_5 || MA_0 | MB_1 | MB_3 | MB_2 | MB_4 | MB_5 | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | Esc | MW_L | MW_U | MW_D | MW_R | XXX || MA_1 | M_LT | M_UP | M_DN | M_RT | XXX | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * |Shift | MA_0 | MA_1 | MA_2 | XXX | XXX || MA_2 | MW_L | MW_U | MW_D | MW_R | XXX | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI | XXX |Space || XXX | XXX | XXX | XXX | XXX | XXX | + * `-----------------------------------------''-----------------------------------------' + */ +#define MOUSE_LAYER \ + KC_TAB , MS_BTN1, MS_BTN3, MS_BTN2, MS_BTN4, MS_BTN5, MS_ACL0, MS_BTN1, MS_BTN3, MS_BTN2, MS_BTN4, MS_BTN5, \ + KC_ESC , MW_LEFT, MW_DOWN, MW_UP , MW_RGHT, XXXXXXX, MS_ACL1, MS_LEFT, MS_DOWN, MS_UP , MS_RGHT, XXXXXXX, \ + KC_LSFT, MS_ACL0, MS_ACL1, MS_ACL2, XXXXXXX, XXXXXXX, MS_ACL2, MW_LEFT, MW_DOWN, MW_UP , MW_RGHT, XXXXXXX, \ + TD_ADJ , TD_CTL , TD_ALT , TD_GUI , XXXXXXX, KC_SPC , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + +/* Lower + * ,-----------------------------------------..-----------------------------------------. + * | ~ | ! | @ | # | $ | % || ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 || F6 | _ | + | | \ | | | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 || F12 | PgUp | PgDn | Home | End | ⏹ | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | | | | | | || | | Mute | Vol- | Vol+ | ⏯ | + * `-----------------------------------------'`-----------------------------------------' + */ +#define LOWER_LAYER \ + KC_TILD, KC_EXLM, KC_AT , KC_HASH, KC_DLR , KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ + KC_DEL , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ + BOTTOM_RAISE_LOWER_ROWS + +/* Raise + * ,-----------------------------------------..-----------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 || F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 || F12 | PgUp | PgDn | Home | End | ⏹ | + * |------+------+------+------+------+------||------+------+------+------+------+------| + * | | | | | | || | | Mute | Vol- | Vol+ | ⏯ | + * `-----------------------------------------''-----------------------------------------' + */ +#define RAISE_LAYER \ + 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_DEL , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_MINS, KC_EQL , KC_LBRC, KC_RBRC, KC_BSLS, \ + BOTTOM_RAISE_LOWER_ROWS + +#ifdef AUDIO_ENABLE +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +float tone_workman[][2] = SONG(PLOVER_SOUND); +#else +float tone_qwerty; +float tone_dvorak; +float tone_colemak; +float tone_workman; +#define PLAY_SONG(tone) +#endif + +void persistent_default_layer_set(uint16_t default_layer) { + layer_state_set(default_layer); + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + PLAY_SONG(tone_qwerty); + persistent_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + PLAY_SONG(tone_colemak); + persistent_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case WORKMAN: + if (record->event.pressed) { + PLAY_SONG(tone_workman); + persistent_default_layer_set(1UL<<_WORKMAN); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + PLAY_SONG(tone_dvorak); + persistent_default_layer_set(1UL<<_DVORAK); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + } + + return true; +} + +#endif diff --git a/users/losinggeneration/rules.mk b/users/losinggeneration/rules.mk new file mode 100644 index 00000000..75277116 --- /dev/null +++ b/users/losinggeneration/rules.mk @@ -0,0 +1,16 @@ +# Build Options +# Only enable things here that are generic to all keyboards. A yes or no here +# will override keyboard/keymap specific values +# +#BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +#COMMAND_ENABLE = no # Commands for debug and configuration +#CONSOLE_ENABLE = no # Console for debug(+400) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +#NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +TAP_DANCE_ENABLE = yes # Enable tap dancing +#UNICODE_ENABLE = no # Unicode + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif From 598384bc1064ab9250191a1727c27a0eea406756 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Sun, 4 Feb 2018 10:44:02 -0800 Subject: [PATCH 053/173] Update to drashna userspace (Keymap Templating) (#2338) * Change tapping term to be longer * Make Audio/Underglow settings permanent * Use wait_ms rather than _delay_ms * Readd One Shot Mods * Switch to Imperial March startup sound * Move OSM to it's own layer * Minor Formatting Tweaks * Keymap Templates and formatting fixes --- keyboards/ergodox_ez/keymaps/drashna/config.h | 2 +- keyboards/ergodox_ez/keymaps/drashna/keymap.c | 164 ++++++++++-------- keyboards/orthodox/keymaps/drashna/config.h | 2 +- keyboards/orthodox/keymaps/drashna/keymap.c | 57 +++--- keyboards/orthodox/keymaps/drashna/rules.mk | 2 - users/drashna/drashna.c | 36 ++-- users/drashna/drashna.h | 63 ++++++- users/drashna/readme.md | 16 ++ 8 files changed, 215 insertions(+), 127 deletions(-) diff --git a/keyboards/ergodox_ez/keymaps/drashna/config.h b/keyboards/ergodox_ez/keymaps/drashna/config.h index 2f5422b1..d543379a 100644 --- a/keyboards/ergodox_ez/keymaps/drashna/config.h +++ b/keyboards/ergodox_ez/keymaps/drashna/config.h @@ -15,7 +15,7 @@ #ifdef TAPPING_TERM #undef TAPPING_TERM #endif -#define TAPPING_TERM 150 +#define TAPPING_TERM 175 #undef PERMISSIVE_HOLD #define IGNORE_MOD_TAP_INTERRUPT // this makes it possible to do rolling combos (zx) with keys that convert to other keys on hold (z becomes ctrl when you hold it, and when this option isn't enabled, z rapidly followed by x actually sends Ctrl-x. That's bad.) #define ONESHOT_TAP_TOGGLE 2 diff --git a/keyboards/ergodox_ez/keymaps/drashna/keymap.c b/keyboards/ergodox_ez/keymaps/drashna/keymap.c index 0d0e1fba..268a1d08 100644 --- a/keyboards/ergodox_ez/keymaps/drashna/keymap.c +++ b/keyboards/ergodox_ez/keymaps/drashna/keymap.c @@ -48,26 +48,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | End | | PgDn | | | * `---------------------' `---------------------' */ - [_QWERTY] = LAYOUT_ergodox( - KC_EQUAL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(_MOUS), - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(_DIABLO), - KC_BSPACE, KC_A, KC_S, KC_D, KC_F, KC_G, - KC_LSFT, LCTL_T(KC_Z),KC_X, KC_C, KC_V, KC_B, TG(_GAMEPAD), - LT(_SYMB,KC_GRAVE),KC_QUOTE, KC_LGUI, KC_LBRACKET,KC_RBRACKET, + [_QWERTY] = LAYOUT_ergodox_wrapper( + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(_MOUS), + KC_TAB, _________________QWERTY_L1_________________, TG(_DIABLO), + KC_BSPC, _________________QWERTY_L2_________________, + KC_LSFT, _________________QWERTY_L3_________________, TG(_GAMEPAD), + LT(_SYMB,KC_GRV), ___________ERGODOX_BOTTOM_LEFT_____________, - ALT_T(KC_APPLICATION), KC_LGUI, - KC_HOME, - KC_SPACE, KC_BSPACE, KC_END, + ALT_T(KC_APP), KC_LGUI, + KC_HOME, + KC_SPACE,KC_BSPC, KC_END, - TG(_MOUS), KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, - TG(_DIABLO), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLASH, - KC_H, KC_J, KC_K, KC_L, KC_SCOLON, GUI_T(KC_QUOTE), - TG(_GAMEPAD), KC_N, KC_M, KC_COMMA, KC_DOT, RCTL_T(KC_SLASH),OSM(MOD_RSFT), - KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, TT(_SYMB), - KC_RGUI, CTL_T(KC_ESCAPE), - KC_PGUP, - KC_PGDOWN, KC_DELETE, KC_ENTER - ), + TG(_MOUS), KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + TG(_DIABLO), _________________QWERTY_R1_________________, KC_BSLS, + _________________QWERTY_R2_________________, GUI_T(KC_QUOT), + TG(_GAMEPAD), _________________QWERTY_R3_________________, KC_RSFT, + ___________ERGODOX_BOTTOM_RIGHT____________, TT(_SYMB), + KC_RGUI, CTL_T(KC_ESCAPE), + KC_PGUP, + KC_PGDOWN, KC_DELETE, KC_ENTER + ), /* Keymap 0: Basic layer * * ,--------------------------------------------------. ,--------------------------------------------------. @@ -91,25 +91,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ // If it accepts an argument (i.e, is a function), it doesn't need KC_. // Otherwise, it needs KC_* -[_COLEMAK] = LAYOUT_ergodox( +[_COLEMAK] = LAYOUT_ergodox_wrapper( // left hand - KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(_MOUS), - KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, TG(_DIABLO), - KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, - KC_LSFT, LCTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, TG(_GAMEPAD), - LT(_SYMB,KC_GRV),KC_QUOT, KC_LGUI, KC_LBRACKET,KC_RBRACKET, - ALT_T(KC_APP), KC_LGUI, - KC_HOME, - KC_SPC,KC_BSPC,KC_END, + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(_MOUS), + KC_TAB, _________________COLEMAK_L1________________, TG(_DIABLO), + KC_BSPC, _________________COLEMAK_L2________________, + KC_LSFT, _________________COLEMAK_L3________________, TG(_GAMEPAD), + LT(_SYMB,KC_GRV), ___________ERGODOX_BOTTOM_LEFT_____________, + ALT_T(KC_APP), KC_LGUI, + KC_HOME, + KC_SPACE,KC_BSPC, KC_END, // right hand - TG(_MOUS), KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, - TG(_DIABLO), KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS, - KC_H, KC_N, KC_E, KC_I, KC_O, GUI_T(KC_QUOTE), - TG(_GAMEPAD),KC_K, KC_M, KC_COMM,KC_DOT, RCTL_T(KC_SLASH), OSM(MOD_RSFT), - KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, TT(_SYMB), - KC_RGUI, CTL_T(KC_ESC), - KC_PGUP, - KC_PGDN,KC_DELETE, KC_ENT + TG(_MOUS), KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + TG(_DIABLO), _________________COLEMAK_R1________________, KC_BSLS, + _________________COLEMAK_R2________________, GUI_T(KC_QUOT), + TG(_GAMEPAD), _________________COLEMAK_R3________________, KC_RSFT, + ___________ERGODOX_BOTTOM_RIGHT____________, TT(_SYMB), + KC_RGUI, CTL_T(KC_ESCAPE), + KC_PGUP, + KC_PGDOWN, KC_DELETE, KC_ENTER ), /* Keymap 0: Basic layer * @@ -134,25 +134,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ // If it accepts an argument (i.e, is a function), it doesn't need KC_. // Otherwise, it needs KC_* -[_DVORAK] = LAYOUT_ergodox( +[_DVORAK] = LAYOUT_ergodox_wrapper( // left hand - KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(_MOUS), - KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, TG(_DIABLO), - KC_BSPC, KC_A, KC_O, KC_E, KC_U, KC_I, - KC_LSFT, LCTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, TG(_GAMEPAD), - LT(_SYMB,KC_GRV),KC_QUOT, KC_LGUI, KC_LBRACKET, KC_RBRACKET, - ALT_T(KC_APP), KC_LEAD, - KC_HOME, - KC_SPC,KC_BSPC,KC_END, + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(_MOUS), + KC_TAB, _________________DVORAK_L1_________________, TG(_DIABLO), + KC_BSPC, _________________DVORAK_L2_________________, + KC_LSFT, _________________DVORAK_L3_________________, TG(_GAMEPAD), + LT(_SYMB,KC_GRV), ___________ERGODOX_BOTTOM_LEFT_____________, + ALT_T(KC_APP), KC_LGUI, + KC_HOME, + KC_SPACE,KC_BSPC, KC_END, // right hand - TG(_MOUS), KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS, - TG(_DIABLO), KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, - KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, - TG(_GAMEPAD),KC_B, KC_M, KC_W, KC_V, RCTL_T(KC_Z), OSM(MOD_RSFT), - KC_LEFT,KC_DOWN,KC_UP, KC_RIGHT, TT(_SYMB), - KC_LALT, CTL_T(KC_ESC), - KC_PGUP, - KC_PGDN,KC_DELETE, KC_ENT + TG(_MOUS), KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS, + TG(_DIABLO), _________________DVORAK_R1_________________, KC_SLSH, + _________________DVORAK_R2_________________, GUI_T(KC_MINS), + TG(_GAMEPAD), _________________DVORAK_R3_________________, KC_RSFT, + ___________ERGODOX_BOTTOM_RIGHT____________, TT(_SYMB), + KC_RGUI, CTL_T(KC_ESCAPE), + KC_PGUP, + KC_PGDOWN, KC_DELETE, KC_ENTER ), /* Keymap 0: Basic layer * @@ -177,27 +177,47 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ // If it accepts an argument (i.e, is a function), it doesn't need KC_. // Otherwise, it needs KC_* -[_WORKMAN] = LAYOUT_ergodox( +[_WORKMAN] = LAYOUT_ergodox_wrapper( // left hand - KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(_MOUS), - KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, TG(_DIABLO), - KC_BSPC, KC_A, KC_S, KC_H, KC_T, KC_G, - KC_LSFT, LCTL_T(KC_Z), KC_X, KC_M, KC_C, KC_V, TG(_GAMEPAD), - LT(_SYMB,KC_GRV),KC_QUOT, KC_LGUI, KC_LBRACKET,KC_RBRACKET, - ALT_T(KC_APP), KC_LEAD, - KC_HOME, - KC_SPC,KC_BSPC,KC_END, + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(_MOUS), + KC_TAB, _________________WORKMAN_L1________________, TG(_DIABLO), + KC_BSPC, _________________WORKMAN_L2________________, + KC_LSFT, _________________WORKMAN_L3________________, TG(_GAMEPAD), + LT(_SYMB,KC_GRV), ___________ERGODOX_BOTTOM_LEFT_____________, + ALT_T(KC_APP), KC_LGUI, + KC_HOME, + KC_SPACE,KC_BSPC, KC_END, // right hand - TG(_MOUS), KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, - TG(_DIABLO), KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSLS, - KC_Y, KC_N, KC_E, KC_O, KC_I, KC_QUOTE, - TG(_GAMEPAD),KC_K, KC_L, KC_COMM,KC_DOT, RCTL_T(KC_SLASH), OSM(MOD_RSFT), - KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, TT(_SYMB), - KC_LALT, CTL_T(KC_ESC), - KC_PGUP, - KC_PGDN,KC_DELETE, KC_ENT + TG(_MOUS), KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + TG(_DIABLO), _________________WORKMAN_R1________________, KC_BSLS, + _________________WORKMAN_R2________________, GUI_T(KC_QUOT), + TG(_GAMEPAD), _________________WORKMAN_R3________________, KC_RSFT, + ___________ERGODOX_BOTTOM_RIGHT____________, TT(_SYMB), + KC_RGUI, CTL_T(KC_ESCAPE), + KC_PGUP, + KC_PGDOWN, KC_DELETE, KC_ENTER ), + [_MODS] = LAYOUT_ergodox( + 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, + OSM(MOD_LSFT),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, + 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, OSM(MOD_RSFT), + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS + ), + /* Keymap 3: Symbol Layer * * ,--------------------------------------------------. ,--------------------------------------------------. @@ -220,11 +240,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `--------------------' `--------------------' */ [_SYMB] = LAYOUT_ergodox( - EPRM, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_WORKMAN, - VRSN, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, KC_DVORAK, + EPRM, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, TG(_MODS), + VRSN, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, KC_WORKMAN, KC_MAKE, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_GRAVE, KC_RESET, KC_PERC, KC_CIRC, KC_LBRACKET,KC_RBRACKET,KC_TILD, KC_COLEMAK, - KC_TRNS, KC_AMPR, KC_ASTR, KC_COLN, KC_SCOLON, + KC_TRNS, KC_AMPR, KC_ASTR, KC_COLN, KC_SCOLON, RGB_SMOD, KC_RGB_T, RGB_HUI, RGB_M_R, RGB_M_SW, RGB_HUD, diff --git a/keyboards/orthodox/keymaps/drashna/config.h b/keyboards/orthodox/keymaps/drashna/config.h index d83b7792..c83380bd 100644 --- a/keyboards/orthodox/keymaps/drashna/config.h +++ b/keyboards/orthodox/keymaps/drashna/config.h @@ -68,7 +68,7 @@ along with this program. If not, see . #ifdef AUDIO_ENABLE #define C6_AUDIO -#define STARTUP_SONG SONG(ZELDA_TREASURE) +#define STARTUP_SONG SONG(IMPERIAL_MARCH) #endif #undef PRODUCT diff --git a/keyboards/orthodox/keymaps/drashna/keymap.c b/keyboards/orthodox/keymaps/drashna/keymap.c index f74b39ae..cb76a20b 100644 --- a/keyboards/orthodox/keymaps/drashna/keymap.c +++ b/keyboards/orthodox/keymaps/drashna/keymap.c @@ -31,49 +31,54 @@ along with this program. If not, see . // Fillers to make layering more clear #define _______ KC_TRNS #define XXXXXXX KC_NO - +#define KC_MSHF OSM(MOD_LSFT) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[_QWERTY] = KEYMAP(\ - 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_UP, KC_DOWN, KC_LEFT, KC_RIGHT, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ - KC_LSFT,CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH), KC_LGUI \ +[_QWERTY] = KEYMAP_wrapper(\ + KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC, \ + KC_TAB, _________________QWERTY_L2_________________, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, _________________QWERTY_R2_________________, KC_QUOT, \ + KC_LSFT, _________________QWERTY_L3_________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________QWERTY_R3_________________, KC_LGUI \ ), -[_COLEMAK] = KEYMAP(\ - 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_UP, KC_DOWN, KC_LEFT, KC_RIGHT, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ - KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_K, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH), KC_LGUI \ +[_COLEMAK] = KEYMAP_wrapper(\ + KC_ESC, _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, KC_BSPC, \ + KC_TAB, _________________COLEMAK_L2________________, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, _________________COLEMAK_R2________________, KC_QUOT, \ + KC_LSFT, _________________COLEMAK_L3________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________COLEMAK_R3________________, KC_LGUI \ ), -[_DVORAK] = KEYMAP(\ - KC_ESC, KC_QUOT, KC_COMM, KC_DOT, 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_UP, KC_DOWN, KC_LEFT, KC_RIGHT, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, \ - KC_LSFT, CTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z), KC_LGUI \ +[_DVORAK] = KEYMAP_wrapper(\ + KC_ESC, _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, KC_BSPC, \ + KC_TAB, _________________DVORAK_L2_________________, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, _________________DVORAK_R2_________________, KC_MINS, \ + KC_LSFT, _________________DVORAK_L3_________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________DVORAK_R3_________________, KC_LGUI \ +), +[_WORKMAN] = KEYMAP_wrapper(\ + KC_ESC, _________________WORKMAN_L1________________, _________________WORKMAN_R1________________, KC_BSPC, \ + KC_TAB, _________________WORKMAN_L2________________, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, _________________WORKMAN_R2________________, KC_MINS, \ + KC_LSFT, _________________WORKMAN_L3________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________WORKMAN_R3________________, KC_LGUI \ ), -[_WORKMAN] = KEYMAP(\ - KC_ESC, KC_QUOT, KC_COMM, KC_DOT, 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_UP, KC_DOWN, KC_LEFT, KC_RIGHT, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, \ - KC_LSFT,CTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, LOWER, KC_SPACE, KC_BSPC, KC_DEL, KC_ENT, RAISE, KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z), KC_LGUI \ +[_MODS] = KEYMAP(\ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + OSM(MOD_LSFT), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ ), [_LOWER] = KEYMAP(\ - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ - KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, KC_F12, _______, KC_RCTL, XXXXXXX, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ - _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, _______, _______, _______, _______, _______, XXXXXXX, KC_HOME, KC_COMM, KC_DOT, KC_END, _______ \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, KC_F12, _______, KC_RCTL, XXXXXXX, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ + _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, _______, _______, _______, _______, _______, XXXXXXX, KC_HOME, KC_COMM, KC_DOT, KC_END, _______ \ ), [_RAISE] = KEYMAP(\ - 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_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, KC_F12, _______, _______, XXXXXXX, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ - _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, _______, _______, _______, _______, _______, XXXXXXX, KC_PGUP, KC_COMM, KC_DOT, KC_PGDN, _______ \ + 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_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, KC_F12, _______, _______, XXXXXXX, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ + _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, _______, _______, _______, _______, _______, XXXXXXX, KC_PGUP, KC_COMM, KC_DOT, KC_PGDN, _______ \ ), [_ADJUST] = KEYMAP(\ - KC_MAKE,KC_RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - RGB_SMOD,RGB_HUI, KC_FXCL, AUD_ON, AUD_OFF, AG_NORM, _______, _______, _______, _______, AG_SWAP, KC_QWERTY, KC_COLEMAK, KC_DVORAK, KC_WORKMAN, _______, \ - KC_RGB_T,RGB_HUD, MU_ON, MU_OFF, MU_TOG, MU_MOD, _______, _______, _______, _______, _______, _______, MAGIC_TOGGLE_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY \ + KC_MAKE,KC_RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + RGB_SMOD,RGB_HUI, KC_FXCL, AUD_ON, AUD_OFF, AG_NORM, _______, _______, _______, _______, AG_SWAP, KC_QWERTY, KC_COLEMAK, KC_DVORAK, KC_WORKMAN, TG(_MODS), \ + KC_RGB_T,RGB_HUD, MU_ON, MU_OFF, MU_TOG, MU_MOD, _______, _______, _______, _______, _______, _______, MAGIC_TOGGLE_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY \ ) diff --git a/keyboards/orthodox/keymaps/drashna/rules.mk b/keyboards/orthodox/keymaps/drashna/rules.mk index c4cf6629..222a4364 100644 --- a/keyboards/orthodox/keymaps/drashna/rules.mk +++ b/keyboards/orthodox/keymaps/drashna/rules.mk @@ -7,5 +7,3 @@ TAP_DANCE_ENABLE = no RGBLIGHT_ENABLE = yes AUDIO_ENABLE = yes NKRO_ENABLE = yes -FAUXCLICKY_ENABLE = no -USE_I2C = no diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index a07d7440..6039c7c5 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -166,7 +166,7 @@ void matrix_init_user(void) { } #endif #ifdef AUDIO_ENABLE -// _delay_ms(21); // gets rid of tick +// wait_ms(21); // gets rid of tick // stop_all_notes(); // PLAY_SONG(tone_hackstartup); #endif @@ -329,7 +329,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("Salt, salt, salt..."); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -340,7 +340,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("Please sir, can I have some more salt?!"); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -351,7 +351,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("Your salt only makes me harder, and even more aggressive!"); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -362,7 +362,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("Good game, everyone!"); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -373,7 +373,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("Good luck, have fun!!!"); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -384,7 +384,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("Left click to win!"); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -395,7 +395,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("It may be a game, but if you don't want to actually try, please go play AI, so that people that actually want to take the game seriously and \"get good\" have a place to do so without trolls like you throwing games."); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -406,7 +406,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("That was positively riveting!"); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -417,9 +417,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("That aim is absolutely amazing. It's almost like you're a machine!" SS_TAP(X_ENTER)); - _delay_ms(3000); + wait_ms(3000); register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); SEND_STRING("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!" SS_TAP(X_ENTER)); @@ -430,7 +430,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("OMG!!! C9!!!"); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -441,7 +441,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("That was a fantastic game, though it was a bit easy. Try harder next time!"); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -470,16 +470,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { ":teensy" //#elif defined(BOOTLOADER_CATERINA) // ":avrdude" -#endif -#ifdef RGBLIGHT_ENABLE - " RGBLIGHT_ENABLE=yes" -#else - " RGBLIGHT_ENABLE=no" -#endif -#ifdef AUDIO_ENABLE - " AUDIO_ENABLE=yes" -#else - " AUDIO_ENABLE=no" #endif SS_TAP(X_ENTER)); } diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index aa9c8308..8354c55c 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -26,8 +26,10 @@ along with this program. If not, see . #define _COLEMAK 1 #define _DVORAK 2 #define _WORKMAN 3 -#define _NAV 5 -#define _COVECUBE 6 +#define _MODS 4 +//#define _MISC 5 +#define _NAV 6 +#define _COVECUBE 7 #define _SYMB 8 #define _GAMEPAD 9 #define _DIABLO 10 @@ -142,4 +144,61 @@ enum { #define AUD_OFF AU_OFF #endif + + +// Since our quirky block definitions are basically a list of comma separated +// arguments, we need a wrapper in order for these definitions to be +// expanded before being used as arguments to the LAYOUT_xxx macro. +#define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__) +#define KEYMAP_wrapper(...) KEYMAP(__VA_ARGS__) + +// Blocks for each of the four major keyboard layouts +// Organized so we can quickly adapt and modify all of them +// at once, rather than for each keyboard, one at a time. +// And this allows wor much cleaner blocks in the keymaps. +// For instance Tap/Hold for Control on all of the layouts + +#define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T +#define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G +#define _________________QWERTY_L3_________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B + +#define _________________QWERTY_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P +#define _________________QWERTY_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN +#define _________________QWERTY_R3_________________ KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH) + + +#define _________________COLEMAK_L1________________ KC_Q, KC_W, KC_F, KC_P, KC_G +#define _________________COLEMAK_L2________________ KC_A, KC_R, KC_S, KC_T, KC_D +#define _________________COLEMAK_L3________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B + +#define _________________COLEMAK_R1________________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN +#define _________________COLEMAK_R2________________ KC_H, KC_N, KC_E, KC_I, KC_O +#define _________________COLEMAK_R3________________ KC_K, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH) + + +#define _________________DVORAK_L1_________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y +#define _________________DVORAK_L2_________________ KC_A, KC_O, KC_E, KC_U, KC_I +#define _________________DVORAK_L3_________________ CTL_T(KC_SCLN),KC_Q, KC_J, KC_K, KC_X + +#define _________________DVORAK_R1_________________ KC_F, KC_G, KC_C, KC_R, KC_L +#define _________________DVORAK_R2_________________ KC_D, KC_H, KC_T, KC_N, KC_S +#define _________________DVORAK_R3_________________ KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z) + + +#define _________________WORKMAN_L1________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y +#define _________________WORKMAN_L2________________ KC_A, KC_O, KC_E, KC_U, KC_I +#define _________________WORKMAN_L3________________ CTL_T(KC_SCLN),KC_Q, KC_J, KC_K, KC_X + +#define _________________WORKMAN_R1________________ KC_F, KC_G, KC_C, KC_R, KC_L +#define _________________WORKMAN_R2________________ KC_D, KC_H, KC_T, KC_N, KC_S +#define _________________WORKMAN_R3________________ KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z) + + + +// Since we have 4 default layouts (QWERTY, DVORAK, COLEMAK and WORKMAN), +// this allows us to quickly modify the bottom row for all of the layouts +// so we don't have to alter it 4 times and hope that we haven't missed +// anything +#define ___________ERGODOX_BOTTOM_LEFT_____________ KC_QUOT, KC_LGUI, KC_LBRC, KC_RBRC +#define ___________ERGODOX_BOTTOM_RIGHT____________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT #endif diff --git a/users/drashna/readme.md b/users/drashna/readme.md index e77948ea..92792fb9 100644 --- a/users/drashna/readme.md +++ b/users/drashna/readme.md @@ -20,6 +20,22 @@ This allows for keyboard specific configuration while maintaining the ability to My [Ergodox EZ Keymap](https://github.com/qmk/qmk_firmware/blob/master/keyboards/ergodox_ez/keymaps/drashna/keymap.c#L399) is a good example of this, as it uses the LEDs as modifier indicators. +Keyboard Layout Templates +------------------------- + +This borrows from @jola5's "Not quite neo" code. This allows me to maintain blocks of keymaps in the userspace, so that I can modify the userspace, and this is reflected in all of the keyboards that use it, at once. + +This makes adding tap/hold mods, or other special keycodes or functions to all keyboards super easy, as it's done to all of them at once. + +The caveat here is that the keymap needs a processor/wrapper, as it doesn't like the substitutions. However, this is as simple as just pushing it through a define. For instance: + +`#define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__)` + +Once that's been done and you've switched the keymaps to use the "wrapper", it will read the substitution blocks just fine. + +Credit goes to @jola5 for first implementing this awesome idea. + + Custom Keycodes --------------- From 2908c0f9277d021d35133940d6a4d77569229ecf Mon Sep 17 00:00:00 2001 From: KeLorean Date: Sun, 4 Feb 2018 13:44:58 -0500 Subject: [PATCH 054/173] made kelorean keymaps for planck and s65x (#2331) * Planck-swapped up/down arrows,s65x-add dvorak * Added Dvorak as first layer of default keymap * planck-swap up and down arrows. s65x-added dvorak * added colemak to kelorean s65x keymap --- keyboards/planck/keymaps/kelorean/config.h | 42 ++++ keyboards/planck/keymaps/kelorean/keymap.c | 264 ++++++++++++++++++++ keyboards/planck/keymaps/kelorean/readme.md | 2 + keyboards/planck/keymaps/kelorean/rules.mk | 0 keyboards/s65_x/keymaps/kelorean/keymap.c | 155 ++++++++++++ keyboards/s65_x/keymaps/kelorean/readme.md | 81 ++++++ 6 files changed, 544 insertions(+) create mode 100644 keyboards/planck/keymaps/kelorean/config.h create mode 100644 keyboards/planck/keymaps/kelorean/keymap.c create mode 100644 keyboards/planck/keymaps/kelorean/readme.md create mode 100644 keyboards/planck/keymaps/kelorean/rules.mk create mode 100644 keyboards/s65_x/keymaps/kelorean/keymap.c create mode 100644 keyboards/s65_x/keymaps/kelorean/readme.md diff --git a/keyboards/planck/keymaps/kelorean/config.h b/keyboards/planck/keymaps/kelorean/config.h new file mode 100644 index 00000000..a1635f2b --- /dev/null +++ b/keyboards/planck/keymaps/kelorean/config.h @@ -0,0 +1,42 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +#ifdef AUDIO_ENABLE + #define STARTUP_SONG SONG(PLANCK_SOUND) + // #define STARTUP_SONG SONG(NO_SOUND) + + #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ + SONG(COLEMAK_SOUND), \ + SONG(DVORAK_SOUND) \ + } +#endif + +#define MUSIC_MASK (keycode != KC_NO) + +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ + +#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 + +#endif \ No newline at end of file diff --git a/keyboards/planck/keymaps/kelorean/keymap.c b/keyboards/planck/keymaps/kelorean/keymap.c new file mode 100644 index 00000000..7578d26b --- /dev/null +++ b/keyboards/planck/keymaps/kelorean/keymap.c @@ -0,0 +1,264 @@ +/* Copyright 2015-2017 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 "planck.h" +#include "action_layer.h" + +extern keymap_config_t keymap_config; + +enum planck_layers { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _PLOVER, + _ADJUST +}; + +enum planck_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + PLOVER, + LOWER, + RAISE, + BACKLIT, + EXT_PLV +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_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 }, + {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_UP, KC_DOWN, KC_RGHT} +}, + +/* Colemak + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_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 }, + {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + +/* Dvorak + * ,-----------------------------------------------------------------------------------. + * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_DVORAK] = { + {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, + {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, + {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, + {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = { + {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, + {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_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_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, + +/* Plover layer (http://opensteno.org) + * ,-----------------------------------------------------------------------------------. + * | # | # | # | # | # | # | # | # | # | # | # | # | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | S | T | P | H | * | * | F | P | L | T | D | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | S | K | W | R | * | * | R | B | G | S | Z | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Exit | | | A | O | | E | U | | | | + * `-----------------------------------------------------------------------------------' + */ + +[_PLOVER] = { + {KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 }, + {XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC}, + {XXXXXXX, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {EXT_PLV, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX} +}, + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | Reset| | | | | | | | | | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = { + {_______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL }, + {_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______}, + {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +} + + +}; + +#ifdef AUDIO_ENABLE + float plover_song[][2] = SONG(PLOVER_SOUND); + float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +#endif + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + print("mode just switched to qwerty and this is a huge string\n"); + set_single_persistent_default_layer(_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_DVORAK); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + PORTE &= ~(1<<6); + } else { + unregister_code(KC_RSFT); + PORTE |= (1<<6); + } + return false; + break; + case PLOVER: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + stop_all_notes(); + PLAY_SONG(plover_song); + #endif + layer_off(_RAISE); + layer_off(_LOWER); + layer_off(_ADJUST); + layer_on(_PLOVER); + if (!eeconfig_is_enabled()) { + eeconfig_init(); + } + keymap_config.raw = eeconfig_read_keymap(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + } + return false; + break; + case EXT_PLV: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(plover_gb_song); + #endif + layer_off(_PLOVER); + } + return false; + break; + } + return true; +} diff --git a/keyboards/planck/keymaps/kelorean/readme.md b/keyboards/planck/keymaps/kelorean/readme.md new file mode 100644 index 00000000..61146cbc --- /dev/null +++ b/keyboards/planck/keymaps/kelorean/readme.md @@ -0,0 +1,2 @@ +# The Default Planck Layout +Swapped up and down arrows. diff --git a/keyboards/planck/keymaps/kelorean/rules.mk b/keyboards/planck/keymaps/kelorean/rules.mk new file mode 100644 index 00000000..e69de29b diff --git a/keyboards/s65_x/keymaps/kelorean/keymap.c b/keyboards/s65_x/keymaps/kelorean/keymap.c new file mode 100644 index 00000000..20fe0fdb --- /dev/null +++ b/keyboards/s65_x/keymaps/kelorean/keymap.c @@ -0,0 +1,155 @@ +#include "s65_x.h" + +#define _BL 0 +#define _CM 1 +#define _DV 2 +#define _AL 3 +#define _FL 4 +#define _UL 5 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* 0: Main layer, swapped alt and GUI for Mac + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │ ESC │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │▒▒▒▒▒│BKSPC│DEL │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ TAB │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │█████│END │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │BKSPC│ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │▒▒▒▒▒│ENTER│█████│PG_UP│ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │LSHFT│▒▒▒▒▒│ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │▒▒▒▒▒│RSHFT│ UP │PG_DN│ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │LCTRL│L_ALT│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ FN0 │ APP │LEFT │DOWN │RIGHT│ + * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + */ + + /* 0: ANSI qwerty */ + [_BL] = ANSI_KEYMAP( + KC_GESC, 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, 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_LBRC, KC_RBRC, KC_BSLS, KC_END, \ + F(4), 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_PGUP, \ + 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_UP, KC_PGDN, \ + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, MO(_FL), KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT), + + + /* 1: Colemak layer + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │ ESC │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │▒▒▒▒▒│BKSPC│DEL │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ TAB │ Q │ W │ F │ P │ G │ J │ L │ U │ Y │ ; │ [ │ ] │ \ │█████│END │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │BKSPC│ A │ R │ S │ T │ D │ H │ N │ E │ I │ O │ ' │▒▒▒▒▒│ENTER│█████│PG_UP│ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │LSHFT│▒▒▒▒▒│ Z │ X │ C │ V │ B │ K │ M │ , │ . │ / │▒▒▒▒▒│RSHFT│ UP │PG_DN│ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │LCTRL│L_ALT│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ FN0 │ APP │LEFT │DOWN │RIGHT│ + * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + */ + + /* 1: Colemak layer */ + [_CM] = ANSI_KEYMAP( + KC_GESC, 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, 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_LBRC, KC_RBRC, KC_BSLS, KC_END, \ + F(4), KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT, KC_PGUP, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, \ + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, MO(_FL), KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT), + + + /* 2: Dvorak layer + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │ ESC │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ [ │ ] │▒▒▒▒▒│BKSPC│DEL │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ TAB │ ' │ , │ . │ P │ Y │ F │ G │ C │ R │ L │ / │ = │ \ │█████│END │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │BKSPC│ A │ O │ E │ U │ I │ D │ H │ T │ N │ S │ - │▒▒▒▒▒│ENTER│█████│PG_UP│ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │LSHFT│▒▒▒▒▒│ ; │ Q │ J │ K │ X │ B │ M │ W │ V │ Z │▒▒▒▒▒│RSHFT│ UP │PG_DN│ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │LCTRL│L_ALT│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ FN0 │ APP │LEFT │DOWN │RIGHT│ + * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + */ + + /* 2: Dvorak layer */ + [_DV] = ANSI_KEYMAP( + KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_BSPC, KC_DEL, \ + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSLS, KC_END, \ + F(4), KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_ENT, KC_PGUP, \ + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, KC_UP, KC_PGDN, \ + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, MO(_FL), KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT), + + /* 3: Locking arrow keys to WASD for when you need dedicated arrow keys + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│▒▒▒▒▒│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ Up │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │Left │Down │Right│ │ │ │ │ │ │ │ │▒▒▒▒▒│ │▒▒▒▒▒│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │▒▒▒▒▒│ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │ │ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ │ │ │ │ │ + * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + */ + + [_AL] = ANSI_KEYMAP( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, KC_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + /* 4: Fn layer + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │GRAVE│ F1 │ F2 │ F3 │ F4 │ F5 │ F6 │ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │▒▒▒▒▒│▒▒▒▒▒│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ _AL │ Up │ │ │ │ │ │PGUP │PGDWN│PRTSC│SCLCK│PAUSE│ │▒▒▒▒▒│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │Left │Down │Right│ │ │Left │Down │ Up │Right│ │ │▒▒▒▒▒│ │▒▒▒▒▒│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │▒▒▒▒▒│_UL │ │_CM │_DV │ │ │ │ │Home │End │▒▒▒▒▒│ │Vol+ │ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ │ │Mute │Vol- │Play │ + * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + */ + + [_FL] = ANSI_KEYMAP( + KC_GRAVE, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, \ + _______, F(3), KC_UP, _______, _______, _______, _______, _______, KC_PGUP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, _______, _______, \ + _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, _______, _______, _______, _______, \ + _______, F(5), _______, F(1), F(2), _______, _______, _______, KC_HOME, KC_END, _______, _______, KC_VOLU, _______, \ + _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_VOLD, KC_MPLY), + + /* 5: Locking layer for controlling the underglow + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│▒▒▒▒▒│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │BL On│BL St│ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ On │Mode │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │▒▒▒▒▒│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │▒▒▒▒▒│ │Hue+ │Hue- │Sat+ │Sat- │Val+ │Val- │ │ │ │▒▒▒▒▒│ │▒▒▒▒▒│ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ │ │ │ │ │ + * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + */ + + [_UL] = ANSI_KEYMAP( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, BL_TOGG, BL_STEP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, RGB_TOG, RGB_MOD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + + +}; + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_MOMENTARY(_FL), // Momentary Fn overlay + [1] = ACTION_LAYER_TOGGLE(_CM), //Toggle Colemak Layer overlay + [2] = ACTION_LAYER_TOGGLE(_DV), // Toggle Dvorak Layer overlay + [3] = ACTION_LAYER_TOGGLE(_AL), // Toggle Arrow Layer overlay + [4] = ACTION_LAYER_TAP_KEY(_FL, KC_BSPC), // Tap to Backspace and hold to activate function layer + [5] = ACTION_LAYER_TOGGLE(_UL), // Toggle Underglow Layer overlay + +}; + diff --git a/keyboards/s65_x/keymaps/kelorean/readme.md b/keyboards/s65_x/keymaps/kelorean/readme.md new file mode 100644 index 00000000..be33069e --- /dev/null +++ b/keyboards/s65_x/keymaps/kelorean/readme.md @@ -0,0 +1,81 @@ +### 1 ANSI +A Mac ANSI layout that assumes standard sized shifts, enter, and backspace keys, Arrow layer, FN layers and Lighting functions layer... +I added Colemak and Dvorak layer as layer 1 & 2 under base QWERTY layer. + +#### 1.0 Default layer + ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + │ ESC │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │▒▒▒▒▒│BKSPC│DEL │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ TAB │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │▒▒▒▒▒│END │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │BKSPC│ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │▒▒▒▒▒│ENTER│▒▒▒▒▒│PG_UP│ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │LSHFT│▒▒▒▒▒│ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │▒▒▒▒▒│RSHFT│ UP │PG_DN│ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │LCTRL│L_ALT│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ FN0 │ APP │LEFT │DOWN │RIGHT│ + └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + +#### 1.1: Colemak layer + ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + │ ESC │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │▒▒▒▒▒│BKSPC│DEL │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ TAB │ Q │ W │ F │ P │ G │ J │ L │ U │ Y │ ; │ [ │ ] │ \ │█████│END │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │BKSPC│ A │ R │ S │ T │ D │ H │ N │ E │ I │ O │ ' │▒▒▒▒▒│ENTER│█████│PG_UP│ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │LSHFT│▒▒▒▒▒│ Z │ X │ C │ V │ B │ K │ M │ , │ . │ / │▒▒▒▒▒│RSHFT│ UP │PG_DN│ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │LCTRL│L_ALT│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ FN0 │ APP │LEFT │DOWN │RIGHT│ + └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + +#### 1.2: Dvorak layer + ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + │ ESC │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ [ │ ] │▒▒▒▒▒│BKSPC│DEL │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ TAB │ ' │ , │ . │ P │ Y │ F │ G │ C │ R │ L │ / │ = │ \ │█████│END │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │BKSPC│ A │ O │ E │ U │ I │ D │ H │ T │ N │ S │ - │▒▒▒▒▒│ENTER│█████│PG_UP│ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │LSHFT│▒▒▒▒▒│ ; │ Q │ J │ K │ X │ B │ M │ W │ V │ Z │▒▒▒▒▒│RSHFT│ UP │PG_DN│ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │LCTRL│L_ALT│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ FN0 │ APP │LEFT │DOWN │RIGHT│ + └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + +#### 1.3 Arrow layer + ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│▒▒▒▒▒│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │ │ Up │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │Left │Down │Right│ │ │ │ │ │ │ │ │▒▒▒▒▒│ │▒▒▒▒▒│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │▒▒▒▒▒│ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │ │ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ │ │ │ │ │ + └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + +#### 1.4 Fn layer + ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + │GRAVE│ F1 │ F2 │ F3 │ F4 │ F5 │ F6 │ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │▒▒▒▒▒│▒▒▒▒▒│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │ _AL │ Up │ │ │ │ │ │PGUP │PGDWN│PRTSC│SCLCK│PAUSE│ │▒▒▒▒▒│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │Left │Down │Right│ │ │Left │Down │ Up │Right│ │ │▒▒▒▒▒│ │▒▒▒▒▒│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │▒▒▒▒▒│_UL │ │_CM │_DV │ │ │ │Home │ End │ │▒▒▒▒▒│▒▒▒▒▒│Vol+ │ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ │ │Mute │Vol- │Play │ + └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + +#### 1.5 Underglow layer + ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│▒▒▒▒▒│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │BL On│BL St│ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │ On │Mode │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│ │▒▒▒▒▒│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │▒▒▒▒▒│ │Hue+ │Hue- │Sat+ │Sat- │Val+ │Val- │ │ │ │▒▒▒▒▒│ │▒▒▒▒▒│ │ + ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ │ │ │ │ │ + └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ From 9fcda95363568156887c76867e843a86f8f75757 Mon Sep 17 00:00:00 2001 From: scauligi Date: Sun, 4 Feb 2018 10:45:19 -0800 Subject: [PATCH 055/173] Fixes to get tap dance to fire at proper places (#2272) * tap dance fixes: fire immediately upon completion and also get properly interrupted before macros * bugfix for tapdance improvement * fix build --- quantum/process_keycode/process_tap_dance.c | 73 +++++++++++++-------- quantum/process_keycode/process_tap_dance.h | 7 +- quantum/quantum.c | 4 ++ 3 files changed, 53 insertions(+), 31 deletions(-) diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index f196a9cb..94dd17c2 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c @@ -21,6 +21,15 @@ uint8_t get_oneshot_mods(void); static uint16_t last_td; static int8_t highest_td = -1; +void qk_tap_dance_pair_on_each_tap (qk_tap_dance_state_t *state, void *user_data) { + qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data; + + if (state->count == 2) { + register_code16 (pair->kc2); + state->finished = true; + } +} + void qk_tap_dance_pair_finished (qk_tap_dance_state_t *state, void *user_data) { qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data; @@ -41,6 +50,15 @@ void qk_tap_dance_pair_reset (qk_tap_dance_state_t *state, void *user_data) { } } +void qk_tap_dance_dual_role_on_each_tap (qk_tap_dance_state_t *state, void *user_data) { + qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data; + + if (state->count == 2) { + layer_move (pair->layer); + state->finished = true; + } +} + void qk_tap_dance_dual_role_finished (qk_tap_dance_state_t *state, void *user_data) { qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data; @@ -92,13 +110,30 @@ static inline void process_tap_dance_action_on_reset (qk_tap_dance_action_t *act send_keyboard_report(); } -bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { - uint16_t idx = keycode - QK_TAP_DANCE; +void preprocess_tap_dance(uint16_t keycode, keyrecord_t *record) { qk_tap_dance_action_t *action; - if (last_td && last_td != keycode) { - (&tap_dance_actions[last_td - QK_TAP_DANCE])->state.interrupted = true; + if (!record->event.pressed) + return; + + if (highest_td == -1) + return; + + for (int i = 0; i <= highest_td; i++) { + action = &tap_dance_actions[i]; + if (action->state.count) { + if (keycode == action->state.keycode && keycode == last_td) + continue; + action->state.interrupted = true; + process_tap_dance_action_on_dance_finished (action); + reset_tap_dance (&action->state); + } } +} + +bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { + uint16_t idx = keycode - QK_TAP_DANCE; + qk_tap_dance_action_t *action; switch(keycode) { case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: @@ -116,34 +151,14 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { action->state.weak_mods |= get_weak_mods(); process_tap_dance_action_on_each_tap (action); - if (last_td && last_td != keycode) { - qk_tap_dance_action_t *paction = &tap_dance_actions[last_td - QK_TAP_DANCE]; - paction->state.interrupted = true; - process_tap_dance_action_on_dance_finished (paction); - reset_tap_dance (&paction->state); - } - last_td = keycode; + } else { + if (action->state.count && action->state.finished) { + reset_tap_dance (&action->state); + } } break; - - default: - if (!record->event.pressed) - return true; - - if (highest_td == -1) - return true; - - for (int i = 0; i <= highest_td; i++) { - action = &tap_dance_actions[i]; - if (action->state.count == 0) - continue; - action->state.interrupted = true; - process_tap_dance_action_on_dance_finished (action); - reset_tap_dance (&action->state); - } - break; } return true; @@ -156,7 +171,7 @@ void matrix_scan_tap_dance () { return; uint16_t tap_user_defined; -for (uint8_t i = 0; i <= highest_td; i++) { + for (uint8_t i = 0; i <= highest_td; i++) { qk_tap_dance_action_t *action = &tap_dance_actions[i]; if(action->custom_tapping_term > 0 ) { tap_user_defined = action->custom_tapping_term; diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h index ab20ea04..8b0a47c4 100644 --- a/quantum/process_keycode/process_tap_dance.h +++ b/quantum/process_keycode/process_tap_dance.h @@ -62,12 +62,12 @@ typedef struct } qk_tap_dance_dual_role_t; #define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) { \ - .fn = { NULL, qk_tap_dance_pair_finished, qk_tap_dance_pair_reset }, \ + .fn = { qk_tap_dance_pair_on_each_tap, qk_tap_dance_pair_finished, qk_tap_dance_pair_reset }, \ .user_data = (void *)&((qk_tap_dance_pair_t) { kc1, kc2 }), \ } #define ACTION_TAP_DANCE_DUAL_ROLE(kc, layer) { \ - .fn = { NULL, qk_tap_dance_dual_role_finished, qk_tap_dance_dual_role_reset }, \ + .fn = { qk_tap_dance_dual_role_on_each_tap, qk_tap_dance_dual_role_finished, qk_tap_dance_dual_role_reset }, \ .user_data = (void *)&((qk_tap_dance_dual_role_t) { kc, layer }), \ } @@ -91,13 +91,16 @@ extern qk_tap_dance_action_t tap_dance_actions[]; /* To be used internally */ +void preprocess_tap_dance(uint16_t keycode, keyrecord_t *record); bool process_tap_dance(uint16_t keycode, keyrecord_t *record); void matrix_scan_tap_dance (void); void reset_tap_dance (qk_tap_dance_state_t *state); +void qk_tap_dance_pair_on_each_tap (qk_tap_dance_state_t *state, void *user_data); void qk_tap_dance_pair_finished (qk_tap_dance_state_t *state, void *user_data); void qk_tap_dance_pair_reset (qk_tap_dance_state_t *state, void *user_data); +void qk_tap_dance_dual_role_on_each_tap (qk_tap_dance_state_t *state, void *user_data); void qk_tap_dance_dual_role_finished (qk_tap_dance_state_t *state, void *user_data); void qk_tap_dance_dual_role_reset (qk_tap_dance_state_t *state, void *user_data); diff --git a/quantum/quantum.c b/quantum/quantum.c index f5246d9b..d3685f50 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -209,6 +209,10 @@ bool process_record_quantum(keyrecord_t *record) { // return false; // } + #ifdef TAP_DANCE_ENABLE + preprocess_tap_dance(keycode, record); + #endif + if (!( #if defined(KEY_LOCK_ENABLE) // Must run first to be able to mask key_up events. From 9aaa491bc0b7f904dca1be0d002efe0f0db86477 Mon Sep 17 00:00:00 2001 From: skullydazed Date: Mon, 5 Feb 2018 08:54:49 -0800 Subject: [PATCH 056/173] Add stm32 to drivers.txt --- util/drivers.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/drivers.txt b/util/drivers.txt index d21a748f..4e5439c3 100644 --- a/util/drivers.txt +++ b/util/drivers.txt @@ -4,6 +4,7 @@ # Driver can be one of winusb,libusb,libusbk # Use Windows Powershell and type [guid]::NewGuid() to generate guids winusb,Kiibohd DFU Bootloader,1C11,B007,aa5a3f86-b81e-4416-89ad-0c1ea1ed63af +winusb,STM32 Bootloader,0483,df11,6d98a87f-4ecf-464d-89ed-8c684d857a75 libusb,ATxmega16C4,03EB,2FD8,23266ee7-5423-4cc4-993b-034571c43a90 libusb,ATxmega32C4,03EB,2FD9,d4b62886-2ac8-4534-aa24-eae0a2c3ce43 libusb,ATxmega64C3,03EB,2FD6,08467ca7-9b5a-41d2-8d8a-4a26d0b5285b @@ -43,4 +44,4 @@ libusb,AT90USB162,03EB,2FFA,de67bff5-6e39-4e9c-8dfe-de7fce113716 libusb,AT90USB128,03EB,2FFB,fd217df3-59d0-440a-a8f3-4c0c8c84daa3 libusb,AT89C5130,03EB,2FFD,31b69a56-9ac0-4fab-a3ae-cd7bb7021ec5 libusb,AT8XC5122,03EB,2FFE,395a6118-8568-41b2-913a-d16912722342 -libusb,AT89C5132,03EB,2FFF,266ca4bc-5e59-4a7b-82dc-6e8732373d40 \ No newline at end of file +libusb,AT89C5132,03EB,2FFF,266ca4bc-5e59-4a7b-82dc-6e8732373d40 From 84a713b05cb50d01fc94e6b5b3e69420e7028d2c Mon Sep 17 00:00:00 2001 From: "U-LANDSRAAD\\drashna" Date: Mon, 5 Feb 2018 21:57:32 -0800 Subject: [PATCH 057/173] Remove _quantum functions from custom matrix.c code --- keyboards/chimera_ortho/matrix.c | 10 ---------- keyboards/deltasplit75/matrix.c | 9 --------- keyboards/dichotemy/matrix.c | 10 ---------- keyboards/eagle_viper/v2/matrix.c | 9 --------- keyboards/ergo42/matrix.c | 9 --------- keyboards/fc660c/matrix.c | 9 --------- keyboards/fc980c/matrix.c | 9 --------- keyboards/handwired/promethium/matrix.c | 9 --------- keyboards/helix/rev1/matrix.c | 9 --------- keyboards/helix/rev2/matrix.c | 9 --------- keyboards/iris/matrix.c | 8 -------- keyboards/kinesis/alvicstep/matrix.c | 9 --------- keyboards/lets_split/matrix.c | 9 --------- keyboards/levinson/matrix.c | 9 --------- keyboards/lightsaver/matrix.c | 9 --------- keyboards/meira/matrix.c | 9 --------- keyboards/minidox/matrix.c | 9 --------- keyboards/mitosis/matrix.c | 9 --------- keyboards/nyquist/matrix.c | 9 --------- keyboards/octagon/v1/matrix.c | 9 --------- keyboards/octagon/v2/matrix.c | 9 --------- keyboards/orthodox/matrix.c | 9 --------- keyboards/viterbi/matrix.c | 9 --------- 23 files changed, 208 deletions(-) diff --git a/keyboards/chimera_ortho/matrix.c b/keyboards/chimera_ortho/matrix.c index 0d046339..66d29f8b 100644 --- a/keyboards/chimera_ortho/matrix.c +++ b/keyboards/chimera_ortho/matrix.c @@ -47,16 +47,6 @@ along with this program. If not, see . /* matrix state(1:on, 0:off) */ static matrix_row_t matrix[MATRIX_ROWS]; -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} - __attribute__ ((weak)) void matrix_init_kb(void) { matrix_init_user(); diff --git a/keyboards/deltasplit75/matrix.c b/keyboards/deltasplit75/matrix.c index 4def2723..db84fb02 100644 --- a/keyboards/deltasplit75/matrix.c +++ b/keyboards/deltasplit75/matrix.c @@ -82,15 +82,6 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS]; static void unselect_col(uint8_t col); static void select_col(uint8_t col); #endif -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/dichotemy/matrix.c b/keyboards/dichotemy/matrix.c index 02e96e38..f2841df1 100644 --- a/keyboards/dichotemy/matrix.c +++ b/keyboards/dichotemy/matrix.c @@ -50,16 +50,6 @@ along with this program. If not, see . /* matrix state(1:on, 0:off) */ static matrix_row_t matrix[MATRIX_ROWS]; -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} - __attribute__ ((weak)) void matrix_init_kb(void) { matrix_init_user(); diff --git a/keyboards/eagle_viper/v2/matrix.c b/keyboards/eagle_viper/v2/matrix.c index c93766d1..7003a7ae 100644 --- a/keyboards/eagle_viper/v2/matrix.c +++ b/keyboards/eagle_viper/v2/matrix.c @@ -33,15 +33,6 @@ static void init_rows(void); static void unselect_cols(void); static void select_col(uint8_t col); -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/ergo42/matrix.c b/keyboards/ergo42/matrix.c index 47cda6fa..80d4ce46 100644 --- a/keyboards/ergo42/matrix.c +++ b/keyboards/ergo42/matrix.c @@ -82,15 +82,6 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS]; static void unselect_col(uint8_t col); static void select_col(uint8_t col); #endif -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/fc660c/matrix.c b/keyboards/fc660c/matrix.c index 69a96b97..e6e49481 100644 --- a/keyboards/fc660c/matrix.c +++ b/keyboards/fc660c/matrix.c @@ -86,15 +86,6 @@ static matrix_row_t _matrix0[MATRIX_ROWS]; static matrix_row_t _matrix1[MATRIX_ROWS]; -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/fc980c/matrix.c b/keyboards/fc980c/matrix.c index 3a3a13de..bde0f3c1 100644 --- a/keyboards/fc980c/matrix.c +++ b/keyboards/fc980c/matrix.c @@ -85,15 +85,6 @@ static matrix_row_t _matrix0[MATRIX_ROWS]; static matrix_row_t _matrix1[MATRIX_ROWS]; -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/handwired/promethium/matrix.c b/keyboards/handwired/promethium/matrix.c index 72dbe8d4..00f2b8e9 100644 --- a/keyboards/handwired/promethium/matrix.c +++ b/keyboards/handwired/promethium/matrix.c @@ -74,15 +74,6 @@ static void unselect_rows(void); static void select_row(uint8_t row); static void unselect_row(uint8_t row); -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/helix/rev1/matrix.c b/keyboards/helix/rev1/matrix.c index 375057a6..f2506868 100644 --- a/keyboards/helix/rev1/matrix.c +++ b/keyboards/helix/rev1/matrix.c @@ -60,15 +60,6 @@ static void init_cols(void); static void unselect_rows(void); static void select_row(uint8_t row); -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/helix/rev2/matrix.c b/keyboards/helix/rev2/matrix.c index 7ddbc210..a908360c 100644 --- a/keyboards/helix/rev2/matrix.c +++ b/keyboards/helix/rev2/matrix.c @@ -62,15 +62,6 @@ static void unselect_rows(void); static void select_row(uint8_t row); static uint8_t matrix_master_scan(void); -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/iris/matrix.c b/keyboards/iris/matrix.c index 3d8d2adb..dcfc0216 100644 --- a/keyboards/iris/matrix.c +++ b/keyboards/iris/matrix.c @@ -85,15 +85,7 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS]; static void unselect_col(uint8_t col); static void select_col(uint8_t col); #endif -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/kinesis/alvicstep/matrix.c b/keyboards/kinesis/alvicstep/matrix.c index cb0d5ad7..be2bab03 100644 --- a/keyboards/kinesis/alvicstep/matrix.c +++ b/keyboards/kinesis/alvicstep/matrix.c @@ -43,15 +43,6 @@ static matrix_row_t read_row(uint8_t row); static void unselect_rows(void); static void select_rows(uint8_t row); -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/lets_split/matrix.c b/keyboards/lets_split/matrix.c index 77def421..c3bfe804 100644 --- a/keyboards/lets_split/matrix.c +++ b/keyboards/lets_split/matrix.c @@ -82,15 +82,6 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS]; static void unselect_col(uint8_t col); static void select_col(uint8_t col); #endif -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/levinson/matrix.c b/keyboards/levinson/matrix.c index 9d8a14d1..ed913f34 100644 --- a/keyboards/levinson/matrix.c +++ b/keyboards/levinson/matrix.c @@ -85,15 +85,6 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS]; static void unselect_col(uint8_t col); static void select_col(uint8_t col); #endif -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/lightsaver/matrix.c b/keyboards/lightsaver/matrix.c index cb7b38fd..a07cdd0d 100644 --- a/keyboards/lightsaver/matrix.c +++ b/keyboards/lightsaver/matrix.c @@ -34,15 +34,6 @@ static void init_rows(void); static void unselect_cols(void); static void select_col(uint8_t col); -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/meira/matrix.c b/keyboards/meira/matrix.c index 40e94ba1..c1952f35 100644 --- a/keyboards/meira/matrix.c +++ b/keyboards/meira/matrix.c @@ -75,15 +75,6 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) static void unselect_cols(void); static void select_col(uint8_t col); -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/minidox/matrix.c b/keyboards/minidox/matrix.c index 81dfb144..27a38dca 100644 --- a/keyboards/minidox/matrix.c +++ b/keyboards/minidox/matrix.c @@ -60,15 +60,6 @@ static void init_cols(void); static void unselect_rows(void); static void select_row(uint8_t row); -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/mitosis/matrix.c b/keyboards/mitosis/matrix.c index 0d046339..4b87242b 100644 --- a/keyboards/mitosis/matrix.c +++ b/keyboards/mitosis/matrix.c @@ -47,15 +47,6 @@ along with this program. If not, see . /* matrix state(1:on, 0:off) */ static matrix_row_t matrix[MATRIX_ROWS]; -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/nyquist/matrix.c b/keyboards/nyquist/matrix.c index 21eef945..5fbae115 100644 --- a/keyboards/nyquist/matrix.c +++ b/keyboards/nyquist/matrix.c @@ -82,15 +82,6 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS]; static void unselect_col(uint8_t col); static void select_col(uint8_t col); #endif -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/octagon/v1/matrix.c b/keyboards/octagon/v1/matrix.c index 2d2a5adb..85553499 100644 --- a/keyboards/octagon/v1/matrix.c +++ b/keyboards/octagon/v1/matrix.c @@ -33,15 +33,6 @@ static void init_rows(void); static void unselect_cols(void); static void select_col(uint8_t col); -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/octagon/v2/matrix.c b/keyboards/octagon/v2/matrix.c index e113e507..a63a3764 100644 --- a/keyboards/octagon/v2/matrix.c +++ b/keyboards/octagon/v2/matrix.c @@ -33,15 +33,6 @@ static void init_rows(void); static void unselect_cols(void); static void select_col(uint8_t col); -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/orthodox/matrix.c b/keyboards/orthodox/matrix.c index 3b60cead..2ca5f4d8 100644 --- a/keyboards/orthodox/matrix.c +++ b/keyboards/orthodox/matrix.c @@ -64,15 +64,6 @@ static void init_cols(void); static void unselect_rows(void); static void select_row(uint8_t row); -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { diff --git a/keyboards/viterbi/matrix.c b/keyboards/viterbi/matrix.c index 21eef945..5fbae115 100644 --- a/keyboards/viterbi/matrix.c +++ b/keyboards/viterbi/matrix.c @@ -82,15 +82,6 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS]; static void unselect_col(uint8_t col); static void select_col(uint8_t col); #endif -__attribute__ ((weak)) -void matrix_init_quantum(void) { - matrix_init_kb(); -} - -__attribute__ ((weak)) -void matrix_scan_quantum(void) { - matrix_scan_kb(); -} __attribute__ ((weak)) void matrix_init_kb(void) { From 0e31d85b8e2fa37ce8d718feff0db5334697abb4 Mon Sep 17 00:00:00 2001 From: KeLorean Date: Tue, 6 Feb 2018 23:01:29 -0500 Subject: [PATCH 058/173] made changes to my kelorean planck keymap (#2343) * Planck-swapped up/down arrows,s65x-add dvorak * Added Dvorak as first layer of default keymap * planck-swap up and down arrows. s65x-added dvorak * added colemak to kelorean s65x keymap * made more changes to kelorean keymap * just tryinng to fix bc i was not connected upstrem --- keyboards/planck/keymaps/kelorean/config.h | 2 +- keyboards/planck/keymaps/kelorean/keymap.c | 48 ++++++++++----------- keyboards/planck/keymaps/kelorean/readme.md | 3 +- keyboards/s65_x/keymaps/kelorean/keymap.c | 7 +-- keyboards/s65_x/keymaps/kelorean/readme.md | 7 +-- 5 files changed, 28 insertions(+), 39 deletions(-) diff --git a/keyboards/planck/keymaps/kelorean/config.h b/keyboards/planck/keymaps/kelorean/config.h index a1635f2b..036fa1a2 100644 --- a/keyboards/planck/keymaps/kelorean/config.h +++ b/keyboards/planck/keymaps/kelorean/config.h @@ -39,4 +39,4 @@ /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ //#define MIDI_TONE_KEYCODE_OCTAVES 2 -#endif \ No newline at end of file +#endif diff --git a/keyboards/planck/keymaps/kelorean/keymap.c b/keyboards/planck/keymaps/kelorean/keymap.c index 7578d26b..3bbbca2a 100644 --- a/keyboards/planck/keymaps/kelorean/keymap.c +++ b/keyboards/planck/keymaps/kelorean/keymap.c @@ -44,56 +44,56 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Qwerty * ,-----------------------------------------------------------------------------------. - * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Esc | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | S | D | F | G | H | J | K | L | ; | " | + * | Bksp | A | S | D | F | G | H | J | K | L | ; | " | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * | Shift| Z | X | C | V | B | N | M | , | . | / |Sft/En| * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * | Ctrl | Brite| Alt | GUI |Lower | Space |Raise | Left | Up | Down |Ctr/Rt| * `-----------------------------------------------------------------------------------' */ [_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 }, - {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_UP, KC_DOWN, KC_RGHT} + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_ESC}, + {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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_T(KC_ENT)}, + {KC_LCTL, BACKLIT, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_UP, KC_DOWN, CTL_T(KC_RGHT)} }, /* Colemak * ,-----------------------------------------------------------------------------------. - * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Esc | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | R | S | T | D | H | N | E | I | O | " | + * | Bksp | A | R | S | T | D | H | N | E | I | O | " | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |Sft/Es| Z | X | C | V | B | K | M | , | . | / |Sft/En| * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * | Ctrl | Brite| Alt | GUI |Lower | Space |Raise | Left | Up | Down |Ctr/Rt| * `-----------------------------------------------------------------------------------' */ [_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 }, - {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_ESC}, + {KC_BSPC, 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, SFT_T(KC_ENT)}, + {KC_LCTL, BACKLIT, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_UP, KC_DOWN, CTL_T(KC_RGHT)} }, /* Dvorak * ,-----------------------------------------------------------------------------------. - * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | + * | Tab | " | , | . | P | Y | F | G | C | R | L | Esc | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | O | E | U | I | D | H | T | N | S | / | + * | Bksp | A | O | E | U | I | D | H | T | N | S | " | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |Sft/Es| ; | Q | J | K | X | B | M | W | V | Z |Sft/En| * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * | Ctrl | Brite| Alt | GUI |Lower | Space |Raise | Left | Up | Down |Ctr/Rt| * `-----------------------------------------------------------------------------------' */ [_DVORAK] = { - {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, - {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, - {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, - {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_ESC}, + {KC_BSPC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_QUOT}, + {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_T(KC_ENT)}, + {KC_LCTL, BACKLIT, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_UP, KC_DOWN, CTL_T(KC_RGHT)} }, /* Lower diff --git a/keyboards/planck/keymaps/kelorean/readme.md b/keyboards/planck/keymaps/kelorean/readme.md index 61146cbc..fd1f3517 100644 --- a/keyboards/planck/keymaps/kelorean/readme.md +++ b/keyboards/planck/keymaps/kelorean/readme.md @@ -1,2 +1 @@ -# The Default Planck Layout -Swapped up and down arrows. +# The Default Planck Layout \ No newline at end of file diff --git a/keyboards/s65_x/keymaps/kelorean/keymap.c b/keyboards/s65_x/keymaps/kelorean/keymap.c index 20fe0fdb..22fe7b07 100644 --- a/keyboards/s65_x/keymaps/kelorean/keymap.c +++ b/keyboards/s65_x/keymaps/kelorean/keymap.c @@ -30,7 +30,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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_UP, KC_PGDN, \ KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, MO(_FL), KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT), - /* 1: Colemak layer * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ * │ ESC │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │▒▒▒▒▒│BKSPC│DEL │ @@ -89,7 +88,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ │ │ │ │ │ * └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ */ - + /* 3: Locking arrow keys to WASD*/ [_AL] = ANSI_KEYMAP( _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ _______, _______, KC_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ @@ -138,9 +137,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, RGB_TOG, RGB_MOD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ _______, _______, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, _______, \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), - - - }; const uint16_t PROGMEM fn_actions[] = { @@ -152,4 +148,3 @@ const uint16_t PROGMEM fn_actions[] = { [5] = ACTION_LAYER_TOGGLE(_UL), // Toggle Underglow Layer overlay }; - diff --git a/keyboards/s65_x/keymaps/kelorean/readme.md b/keyboards/s65_x/keymaps/kelorean/readme.md index be33069e..ca08cb4c 100644 --- a/keyboards/s65_x/keymaps/kelorean/readme.md +++ b/keyboards/s65_x/keymaps/kelorean/readme.md @@ -14,7 +14,6 @@ I added Colemak and Dvorak layer as layer 1 & 2 under base QWERTY layer. ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ │LCTRL│L_ALT│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ FN0 │ APP │LEFT │DOWN │RIGHT│ └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ - #### 1.1: Colemak layer ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ │ ESC │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │▒▒▒▒▒│BKSPC│DEL │ @@ -27,7 +26,6 @@ I added Colemak and Dvorak layer as layer 1 & 2 under base QWERTY layer. ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ │LCTRL│L_ALT│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ FN0 │ APP │LEFT │DOWN │RIGHT│ └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ - #### 1.2: Dvorak layer ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ │ ESC │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ [ │ ] │▒▒▒▒▒│BKSPC│DEL │ @@ -40,7 +38,6 @@ I added Colemak and Dvorak layer as layer 1 & 2 under base QWERTY layer. ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ │LCTRL│L_ALT│L_GUI│█████│█████│█████│ SPC │█████│█████│█████│R_ALT│ FN0 │ APP │LEFT │DOWN │RIGHT│ └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ - #### 1.3 Arrow layer ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ │ │ │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│▒▒▒▒▒│ │ @@ -53,7 +50,6 @@ I added Colemak and Dvorak layer as layer 1 & 2 under base QWERTY layer. ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ │ │ │ │ │ └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ - #### 1.4 Fn layer ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ │GRAVE│ F1 │ F2 │ F3 │ F4 │ F5 │ F6 │ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │▒▒▒▒▒│▒▒▒▒▒│ │ @@ -66,7 +62,6 @@ I added Colemak and Dvorak layer as layer 1 & 2 under base QWERTY layer. ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ │ │Mute │Vol- │Play │ └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ - #### 1.5 Underglow layer ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ │ │ │ │ │ │ │ │ │ │ │ │ │ │▒▒▒▒▒│▒▒▒▒▒│ │ @@ -78,4 +73,4 @@ I added Colemak and Dvorak layer as layer 1 & 2 under base QWERTY layer. │ │▒▒▒▒▒│ │Hue+ │Hue- │Sat+ │Sat- │Val+ │Val- │ │ │ │▒▒▒▒▒│ │▒▒▒▒▒│ │ ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ │ │ │ │█████│█████│█████│ │█████│█████│█████│ │ │ │ │ │ │ - └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ + └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘ \ No newline at end of file From f26e6fca8a14471aef9a88cac4ec71487a2bbe50 Mon Sep 17 00:00:00 2001 From: QMK Bot Date: Wed, 7 Feb 2018 04:05:15 +0000 Subject: [PATCH 059/173] convert to unix line-endings [skip ci] --- keyboards/s65_x/keymaps/kelorean/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/s65_x/keymaps/kelorean/readme.md b/keyboards/s65_x/keymaps/kelorean/readme.md index ca08cb4c..12e39eae 100644 --- a/keyboards/s65_x/keymaps/kelorean/readme.md +++ b/keyboards/s65_x/keymaps/kelorean/readme.md @@ -1,4 +1,4 @@ -### 1 ANSI +### 1 ANSI A Mac ANSI layout that assumes standard sized shifts, enter, and backspace keys, Arrow layer, FN layers and Lighting functions layer... I added Colemak and Dvorak layer as layer 1 & 2 under base QWERTY layer. From 9cfcd494064439b0c8b31bc45969b0487ec6e81a Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Tue, 6 Feb 2018 20:21:03 -0800 Subject: [PATCH 060/173] Re-add Flip Installer (#2355) * Re-add Flip Installer Found the update URL for it. http://www.microchip.com/developmenttools/productdetails.aspx?partno=flip * Comment out JRE installer version --- util/win_shared_install.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/util/win_shared_install.sh b/util/win_shared_install.sh index 27539c5b..f24ec08e 100644 --- a/util/win_shared_install.sh +++ b/util/win_shared_install.sh @@ -19,9 +19,11 @@ function install_utils { unzip teensy_loader_cli_windows.zip # This URL has changed and I can't find the new location. Commenting out until we figure out the new URL or determine this isn't needed. -skullY - #echo "Installing Atmel Flip" - #wget 'http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe' - #mv Flip\ Installer\ \-\ 3.4.7.112.exe FlipInstaller.exe + echo "Installing Atmel Flip" + wget 'http://ww1.microchip.com/downloads/en/DeviceDoc/Flip%20Installer%20-%203.4.7.112.exe' + # This is the JRE-less installer, if we need the larger bundled with JRE installer, use this: + #wget 'http://ww1.microchip.com/downloads/en/DeviceDoc/JRE%20-%20Flip%20Installer%20-%203.4.7.112.exe' + mv Flip\ Installer\ \-\ 3.4.7.112.exe FlipInstaller.exe echo "Downloading the QMK driver installer" wget -qO- https://api.github.com/repos/qmk/qmk_driver_installer/releases | grep browser_download_url | head -n 1 | cut -d '"' -f 4 | wget -i - From ad01e3c03a5213a46d5e6bd14cbb3c3231f68c78 Mon Sep 17 00:00:00 2001 From: Legonut Date: Tue, 6 Feb 2018 23:44:10 -0500 Subject: [PATCH 061/173] New keyboard added "Zen" (#2347) * New keyboard added Zen is a split ortholinear currently in group buy. * remove bad keymap Keymap was throwing errors * remove other bad keymap I should have checked these before haha * small fix to update folder name * renamed temp * renamed to zen * update folder name * Slim down matrix code Suggested by drashna * move KC_NO * Update keymap * change from rev2 to rev1 --- keyboards/zen/config.h | 29 ++ keyboards/zen/keymaps/default/config.h | 41 +++ keyboards/zen/keymaps/default/keymap.c | 103 ++++++ keyboards/zen/keymaps/default/rules.mk | 6 + keyboards/zen/matrix.c | 466 +++++++++++++++++++++++++ keyboards/zen/readme.md | 12 + keyboards/zen/rev1/config.h | 91 +++++ keyboards/zen/rev1/rev1.c | 22 ++ keyboards/zen/rev1/rev1.h | 40 +++ keyboards/zen/rev1/rules.mk | 2 + keyboards/zen/rules.mk | 73 ++++ keyboards/zen/serial.c | 228 ++++++++++++ keyboards/zen/serial.h | 26 ++ keyboards/zen/split_rgb.c | 41 +++ keyboards/zen/split_rgb.h | 6 + keyboards/zen/split_util.c | 86 +++++ keyboards/zen/split_util.h | 20 ++ keyboards/zen/zen.c | 1 + keyboards/zen/zen.h | 23 ++ 19 files changed, 1316 insertions(+) create mode 100644 keyboards/zen/config.h create mode 100644 keyboards/zen/keymaps/default/config.h create mode 100644 keyboards/zen/keymaps/default/keymap.c create mode 100644 keyboards/zen/keymaps/default/rules.mk create mode 100644 keyboards/zen/matrix.c create mode 100644 keyboards/zen/readme.md create mode 100644 keyboards/zen/rev1/config.h create mode 100644 keyboards/zen/rev1/rev1.c create mode 100644 keyboards/zen/rev1/rev1.h create mode 100644 keyboards/zen/rev1/rules.mk create mode 100644 keyboards/zen/rules.mk create mode 100644 keyboards/zen/serial.c create mode 100644 keyboards/zen/serial.h create mode 100644 keyboards/zen/split_rgb.c create mode 100644 keyboards/zen/split_rgb.h create mode 100644 keyboards/zen/split_util.c create mode 100644 keyboards/zen/split_util.h create mode 100644 keyboards/zen/zen.c create mode 100644 keyboards/zen/zen.h diff --git a/keyboards/zen/config.h b/keyboards/zen/config.h new file mode 100644 index 00000000..f8f8bbf3 --- /dev/null +++ b/keyboards/zen/config.h @@ -0,0 +1,29 @@ +/* +Copyright 2017 Danny Nguyen + +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 CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +#endif // CONFIG_H + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 16 + +#define TAPPING_TERM 100 \ No newline at end of file diff --git a/keyboards/zen/keymaps/default/config.h b/keyboards/zen/keymaps/default/config.h new file mode 100644 index 00000000..38e4d73f --- /dev/null +++ b/keyboards/zen/keymaps/default/config.h @@ -0,0 +1,41 @@ +/* +Copyright 2017 Danny Nguyen + +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 CONFIG_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +// #define USE_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define MASTER_RIGHT +// #define EE_HANDS + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 16 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +#endif diff --git a/keyboards/zen/keymaps/default/keymap.c b/keyboards/zen/keymaps/default/keymap.c new file mode 100644 index 00000000..a955e892 --- /dev/null +++ b/keyboards/zen/keymaps/default/keymap.c @@ -0,0 +1,103 @@ +#include "zen.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QWERTY 0 +#define _NAV 2 + + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + NAV, + +}; + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------. .-----------------------------------------. + * | GESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Tab | Q | W | E | R | T | | Y | U | I | O | P | \ | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * |CAPS(NAV)|A | S | D | F | G | | H | J | K | L | ; | " | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------..-----+------+------+------+------+------+------| + * | Ctrl | GUI | Alt |RGBTOG| NAV |Space |Delete||Enter|Space | NAV | - | = | PGUP | PGDN | + * `------------------------------------------------''-----------------------------------------------' + */ +[_QWERTY] = KEYMAP( \ + KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, \ + LT(_NAV, KC_CAPS),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_LCTL, KC_LGUI, KC_LALT, RGB_TOG, MO(_NAV), KC_SPC, KC_DEL, KC_ENT, KC_SPACE, MO(_NAV), KC_MINS, KC_EQL, KC_PGUP, KC_PGDN \ +), + +/* NAV + * ,-----------------------------------------. .-----------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | |RGBSAI|RGBVAI|RGBSAD| RESET| [ | | ] | Pgup | Up | Pgdn |Insert| Home | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | |RGBHUD|RGBVAD|RGBHUI| | | | | Left | Down | Right|Delete| End | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * |Shift | | | | | | | NKRO | | | Pause| Back | Next | + * |------+------+------+------+------+------+------..-----+------+------+------+------+------+------| + * | Ctrl | GUI | Alt |RGBMOD| | | || | | | | Mute | VOLUP| VOLDN| + * `------------------------------------------------''-----------------------------------------------' + */ +[_NAV] = KEYMAP( \ + 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, RGB_SAI, RGB_VAI, RGB_SAD, RESET, KC_LBRC, KC_RBRC, KC_PGUP, KC_UP, KC_PGDN, KC_INS, KC_HOME , \ + KC_TRNS, RGB_HUD, RGB_VAD, RGB_HUI, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_DEL, KC_END , \ + KC_LSFT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MAGIC_TOGGLE_NKRO, KC_TRNS, KC_TRNS, KC_MPLY, KC_MPRV, KC_MNXT , \ + KC_LCTL, KC_LGUI, KC_LALT, RGB_MOD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLU, KC_VOLD \ +), + +}; + +#ifdef AUDIO_ENABLE +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +#endif + +void persistant_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + persistant_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + //case COLEMAK: + //if (record->event.pressed) { + //#ifdef AUDIO_ENABLE + //PLAY_NOTE_ARRAY(tone_colemak, false, 0); + //#endif + //persistant_default_layer_set(1UL<<_COLEMAK); + //} + //return false; + //break; + } + return true; +} \ No newline at end of file diff --git a/keyboards/zen/keymaps/default/rules.mk b/keyboards/zen/keymaps/default/rules.mk new file mode 100644 index 00000000..22b6ec47 --- /dev/null +++ b/keyboards/zen/keymaps/default/rules.mk @@ -0,0 +1,6 @@ +RGBLIGHT_ENABLE = yes +BACKLIGHT_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/zen/matrix.c b/keyboards/zen/matrix.c new file mode 100644 index 00000000..12f22214 --- /dev/null +++ b/keyboards/zen/matrix.c @@ -0,0 +1,466 @@ +/* +Copyright 2017 Danny Nguyen + +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 . +*/ + +/* + * scan matrix + */ +#include +#include +#include +#include "wait.h" +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "split_util.h" +#include "pro_micro.h" +#include "config.h" +#include "timer.h" +#include "backlight.h" + +#ifdef USE_I2C +# include "i2c.h" +#else // USE_SERIAL +# include "serial.h" +#endif + +#ifndef DEBOUNCING_DELAY +# define DEBOUNCING_DELAY 5 +#endif + +#if (DEBOUNCING_DELAY > 0) + static uint16_t debouncing_time; + static bool debouncing = false; +#endif + +#if (MATRIX_COLS <= 8) +# define print_matrix_header() print("\nr/c 01234567\n") +# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop(matrix[i]) +# define ROW_SHIFTER ((uint8_t)1) +#else +# error "Currently only supports 8 COLS" +#endif +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +#define ERROR_DISCONNECT_COUNT 5 + +#define SERIAL_LED_ADDR 0x00 + +#define ROWS_PER_HAND (MATRIX_ROWS/2) + +static uint8_t error_count = 0; + +static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +#if (DIODE_DIRECTION == COL2ROW) + static void init_cols(void); + static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row); + static void unselect_rows(void); + static void select_row(uint8_t row); + static void unselect_row(uint8_t row); +#elif (DIODE_DIRECTION == ROW2COL) + static void init_rows(void); + static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col); + static void unselect_cols(void); + static void unselect_col(uint8_t col); + static void select_col(uint8_t col); +#endif + +__attribute__ ((weak)) +void matrix_init_kb(void) { + matrix_init_user(); +} + +__attribute__ ((weak)) +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +__attribute__ ((weak)) +void matrix_init_user(void) { +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { +} + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +void matrix_init(void) +{ + debug_enable = true; + debug_matrix = true; + debug_mouse = true; + // initialize row and col + unselect_rows(); + init_cols(); + + TX_RX_LED_INIT; + + // initialize matrix state: all keys off + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + matrix_debouncing[i] = 0; + } + + +} + +uint8_t _matrix_scan(void) +{ + int offset = isLeftHand ? 0 : (ROWS_PER_HAND); +#if (DIODE_DIRECTION == COL2ROW) + // Set row, read cols + for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) { +# if (DEBOUNCING_DELAY > 0) + bool matrix_changed = read_cols_on_row(matrix_debouncing+offset, current_row); + + if (matrix_changed) { + debouncing = true; + debouncing_time = timer_read(); + PORTD ^= (1 << 2); + } + +# else + read_cols_on_row(matrix+offset, current_row); +# endif + + } + +#elif (DIODE_DIRECTION == ROW2COL) + // Set col, read rows + for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { +# if (DEBOUNCING_DELAY > 0) + bool matrix_changed = read_rows_on_col(matrix_debouncing+offset, current_col); + if (matrix_changed) { + debouncing = true; + debouncing_time = timer_read(); + } +# else + read_rows_on_col(matrix+offset, current_col); +# endif + + } +#endif + +# if (DEBOUNCING_DELAY > 0) + if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) { + for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { + matrix[i+offset] = matrix_debouncing[i+offset]; + } + debouncing = false; + } +# endif + + return 1; +} + +#ifdef USE_I2C + +// Get rows from other half over i2c +int i2c_transaction(void) { + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + + int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); + if (err) goto i2c_error; + + // start of matrix stored at 0x00 + err = i2c_master_write(0x00); + if (err) goto i2c_error; + + // Start read + err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); + if (err) goto i2c_error; + + if (!err) { + int i; + for (i = 0; i < ROWS_PER_HAND-1; ++i) { + matrix[slaveOffset+i] = i2c_master_read(I2C_ACK); + } + matrix[slaveOffset+i] = i2c_master_read(I2C_NACK); + i2c_master_stop(); + } else { +i2c_error: // the cable is disconnceted, or something else went wrong + i2c_reset_state(); + return err; + } + + return 0; +} + +#else // USE_SERIAL + +int serial_transaction(void) { + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + + if (serial_update_buffers()) { + return 1; + } + + for (int i = 0; i < ROWS_PER_HAND; ++i) { + matrix[slaveOffset+i] = serial_slave_buffer[i]; + } + +#ifdef BACKLIGHT_ENABLE + // Write backlight level for slave to read + serial_master_buffer[SERIAL_LED_ADDR] = get_backlight_level(); +#endif + return 0; +} +#endif + +uint8_t matrix_scan(void) +{ + uint8_t ret = _matrix_scan(); + +#ifdef USE_I2C + if( i2c_transaction() ) { +#else // USE_SERIAL + if( serial_transaction() ) { +#endif + // turn on the indicator led when halves are disconnected + TXLED1; + + error_count++; + + if (error_count > ERROR_DISCONNECT_COUNT) { + // reset other half if disconnected + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + for (int i = 0; i < ROWS_PER_HAND; ++i) { + matrix[slaveOffset+i] = 0; + } + } + } else { + // turn off the indicator led on no error + TXLED0; + error_count = 0; + } + return ret; +} + +void matrix_slave_scan(void) { + _matrix_scan(); + + int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; + +#ifdef USE_I2C + for (int i = 0; i < ROWS_PER_HAND; ++i) { + i2c_slave_buffer[i] = matrix[offset+i]; + } +#else // USE_SERIAL + for (int i = 0; i < ROWS_PER_HAND; ++i) { + serial_slave_buffer[i] = matrix[offset+i]; + } + +#ifdef BACKLIGHT_ENABLE + // Read backlight level sent from master and update level on slave + backlight_set(serial_master_buffer[SERIAL_LED_ADDR]); +#endif +#endif +} + +bool matrix_is_modified(void) +{ + if (debouncing) return false; + return true; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & ((matrix_row_t)1<> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } +} + +static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) +{ + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[current_row]; + + // Clear data in matrix row + current_matrix[current_row] = 0; + + // Select row and wait for row selecton to stabilize + select_row(current_row); + wait_us(30); + + // For each col... + for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { + + // Select the col pin to read (active low) + uint8_t pin = col_pins[col_index]; + uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF)); + + // Populate the matrix row with the state of the col pin + current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); + } + + // Unselect row + unselect_row(current_row); + + return (last_row_value != current_matrix[current_row]); +} + +static void select_row(uint8_t row) +{ + uint8_t pin = row_pins[row]; + _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT + _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW +} + +static void unselect_row(uint8_t row) +{ + uint8_t pin = row_pins[row]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI +} + +static void unselect_rows(void) +{ + for(uint8_t x = 0; x < ROWS_PER_HAND; x++) { + uint8_t pin = row_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } +} + +#elif (DIODE_DIRECTION == ROW2COL) + +static void init_rows(void) +{ + for(uint8_t x = 0; x < ROWS_PER_HAND; x++) { + uint8_t pin = row_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } +} + +static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) +{ + bool matrix_changed = false; + + // Select col and wait for col selecton to stabilize + select_col(current_col); + wait_us(30); + + // For each row... + for(uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) + { + + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[row_index]; + + // Check row pin state + if ((_SFR_IO8(row_pins[row_index] >> 4) & _BV(row_pins[row_index] & 0xF)) == 0) + { + // Pin LO, set col bit + current_matrix[row_index] |= (ROW_SHIFTER << current_col); + } + else + { + // Pin HI, clear col bit + current_matrix[row_index] &= ~(ROW_SHIFTER << current_col); + } + + // Determine if the matrix changed state + if ((last_row_value != current_matrix[row_index]) && !(matrix_changed)) + { + matrix_changed = true; + } + } + + // Unselect col + unselect_col(current_col); + + return matrix_changed; +} + +static void select_col(uint8_t col) +{ + uint8_t pin = col_pins[col]; + _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT + _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW +} + +static void unselect_col(uint8_t col) +{ + uint8_t pin = col_pins[col]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI +} + +static void unselect_cols(void) +{ + for(uint8_t x = 0; x < MATRIX_COLS; x++) { + uint8_t pin = col_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } +} + +#endif diff --git a/keyboards/zen/readme.md b/keyboards/zen/readme.md new file mode 100644 index 00000000..36c63d29 --- /dev/null +++ b/keyboards/zen/readme.md @@ -0,0 +1,12 @@ +Zen Keyboard +==== + +A split ergo keyboard with a few goals in mind: + - Be as thin as possible. Other split KBs (Let's Split, Nyquist, Iris) are 15.2mm thick. The Zen is only 8.0mm thick. + - Layout designed for gaming. 1.5u pinky keys, ortho alphas, and angled thumb keys. After trying Ortholiniear, Atreus62, and Ergodox, this is the best layout for gaming and typing. + - RGB backlighting. 16 WS2812b LEDs shine through the perimeter switches. The SK6812 variant are cheap and easy to solder. + - Price. Using Arduino Pro Micro, SK6812 LEDs, and PCB FR4 for the case, the cost of each half without switches or caps can be reduced to under $20 when purchased at volume. + +A build guide and more info for this keyboard can be found here: [Zen Build Guide](https://legonut.gitbooks.io/zen-keyboard/content/) + +Maintained by u/legonut3 \ No newline at end of file diff --git a/keyboards/zen/rev1/config.h b/keyboards/zen/rev1/config.h new file mode 100644 index 00000000..efae5589 --- /dev/null +++ b/keyboards/zen/rev1/config.h @@ -0,0 +1,91 @@ +/* +Copyright 2017 Danny Nguyen + +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 REV1_CONFIG_H +#define REV1_CONFIG_H + +#include QMK_KEYBOARD_CONFIG_H + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xCEEB +#define PRODUCT_ID 0x1256 +#define DEVICE_VER 0x0200 +#define MANUFACTURER Legonut +#define PRODUCT Project Zen +#define DESCRIPTION Split gaming keyboard + +/* key matrix size */ +// Rows are doubled-up +#define MATRIX_ROWS 10 +#define MATRIX_COLS 7 + +// wiring of each half +#define MATRIX_ROW_PINS { C6, D7, E6, B4, B5 } +#define MATRIX_COL_PINS { B2, B3, B1, F7, F6, D4, B6 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +// #define BACKLIGHT_LEVELS 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +#define BACKLIGHT_PIN F4 +#define BACKLIGHT_LEVELS 5 + + +/* ws2812 RGB LED */ +#define RGB_DI_PIN D1 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 16 // Number of LEDs +#define ws2812_PORTREG PORTD +#define ws2812_DDRREG DDRD + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +// #define NO_DEBUG + +/* disable print */ +// #define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +#endif diff --git a/keyboards/zen/rev1/rev1.c b/keyboards/zen/rev1/rev1.c new file mode 100644 index 00000000..5f4cd32f --- /dev/null +++ b/keyboards/zen/rev1/rev1.c @@ -0,0 +1,22 @@ +#include "rev1.h" + +#ifdef SSD1306OLED +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + led_set_user(usb_led); +} +#endif + +void matrix_init_kb(void) { + + // // green led on + // DDRD |= (1<<5); + // PORTD &= ~(1<<5); + + // // orange led on + // DDRB |= (1<<0); + // PORTB &= ~(1<<0); + + matrix_init_user(); +}; + diff --git a/keyboards/zen/rev1/rev1.h b/keyboards/zen/rev1/rev1.h new file mode 100644 index 00000000..4983bb2a --- /dev/null +++ b/keyboards/zen/rev1/rev1.h @@ -0,0 +1,40 @@ +#ifndef REV1_H +#define REV1_H + +#include "zen.h" + +//void promicro_bootloader_jmp(bool program); +#include "quantum.h" + + +#ifdef USE_I2C +#include +#ifdef __AVR__ + #include + #include +#endif +#endif + +//void promicro_bootloader_jmp(bool program); + +#define KEYMAP( \ + k00, k01, k02, k03, k04, k05, k55, k54, k53, k52, k51, k50, \ + k10, k11, k12, k13, k14, k15, k65, k64, k63, k62, k61, k60, \ + k20, k21, k22, k23, k24, k25, k75, k74, k73, k72, k71, k70, \ + k30, k31, k32, k33, k34, k35, k85, k84, k83, k82, k81, k80, \ + k40, k41, k42, k43, k44, k45, k46, k96, k95, k94, k93, k92, k91, k90 \ + ) \ + { \ + { k00, k01, k02, k03, k04, k05, KC_NO }, \ + { k10, k11, k12, k13, k14, k15, KC_NO }, \ + { k20, k21, k22, k23, k24, k25, KC_NO }, \ + { k30, k31, k32, k33, k34, k35, KC_NO }, \ + { k40, k41, k42, k43, k44, k45, k46 }, \ + { k50, k51, k52, k53, k54, k55, KC_NO }, \ + { k60, k61, k62, k63, k64, k65, KC_NO }, \ + { k70, k71, k72, k73, k74, k75, KC_NO }, \ + { k80, k81, k82, k83, k84, k85, KC_NO }, \ + { k90, k91, k92, k93, k94, k95, k96 } \ + } + +#endif diff --git a/keyboards/zen/rev1/rules.mk b/keyboards/zen/rev1/rules.mk new file mode 100644 index 00000000..d7463419 --- /dev/null +++ b/keyboards/zen/rev1/rules.mk @@ -0,0 +1,2 @@ +RGBLIGHT_ENABLE = yes +BACKLIGHT_ENABLE = yes diff --git a/keyboards/zen/rules.mk b/keyboards/zen/rules.mk new file mode 100644 index 00000000..32d3dc51 --- /dev/null +++ b/keyboards/zen/rules.mk @@ -0,0 +1,73 @@ +SRC += matrix.c \ + split_util.c \ + serial.c + +# MCU name +#MCU = at90usb1287 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Bootloader +# This definition is optional, and if your keyboard supports multiple bootloaders of +# different sizes, comment this out, and the correct address will be loaded +# automatically (+60). See bootloader.mk for all options. +BOOTLOADER = caterina + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SUBPROJECT_rev1 = yes +USE_I2C = no +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +CUSTOM_MATRIX = yes + +DEFAULT_FOLDER = zen/rev1 diff --git a/keyboards/zen/serial.c b/keyboards/zen/serial.c new file mode 100644 index 00000000..74bcbb6b --- /dev/null +++ b/keyboards/zen/serial.c @@ -0,0 +1,228 @@ +/* + * WARNING: be careful changing this code, it is very timing dependent + */ + +#ifndef F_CPU +#define F_CPU 16000000 +#endif + +#include +#include +#include +#include +#include "serial.h" + +#ifndef USE_I2C + +// Serial pulse period in microseconds. Its probably a bad idea to lower this +// value. +#define SERIAL_DELAY 24 + +uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; +uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; + +#define SLAVE_DATA_CORRUPT (1<<0) +volatile uint8_t status = 0; + +inline static +void serial_delay(void) { + _delay_us(SERIAL_DELAY); +} + +inline static +void serial_output(void) { + SERIAL_PIN_DDR |= SERIAL_PIN_MASK; +} + +// make the serial pin an input with pull-up resistor +inline static +void serial_input(void) { + SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK; + SERIAL_PIN_PORT |= SERIAL_PIN_MASK; +} + +inline static +uint8_t serial_read_pin(void) { + return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK); +} + +inline static +void serial_low(void) { + SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; +} + +inline static +void serial_high(void) { + SERIAL_PIN_PORT |= SERIAL_PIN_MASK; +} + +void serial_master_init(void) { + serial_output(); + serial_high(); +} + +void serial_slave_init(void) { + serial_input(); + + // Enable INT0 + EIMSK |= _BV(INT0); + // Trigger on falling edge of INT0 + EICRA &= ~(_BV(ISC00) | _BV(ISC01)); +} + +// Used by the master to synchronize timing with the slave. +static +void sync_recv(void) { + serial_input(); + // This shouldn't hang if the slave disconnects because the + // serial line will float to high if the slave does disconnect. + while (!serial_read_pin()); + serial_delay(); +} + +// Used by the slave to send a synchronization signal to the master. +static +void sync_send(void) { + serial_output(); + + serial_low(); + serial_delay(); + + serial_high(); +} + +// Reads a byte from the serial line +static +uint8_t serial_read_byte(void) { + uint8_t byte = 0; + serial_input(); + for ( uint8_t i = 0; i < 8; ++i) { + byte = (byte << 1) | serial_read_pin(); + serial_delay(); + _delay_us(1); + } + + return byte; +} + +// Sends a byte with MSB ordering +static +void serial_write_byte(uint8_t data) { + uint8_t b = 8; + serial_output(); + while( b-- ) { + if(data & (1 << b)) { + serial_high(); + } else { + serial_low(); + } + serial_delay(); + } +} + +// interrupt handle to be used by the slave device +ISR(SERIAL_PIN_INTERRUPT) { + sync_send(); + + uint8_t checksum = 0; + for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { + serial_write_byte(serial_slave_buffer[i]); + sync_send(); + checksum += serial_slave_buffer[i]; + } + serial_write_byte(checksum); + sync_send(); + + // wait for the sync to finish sending + serial_delay(); + + // read the middle of pulses + _delay_us(SERIAL_DELAY/2); + + uint8_t checksum_computed = 0; + for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { + serial_master_buffer[i] = serial_read_byte(); + sync_send(); + checksum_computed += serial_master_buffer[i]; + } + uint8_t checksum_received = serial_read_byte(); + sync_send(); + + serial_input(); // end transaction + + if ( checksum_computed != checksum_received ) { + status |= SLAVE_DATA_CORRUPT; + } else { + status &= ~SLAVE_DATA_CORRUPT; + } +} + +inline +bool serial_slave_DATA_CORRUPT(void) { + return status & SLAVE_DATA_CORRUPT; +} + +// Copies the serial_slave_buffer to the master and sends the +// serial_master_buffer to the slave. +// +// Returns: +// 0 => no error +// 1 => slave did not respond +int serial_update_buffers(void) { + // this code is very time dependent, so we need to disable interrupts + cli(); + + // signal to the slave that we want to start a transaction + serial_output(); + serial_low(); + _delay_us(1); + + // wait for the slaves response + serial_input(); + serial_high(); + _delay_us(SERIAL_DELAY); + + // check if the slave is present + if (serial_read_pin()) { + // slave failed to pull the line low, assume not present + sei(); + return 1; + } + + // if the slave is present syncronize with it + sync_recv(); + + uint8_t checksum_computed = 0; + // receive data from the slave + for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { + serial_slave_buffer[i] = serial_read_byte(); + sync_recv(); + checksum_computed += serial_slave_buffer[i]; + } + uint8_t checksum_received = serial_read_byte(); + sync_recv(); + + if (checksum_computed != checksum_received) { + sei(); + return 1; + } + + uint8_t checksum = 0; + // send data to the slave + for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { + serial_write_byte(serial_master_buffer[i]); + sync_recv(); + checksum += serial_master_buffer[i]; + } + serial_write_byte(checksum); + sync_recv(); + + // always, release the line when not in use + serial_output(); + serial_high(); + + sei(); + return 0; +} + +#endif diff --git a/keyboards/zen/serial.h b/keyboards/zen/serial.h new file mode 100644 index 00000000..15fe4db7 --- /dev/null +++ b/keyboards/zen/serial.h @@ -0,0 +1,26 @@ +#ifndef MY_SERIAL_H +#define MY_SERIAL_H + +#include "config.h" +#include + +/* TODO: some defines for interrupt setup */ +#define SERIAL_PIN_DDR DDRD +#define SERIAL_PIN_PORT PORTD +#define SERIAL_PIN_INPUT PIND +#define SERIAL_PIN_MASK _BV(PD0) +#define SERIAL_PIN_INTERRUPT INT0_vect + +#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 +#define SERIAL_MASTER_BUFFER_LENGTH 1 + +// Buffers for master - slave communication +extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; +extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; + +void serial_master_init(void); +void serial_slave_init(void); +int serial_update_buffers(void); +bool serial_slave_data_corrupt(void); + +#endif diff --git a/keyboards/zen/split_rgb.c b/keyboards/zen/split_rgb.c new file mode 100644 index 00000000..6d7cb44c --- /dev/null +++ b/keyboards/zen/split_rgb.c @@ -0,0 +1,41 @@ +#include +#include +#include "split_util.h" +#include "progmem.h" +#include "print.h" +#include "rgblight.h" + +#ifdef USE_I2C +# include "i2c.h" +#else // USE_SERIAL +# include "serial.h" +#endif + + +rgblight_config_t rgblight_config; + +void rgblight_slave_update(void) { + //rgblight_effect_christmas(); +} + + +void rgblight_set(void) { + if (rgblight_config.enable) { + #ifdef RGBW + ws2812_setleds_rgbw(led, RGBLED_NUM); + #else + ws2812_setleds(led, RGBLED_NUM); + #endif + } else { + for (uint8_t i = 0; i < RGBLED_NUM; i++) { + led[i].r = 0; + led[i].g = 0; + led[i].b = 0; + } + #ifdef RGBW + ws2812_setleds_rgbw(led, RGBLED_NUM); + #else + ws2812_setleds(led, RGBLED_NUM); + #endif + } +} diff --git a/keyboards/zen/split_rgb.h b/keyboards/zen/split_rgb.h new file mode 100644 index 00000000..5f552890 --- /dev/null +++ b/keyboards/zen/split_rgb.h @@ -0,0 +1,6 @@ +#ifndef SPLIT_RGB_H +#define SPLIT_RGB_H + +void rgblight_slave_update(void); + +#endif diff --git a/keyboards/zen/split_util.c b/keyboards/zen/split_util.c new file mode 100644 index 00000000..346cbc90 --- /dev/null +++ b/keyboards/zen/split_util.c @@ -0,0 +1,86 @@ +#include +#include +#include +#include +#include +#include +#include "split_util.h" +#include "matrix.h" +#include "keyboard.h" +#include "config.h" +#include "timer.h" + +#ifdef USE_I2C +# include "i2c.h" +#else +# include "serial.h" +#endif + +volatile bool isLeftHand = true; + +static void setup_handedness(void) { + #ifdef EE_HANDS + isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); + #else + // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c + #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) + isLeftHand = !has_usb(); + #else + isLeftHand = has_usb(); + #endif + #endif +} + +static void keyboard_master_setup(void) { +#ifdef USE_I2C + i2c_master_init(); +#ifdef SSD1306OLED + matrix_master_OLED_init (); +#endif +#else + serial_master_init(); +#endif +} + +static void keyboard_slave_setup(void) { + timer_init(); +#ifdef USE_I2C + i2c_slave_init(SLAVE_I2C_ADDRESS); +#else + serial_slave_init(); +#endif +} + +bool has_usb(void) { + USBCON |= (1 << OTGPADE); //enables VBUS pad + _delay_us(5); + return (USBSTA & (1< +#include "eeconfig.h" + +#define SLAVE_I2C_ADDRESS 0x32 + +extern volatile bool isLeftHand; + +// slave version of matix scan, defined in matrix.c +void matrix_slave_scan(void); + +void split_keyboard_setup(void); +bool has_usb(void); +void keyboard_slave_loop(void); + +void matrix_master_OLED_init (void); + +#endif diff --git a/keyboards/zen/zen.c b/keyboards/zen/zen.c new file mode 100644 index 00000000..22131ef5 --- /dev/null +++ b/keyboards/zen/zen.c @@ -0,0 +1 @@ +#include "zen.h" diff --git a/keyboards/zen/zen.h b/keyboards/zen/zen.h new file mode 100644 index 00000000..4560ff8c --- /dev/null +++ b/keyboards/zen/zen.h @@ -0,0 +1,23 @@ +#ifndef ZEN_H +#define ZEN_H + +#include "rev1.h" +#include "quantum.h" + +// Used to create a keymap using only KC_ prefixed keys +#define KC_KEYMAP( \ + L00, L01, L02, L03, L04, L05, R01, R02, R03, R04, R05, R06,\ + L10, L11, L12, L13, L14, L15, R11, R12, R13, R14, R15, R16,\ + L20, L21, L22, L23, L24, L25, R21, R22, R23, R24, R25, R26,\ + L30, L31, L32, L33, L34, L35, R31, R32, R33, R34, R35, R36,\ + L40, L41, L42, L43, L44, L45, L46, R40, R41, R42, R43, R44, R45, R46 \ + ) \ + KEYMAP( \ + KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, KC_##R06, \ + KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, KC_##R16, \ + KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, KC_##R26, \ + KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35, KC_##R36, \ + KC_##L40, KC_##L41, KC_##L42, KC_##L43, KC_##L44, KC_##L45, KC_##L46, KC_##R40, KC_##R41, KC_##R42, KC_##R43, KC_##R44, KC_##R45, KC_##R46, \ + ) + +#endif \ No newline at end of file From 6a9617b1c6fc298397e3bf9aef61cd0de55e36c8 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sat, 20 Jan 2018 18:12:38 +0200 Subject: [PATCH 062/173] Update ChibiOS to 17.6.3 --- lib/chibios | 2 +- tmk_core/protocol/chibios/usb_main.c | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/chibios b/lib/chibios index 8fce03b3..e26cb16a 160000 --- a/lib/chibios +++ b/lib/chibios @@ -1 +1 @@ -Subproject commit 8fce03b3a75c743e5d5c40b9d59c1637c59d22a7 +Subproject commit e26cb16a7296a196d7c74eae22cbee00989cb7b6 diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 9bfdf572..6173d3ad 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -778,10 +778,6 @@ static const USBEndpointConfig nkro_ep_config = { * TODO: maybe disable some things when connection is lost? */ static void usb_event_cb(USBDriver *usbp, usbevent_t event) { switch(event) { - case USB_EVENT_RESET: - //TODO: from ISR! print("[R]"); - return; - case USB_EVENT_ADDRESS: return; @@ -804,12 +800,15 @@ static void usb_event_cb(USBDriver *usbp, usbevent_t event) { #endif /* NKRO_ENABLE */ osalSysUnlockFromISR(); return; - case USB_EVENT_SUSPEND: //TODO: from ISR! print("[S]"); #ifdef SLEEP_LED_ENABLE sleep_led_enable(); #endif /* SLEEP_LED_ENABLE */ + /* Falls into.*/ + case USB_EVENT_UNCONFIGURED: + /* Falls into.*/ + case USB_EVENT_RESET: return; case USB_EVENT_WAKEUP: @@ -1032,7 +1031,7 @@ void init_usb_driver(USBDriver *usbp) { chVTObjectInit(&keyboard_idle_timer); #ifdef CONSOLE_ENABLE - obqObjectInit(&console_buf_queue, console_queue_buffer, CONSOLE_EPSIZE, CONSOLE_QUEUE_CAPACITY, console_queue_onotify, (void*)usbp); + obqObjectInit(&console_buf_queue, false, console_queue_buffer, CONSOLE_EPSIZE, CONSOLE_QUEUE_CAPACITY, console_queue_onotify, (void*)usbp); chVTObjectInit(&console_flush_timer); #endif } From 30e413f9855a1ace8ea80505df1476de07e8ce39 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sat, 3 Feb 2018 12:43:22 +0200 Subject: [PATCH 063/173] Update Chibios Contrib with 17.6.3 support --- lib/chibios-contrib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/chibios-contrib b/lib/chibios-contrib index cc401cf0..432bc176 160000 --- a/lib/chibios-contrib +++ b/lib/chibios-contrib @@ -1 +1 @@ -Subproject commit cc401cf0175d6ff4fe62acc8efbaa416013b544e +Subproject commit 432bc1762f17eb7b506e8fbca8ec30a3d61629b8 From 30b90de7c9d4edbbaf55e11264d30bda1f82cfde Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sat, 3 Feb 2018 12:55:56 +0200 Subject: [PATCH 064/173] Send usb wakeup through ChibiOS --- tmk_core/protocol/chibios/main.c | 4 ++-- tmk_core/protocol/chibios/usb_main.c | 21 --------------------- tmk_core/protocol/chibios/usb_main.h | 3 --- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index 7138b553..47a7eb09 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -165,8 +165,8 @@ int main(void) { #endif suspend_power_down(); // on AVR this deep sleeps for 15ms /* Remote wakeup */ - if((USB_DRIVER.status & 2) && suspend_wakeup_condition()) { - send_remote_wakeup(&USB_DRIVER); + if(suspend_wakeup_condition()) { + usbWakeupHost(&USB_DRIVER); } } /* Woken up */ diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 6173d3ad..caa2770b 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -1036,27 +1036,6 @@ void init_usb_driver(USBDriver *usbp) { #endif } -/* - * Send remote wakeup packet - * Note: should not be called from ISR - */ -void send_remote_wakeup(USBDriver *usbp) { - (void)usbp; -#if defined(K20x) || defined(KL2x) -#if KINETIS_USB_USE_USB0 - USB0->CTL |= USBx_CTL_RESUME; - wait_ms(15); - USB0->CTL &= ~USBx_CTL_RESUME; -#endif /* KINETIS_USB_USE_USB0 */ -#elif defined(STM32F0XX) || defined(STM32F1XX) || defined(STM32F3XX) /* End K20x || KL2x */ - STM32_USB->CNTR |= CNTR_RESUME; - wait_ms(15); - STM32_USB->CNTR &= ~CNTR_RESUME; -#else /* End STM32F0XX || STM32F1XX || STM32F3XX */ -#warning Sending remote wakeup packet not implemented for your platform. -#endif -} - /* --------------------------------------------------------- * Keyboard functions * --------------------------------------------------------- diff --git a/tmk_core/protocol/chibios/usb_main.h b/tmk_core/protocol/chibios/usb_main.h index 30d8fcae..b4f894f2 100644 --- a/tmk_core/protocol/chibios/usb_main.h +++ b/tmk_core/protocol/chibios/usb_main.h @@ -36,9 +36,6 @@ /* Initialize the USB driver and bus */ void init_usb_driver(USBDriver *usbp); -/* Send remote wakeup packet */ -void send_remote_wakeup(USBDriver *usbp); - /* --------------- * Keyboard header * --------------- From 8afbd649f068b3b85146b61429a4bee1787c092a Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Thu, 8 Feb 2018 10:09:53 -0500 Subject: [PATCH 065/173] Replace Right key on base layer with RShift, convert adjust to KC_KEYMAP format --- keyboards/iris/keymaps/default/keymap.c | 35 ++++++++++++++++--------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/keyboards/iris/keymaps/default/keymap.c b/keyboards/iris/keymaps/default/keymap.c index 4d9577c5..24ef99d2 100644 --- a/keyboards/iris/keymaps/default/keymap.c +++ b/keyboards/iris/keymaps/default/keymap.c @@ -23,6 +23,15 @@ enum custom_keycodes { #define KC_RASE RAISE #define KC_RST RESET #define KC_BL_S BL_STEP +#define KC_DBUG DEBUG +#define KC_RTOG RGB_TOG +#define KC_RMOD RGB_MOD +#define KC_RHUI RGB_HUI +#define KC_RHUD RGB_HUD +#define KC_RSAI RGB_SAI +#define KC_RSAD RGB_SAD +#define KC_RVAI RGB_VAI +#define KC_RVAD RGB_VAD const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -34,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //|----+----+----+----+----+----| |----+----+----+----+----+----| RASE, A , S , D , F , G , H , J , K , L ,SCLN,QUOT, //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| - LSFT, Z , X , C , V , B ,SPC , ENT , N , M ,COMM,DOT ,SLSH,RGHT, + LSFT, Z , X , C , V , B ,SPC , ENT , N , M ,COMM,DOT ,SLSH,RSFT, //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' LCTL,LOWR,SPC , ENT ,LGUI,LALT // `----+----+----' `----+----+----' @@ -68,18 +77,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // `----+----+----' `----+----+----' ), - [_ADJUST] = KEYMAP( - //,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------. - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, DEBUG , RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______, _______, _______, _______, _______, - //|--------+--------+--------+--------+--------+--------+--------. ,--------|--------+--------+--------+--------+--------+--------| - BL_STEP, RESET , _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - //`--------+--------+--------+----+---+--------+--------+--------/ \--------+--------+--------+---+----+--------+--------+--------' - _______, _______, _______, _______, _______, _______ - // `--------+--------+--------' `--------+--------+--------' + [_ADJUST] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + , , , , , , , , , , , , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + RTOG,RMOD,RHUI,RSAI,RVAI, , , , , , , , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + ,DBUG,RHUD,RSAD,RVAD, , , , , , , , + //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| + BL_S,RST , , , , , , , , , , , , , + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + , , , , , + // `----+----+----' `----+----+----' ) }; From 57dde3ddba5de982b9d70787e977a737c67b9db1 Mon Sep 17 00:00:00 2001 From: Niles Christensen Date: Sun, 28 Jan 2018 15:24:43 -0500 Subject: [PATCH 066/173] Makes layers consistent with comments --- keyboards/viterbi/keymaps/default/keymap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/viterbi/keymaps/default/keymap.c b/keyboards/viterbi/keymaps/default/keymap.c index b5215f92..f4f4c932 100644 --- a/keyboards/viterbi/keymaps/default/keymap.c +++ b/keyboards/viterbi/keymaps/default/keymap.c @@ -76,7 +76,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| UNDS, ,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN,LCBR,RCBR, //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| - PLUS, , F1 , F2 , F3 , F4 , F5 , F6 ,MINS,PLUS,LCBR,RCBR, , , + PLUS, , F1 , F2 , F3 , F4 , F5 , F6 ,UNDS,PLUS,LCBR,RCBR, , , //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| , , F7 , F8 , F9 ,F10 ,F11 , F12 , , , , , , , //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| @@ -103,7 +103,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| UNDS, , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,LCBR,RCBR, //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| - PLUS, , F1 , F2 , F3 , F4 , F5 , F6 ,MINS,PLUS,LBRC,RBRC, , , + PLUS, , F1 , F2 , F3 , F4 , F5 , F6 ,MINS,EQL ,LBRC,RBRC, , , //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| , , F7 , F8 , F9 ,F10 ,F11 , F12 ,NUHS,NUBS, , , , , //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| From 7d79412f9989d71e9c0514958bc39d1cc1649521 Mon Sep 17 00:00:00 2001 From: jetpacktuxedo Date: Thu, 8 Feb 2018 08:55:51 -0800 Subject: [PATCH 067/173] Fixed my minivan F-keys --- keyboards/tv44/keymaps/jetpacktuxedo/keymap.c | 2 +- keyboards/tv44/keymaps/jetpacktuxedo/readme.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/tv44/keymaps/jetpacktuxedo/keymap.c b/keyboards/tv44/keymaps/jetpacktuxedo/keymap.c index f10cd622..f7c64cfb 100644 --- a/keyboards/tv44/keymaps/jetpacktuxedo/keymap.c +++ b/keyboards/tv44/keymaps/jetpacktuxedo/keymap.c @@ -23,7 +23,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [3] = KEYMAP_ARROW_COMMAND( /* LAYER 3 */ 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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 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_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 ), diff --git a/keyboards/tv44/keymaps/jetpacktuxedo/readme.md b/keyboards/tv44/keymaps/jetpacktuxedo/readme.md index 937d3b4b..fd95b56a 100644 --- a/keyboards/tv44/keymaps/jetpacktuxedo/readme.md +++ b/keyboards/tv44/keymaps/jetpacktuxedo/readme.md @@ -34,7 +34,7 @@ I don't want to be using two key combos constantly, so I also added this symbol I very rarely use Fkeys, but figured I'd throw them on anyway just in case. The setup basically mimics the way Fkeys are usually done on a 60%, with F11 and F12 still on - and =, even though the location of those keys has moved. ``` | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 |F10 | | -| | | | | | | | | |F11 |F12 | | +| | | | | | | | |F11 |F12 | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` From 63c16f4b632a2a82a775f51a3ad0cc690cca1fc9 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Thu, 8 Feb 2018 14:39:40 -0500 Subject: [PATCH 068/173] ARM audio fixes, stack size increase (#2365) * fix up arm audio implementation * chibios stack size inc * get one channel working * update for chibios --- quantum/audio/audio_arm.c | 280 +++++++++++++++++++++++++++++++------- tmk_core/chibios.mk | 2 +- 2 files changed, 231 insertions(+), 51 deletions(-) diff --git a/quantum/audio/audio_arm.c b/quantum/audio/audio_arm.c index 43c8d67c..247dc337 100644 --- a/quantum/audio/audio_arm.c +++ b/quantum/audio/audio_arm.c @@ -77,23 +77,48 @@ bool glissando = true; #endif float startup_song[][2] = STARTUP_SONG; -static void gpt_cb6(GPTDriver *gptp); -static void gpt_cb7(GPTDriver *gptp); static void gpt_cb8(GPTDriver *gptp); +#define DAC_BUFFER_SIZE 360 + +#define START_CHANNEL_1() gptStart(&GPTD6, &gpt6cfg1); \ + gptStartContinuous(&GPTD6, 2U) +#define START_CHANNEL_2() gptStart(&GPTD7, &gpt7cfg1); \ + gptStartContinuous(&GPTD7, 2U) +#define STOP_CHANNEL_1() gptStopTimer(&GPTD6) +#define STOP_CHANNEL_2() gptStopTimer(&GPTD7) +#define RESTART_CHANNEL_1() STOP_CHANNEL_1(); \ + START_CHANNEL_1() +#define RESTART_CHANNEL_2() STOP_CHANNEL_2(); \ + START_CHANNEL_2() +#define UPDATE_CHANNEL_1_FREQ(freq) gpt6cfg1.frequency = freq * DAC_BUFFER_SIZE; \ + RESTART_CHANNEL_1() +#define UPDATE_CHANNEL_2_FREQ(freq) gpt7cfg1.frequency = freq * DAC_BUFFER_SIZE; \ + RESTART_CHANNEL_2() +#define GET_CHANNEL_1_FREQ gpt6cfg1.frequency +#define GET_CHANNEL_2_FREQ gpt7cfg1.frequency + + /* * GPT6 configuration. */ +// static const GPTConfig gpt6cfg1 = { +// .frequency = 1000000U, +// .callback = NULL, +// .cr2 = TIM_CR2_MMS_1, /* MMS = 010 = TRGO on Update Event. */ +// .dier = 0U +// }; + GPTConfig gpt6cfg1 = { - .frequency = 440, - .callback = gpt_cb6, + .frequency = 440U*DAC_BUFFER_SIZE, + .callback = NULL, .cr2 = TIM_CR2_MMS_1, /* MMS = 010 = TRGO on Update Event. */ .dier = 0U }; GPTConfig gpt7cfg1 = { - .frequency = 440, - .callback = gpt_cb7, + .frequency = 440U*DAC_BUFFER_SIZE, + .callback = NULL, .cr2 = TIM_CR2_MMS_1, /* MMS = 010 = TRGO on Update Event. */ .dier = 0U }; @@ -105,15 +130,169 @@ GPTConfig gpt8cfg1 = { .dier = 0U }; -static void gpt_cb6(GPTDriver *gptp) { - palTogglePad(GPIOA, 4); + +/* + * DAC test buffer (sine wave). + */ +// static const dacsample_t dac_buffer[DAC_BUFFER_SIZE] = { +// 2047, 2082, 2118, 2154, 2189, 2225, 2260, 2296, 2331, 2367, 2402, 2437, +// 2472, 2507, 2542, 2576, 2611, 2645, 2679, 2713, 2747, 2780, 2813, 2846, +// 2879, 2912, 2944, 2976, 3008, 3039, 3070, 3101, 3131, 3161, 3191, 3221, +// 3250, 3278, 3307, 3335, 3362, 3389, 3416, 3443, 3468, 3494, 3519, 3544, +// 3568, 3591, 3615, 3637, 3660, 3681, 3703, 3723, 3744, 3763, 3782, 3801, +// 3819, 3837, 3854, 3870, 3886, 3902, 3917, 3931, 3944, 3958, 3970, 3982, +// 3993, 4004, 4014, 4024, 4033, 4041, 4049, 4056, 4062, 4068, 4074, 4078, +// 4082, 4086, 4089, 4091, 4092, 4093, 4094, 4093, 4092, 4091, 4089, 4086, +// 4082, 4078, 4074, 4068, 4062, 4056, 4049, 4041, 4033, 4024, 4014, 4004, +// 3993, 3982, 3970, 3958, 3944, 3931, 3917, 3902, 3886, 3870, 3854, 3837, +// 3819, 3801, 3782, 3763, 3744, 3723, 3703, 3681, 3660, 3637, 3615, 3591, +// 3568, 3544, 3519, 3494, 3468, 3443, 3416, 3389, 3362, 3335, 3307, 3278, +// 3250, 3221, 3191, 3161, 3131, 3101, 3070, 3039, 3008, 2976, 2944, 2912, +// 2879, 2846, 2813, 2780, 2747, 2713, 2679, 2645, 2611, 2576, 2542, 2507, +// 2472, 2437, 2402, 2367, 2331, 2296, 2260, 2225, 2189, 2154, 2118, 2082, +// 2047, 2012, 1976, 1940, 1905, 1869, 1834, 1798, 1763, 1727, 1692, 1657, +// 1622, 1587, 1552, 1518, 1483, 1449, 1415, 1381, 1347, 1314, 1281, 1248, +// 1215, 1182, 1150, 1118, 1086, 1055, 1024, 993, 963, 933, 903, 873, +// 844, 816, 787, 759, 732, 705, 678, 651, 626, 600, 575, 550, +// 526, 503, 479, 457, 434, 413, 391, 371, 350, 331, 312, 293, +// 275, 257, 240, 224, 208, 192, 177, 163, 150, 136, 124, 112, +// 101, 90, 80, 70, 61, 53, 45, 38, 32, 26, 20, 16, +// 12, 8, 5, 3, 2, 1, 0, 1, 2, 3, 5, 8, +// 12, 16, 20, 26, 32, 38, 45, 53, 61, 70, 80, 90, +// 101, 112, 124, 136, 150, 163, 177, 192, 208, 224, 240, 257, +// 275, 293, 312, 331, 350, 371, 391, 413, 434, 457, 479, 503, +// 526, 550, 575, 600, 626, 651, 678, 705, 732, 759, 787, 816, +// 844, 873, 903, 933, 963, 993, 1024, 1055, 1086, 1118, 1150, 1182, +// 1215, 1248, 1281, 1314, 1347, 1381, 1415, 1449, 1483, 1518, 1552, 1587, +// 1622, 1657, 1692, 1727, 1763, 1798, 1834, 1869, 1905, 1940, 1976, 2012 +// }; + +// squarewave +static const dacsample_t dac_buffer[DAC_BUFFER_SIZE] = { + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +// squarewave +static const dacsample_t dac_buffer_2[DAC_BUFFER_SIZE] = { + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* + * DAC streaming callback. + */ +size_t nx = 0, ny = 0, nz = 0; +static void end_cb1(DACDriver *dacp, dacsample_t *buffer, size_t n) { + + (void)dacp; + + nz++; + if (dac_buffer == buffer) { + nx += n; + } + else { + ny += n; + } + + if ((nz % 1000) == 0) { + // palTogglePad(GPIOD, GPIOD_LED3); + } } +/* + * DAC error callback. + */ +static void error_cb1(DACDriver *dacp, dacerror_t err) { + + (void)dacp; + (void)err; -static void gpt_cb7(GPTDriver *gptp) { - palTogglePad(GPIOA, 5); + chSysHalt("DAC failure"); } +static const DACConfig dac1cfg1 = { + .init = 2047U, + .datamode = DAC_DHRM_12BIT_RIGHT +}; + +static const DACConversionGroup dacgrpcfg1 = { + .num_channels = 1U, + .end_cb = end_cb1, + .error_cb = error_cb1, + .trigger = DAC_TRG(0) +}; + +static const DACConfig dac1cfg2 = { + .init = 2047U, + .datamode = DAC_DHRM_12BIT_RIGHT +}; + +static const DACConversionGroup dacgrpcfg2 = { + .num_channels = 1U, + .end_cb = end_cb1, + .error_cb = error_cb1, + .trigger = DAC_TRG(0) +}; + void audio_init() { @@ -128,8 +307,30 @@ void audio_init() // audio_config.raw = eeconfig_read_audio(); audio_config.enable = true; - palSetPadMode(GPIOA, 4, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOA, 5, PAL_MODE_OUTPUT_PUSHPULL); + /* + * Starting DAC1 driver, setting up the output pin as analog as suggested + * by the Reference Manual. + */ + palSetPadMode(GPIOA, 4, PAL_MODE_INPUT_ANALOG); + palSetPadMode(GPIOA, 5, PAL_MODE_INPUT_ANALOG); + dacStart(&DACD1, &dac1cfg1); + dacStart(&DACD2, &dac1cfg2); + + /* + * Starting GPT6 driver, it is used for triggering the DAC. + */ + START_CHANNEL_1(); + START_CHANNEL_2(); + + /* + * Starting a continuous conversion. + */ + dacStartConversion(&DACD1, &dacgrpcfg1, + (dacsample_t *)dac_buffer, DAC_BUFFER_SIZE); + dacStartConversion(&DACD2, &dacgrpcfg2, + (dacsample_t *)dac_buffer_2, DAC_BUFFER_SIZE); + // gptStartContinuous(&GPTD6, 2U); + audio_initialized = true; @@ -193,8 +394,8 @@ void stop_note(float freq) voice_place = 0; } if (voices == 0) { - gptStopTimer(&GPTD6); - gptStopTimer(&GPTD7); + STOP_CHANNEL_1(); + STOP_CHANNEL_2(); gptStopTimer(&GPTD8); frequency = 0; frequency_alt = 0; @@ -224,20 +425,6 @@ float vibrato(float average_freq) { #endif -static void restart_gpt6(void) { - // gptStopTimer(&GPTD6); - - gptStart(&GPTD6, &gpt6cfg1); - gptStartContinuous(&GPTD6, 2U); -} - -static void restart_gpt7(void) { - // gptStopTimer(&GPTD7); - - gptStart(&GPTD7, &gpt7cfg1); - gptStartContinuous(&GPTD7, 2U); -} - static void gpt_cb8(GPTDriver *gptp) { float freq; @@ -280,13 +467,10 @@ static void gpt_cb8(GPTDriver *gptp) { freq_alt = 30.52; } - if (gpt6cfg1.frequency != (uint16_t)freq_alt) { - gpt6cfg1.frequency = freq_alt; - restart_gpt6(); + if (GET_CHANNEL_2_FREQ != (uint16_t)freq_alt) { + UPDATE_CHANNEL_2_FREQ(freq_alt); } //note_timbre; - } else { - // gptStopTimer(&GPTD6); } if (polyphony_rate > 0) { @@ -342,13 +526,10 @@ static void gpt_cb8(GPTDriver *gptp) { } - if (gpt7cfg1.frequency != (uint16_t)freq) { - gpt7cfg1.frequency = freq; - restart_gpt7(); + if (GET_CHANNEL_1_FREQ != (uint16_t)freq) { + UPDATE_CHANNEL_1_FREQ(freq); } //note_timbre; - } else { - // gptStopTimer(&GPTD7); } } @@ -370,11 +551,9 @@ static void gpt_cb8(GPTDriver *gptp) { freq = voice_envelope(freq); - if (gpt6cfg1.frequency != (uint16_t)freq) { - gpt6cfg1.frequency = freq; - restart_gpt6(); - gpt7cfg1.frequency = freq; - restart_gpt7(); + if (GET_CHANNEL_1_FREQ != (uint16_t)freq) { + UPDATE_CHANNEL_1_FREQ(freq); + UPDATE_CHANNEL_2_FREQ(freq); } //note_timbre; } else { @@ -384,8 +563,8 @@ static void gpt_cb8(GPTDriver *gptp) { note_position++; bool end_of_note = false; - if (gpt6cfg1.frequency > 0) { - if (!note_resting) + if (GET_CHANNEL_1_FREQ > 0) { + if (!note_resting) end_of_note = (note_position >= (note_length*16 - 1)); else end_of_note = (note_position >= (note_length*16)); @@ -399,8 +578,8 @@ static void gpt_cb8(GPTDriver *gptp) { if (notes_repeat) { current_note = 0; } else { - gptStopTimer(&GPTD6); - gptStopTimer(&GPTD7); + STOP_CHANNEL_1(); + STOP_CHANNEL_2(); // gptStopTimer(&GPTD8); playing_notes = false; return; @@ -459,7 +638,8 @@ void play_note(float freq, int vol) { gptStart(&GPTD8, &gpt8cfg1); gptStartContinuous(&GPTD8, 2U); - + RESTART_CHANNEL_1(); + RESTART_CHANNEL_2(); } } @@ -492,8 +672,8 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat) gptStart(&GPTD8, &gpt8cfg1); gptStartContinuous(&GPTD8, 2U); - restart_gpt6(); - restart_gpt7(); + RESTART_CHANNEL_1(); + RESTART_CHANNEL_2(); } } diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index df9fa849..1cd0146f 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk @@ -6,7 +6,7 @@ # Stack size to be allocated to the Cortex-M process stack. This stack is # the stack used by the main() thread. ifeq ($(USE_PROCESS_STACKSIZE),) - USE_PROCESS_STACKSIZE = 0x200 + USE_PROCESS_STACKSIZE = 0x800 endif # Stack size to the allocated to the Cortex-M main/exceptions stack. This From 53ff8a31b61952d9675558149d927f7942071df9 Mon Sep 17 00:00:00 2001 From: fredizzimo Date: Thu, 8 Feb 2018 22:07:46 +0200 Subject: [PATCH 069/173] Merge ChibiOS and LUFA descriptor support (#2362) * Move lufa descriptor to protocol/usb_descriptor * Try to compile usb_descriptor on ChibiOS * Add lufa_utils for ChibiOS Lufa USB descriptors for ChibiOS * More lufa_util compatibility fixes * First compiling version of shared USB descriptor * Send the usb descriptors * Fix the CONSOLE output on ChibiOS * Add errors for unsupported interfaces * Enable support for vitual serial port USB descriptors * Implement virtual serial port for ChibiOS * Cleanup the lufa_utils Use the default lufa header files * Add raw hid support for ChibiOS This is completely untested * Enable midi compilation on ChibiOS * Move midi functionality out of lufa.c * Don't register sysex callback when not needed * ChibiOS compilation fixes * Update ChibiOS submodule * Fix the Midi USB descriptor It didn't work properly when both Midi and Virtual serial port was enabled. * Add MIDI support for ChibiOS * Fix USB descriptor strings on ChibiOS * Use serial usb driver for raw hid * Generalize the ChibiOS stream like drivers This makes the initialization much more simple and eliminates a lot of the code duplication. * Convert console output to chibios stream driver * Fixes for ChibiOS update * Update the ChibiOS contrib submodule To include the usb data toggle synchronization fixes * Fix duplicate reset enumeration on ChibiOS * Add missing include * Add number of endpoints check for ChibiOS * Enable serial USB driver on all keyboards * Add missing includes when API is enabled withot midi * Add another missing inlcude --- build_keyboard.mk | 7 +- keyboards/chibios_test/config.h | 8 +- .../chibios_test/stm32_f072_onekey/halconf.h | 2 +- .../chibios_test/stm32_f103_onekey/halconf.h | 2 +- .../chibios_test/teensy_lc_onekey/halconf.h | 2 +- keyboards/clueboard/60/config.h | 8 +- keyboards/ergodox_infinity/config.h | 8 +- keyboards/infinity60/config.h | 6 +- keyboards/infinity60/halconf.h | 2 +- keyboards/jm60/config.h | 8 +- keyboards/jm60/halconf.h | 2 +- keyboards/whitefox/config.h | 8 +- lib/chibios | 2 +- lib/chibios-contrib | 2 +- quantum/api/api_sysex.c | 1 + quantum/keymap.h | 3 + quantum/process_keycode/process_midi.c | 58 +- quantum/process_keycode/process_midi.h | 5 +- quantum/quantum.c | 8 + quantum/quantum.h | 1 - tmk_core/chibios.mk | 2 + tmk_core/common/host_driver.h | 5 - tmk_core/common/keyboard.c | 7 + tmk_core/common/report.h | 30 +- tmk_core/protocol/chibios.mk | 9 + .../chibios/lufa_utils/LUFA/Drivers/USB/USB.h | 42 + tmk_core/protocol/chibios/main.c | 27 + tmk_core/protocol/chibios/usb_main.c | 1027 +++++------------ tmk_core/protocol/chibios/usb_main.h | 34 - tmk_core/protocol/lufa.mk | 4 +- tmk_core/protocol/lufa/lufa.c | 338 +----- tmk_core/protocol/lufa/lufa.h | 10 +- tmk_core/protocol/midi.mk | 3 +- .../midi/bytequeue/interrupt_setting.c | 15 +- tmk_core/protocol/midi/qmk_midi.c | 184 +++ tmk_core/protocol/midi/qmk_midi.h | 9 + .../{lufa/descriptor.c => usb_descriptor.c} | 26 +- .../{lufa/descriptor.h => usb_descriptor.h} | 65 +- 38 files changed, 752 insertions(+), 1228 deletions(-) create mode 100644 tmk_core/protocol/chibios/lufa_utils/LUFA/Drivers/USB/USB.h create mode 100644 tmk_core/protocol/midi/qmk_midi.c create mode 100644 tmk_core/protocol/midi/qmk_midi.h rename tmk_core/protocol/{lufa/descriptor.c => usb_descriptor.c} (97%) rename tmk_core/protocol/{lufa/descriptor.h => usb_descriptor.h} (79%) diff --git a/build_keyboard.mk b/build_keyboard.mk index bee8fcc8..921159a5 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -121,7 +121,6 @@ else endif ifeq ($(PLATFORM),CHIBIOS) - include $(TMK_PATH)/protocol/chibios.mk include $(TMK_PATH)/chibios.mk OPT_OS = chibios ifneq ("$(wildcard $(KEYBOARD_PATH_5)/bootloader_defs.h)","") @@ -197,7 +196,7 @@ else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.c)","") KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1) else ifneq ($(LAYOUTS),) include build_layout.mk -else +else $(error Could not find keymap) # this state should never be reached endif @@ -247,6 +246,10 @@ endif include $(TMK_PATH)/avr.mk endif +ifeq ($(PLATFORM),CHIBIOS) + include $(TMK_PATH)/protocol/chibios.mk +endif + ifeq ($(strip $(VISUALIZER_ENABLE)), yes) VISUALIZER_DIR = $(QUANTUM_DIR)/visualizer VISUALIZER_PATH = $(QUANTUM_PATH)/visualizer diff --git a/keyboards/chibios_test/config.h b/keyboards/chibios_test/config.h index c32a77b3..89eb1f33 100644 --- a/keyboards/chibios_test/config.h +++ b/keyboards/chibios_test/config.h @@ -24,11 +24,9 @@ along with this program. If not, see . #define DEVICE_VER 0x0001 /* in python2: list(u"whatever".encode('utf-16-le')) */ /* at most 32 characters or the ugly hack in usb_main.c borks */ -#define MANUFACTURER "QMK" -#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', '\xc6', '\x00' -#define PRODUCT "ChibiOS QMK test" -#define USBSTR_PRODUCT 'C', '\x00', 'h', '\x00', 'i', '\x00', 'b', '\x00', 'i', '\x00', 'O', '\x00', 'S', '\x00', ' ', '\x00', 'Q', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', 't', '\x00', 'e', '\x00', 's', '\x00', 't', '\x00' -#define DESCRIPTION "QMK keyboard firmware test for ChibiOS" +#define MANUFACTURER QMK +#define PRODUCT ChibiOS QMK test +#define DESCRIPTION QMK keyboard firmware test for ChibiOS /* key matrix size */ #define MATRIX_ROWS 1 diff --git a/keyboards/chibios_test/stm32_f072_onekey/halconf.h b/keyboards/chibios_test/stm32_f072_onekey/halconf.h index 1a450d63..46b37a4f 100644 --- a/keyboards/chibios_test/stm32_f072_onekey/halconf.h +++ b/keyboards/chibios_test/stm32_f072_onekey/halconf.h @@ -139,7 +139,7 @@ * @brief Enables the SERIAL over USB subsystem. */ #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL_USB FALSE +#define HAL_USE_SERIAL_USB TRUE #endif /** diff --git a/keyboards/chibios_test/stm32_f103_onekey/halconf.h b/keyboards/chibios_test/stm32_f103_onekey/halconf.h index 1a450d63..46b37a4f 100644 --- a/keyboards/chibios_test/stm32_f103_onekey/halconf.h +++ b/keyboards/chibios_test/stm32_f103_onekey/halconf.h @@ -139,7 +139,7 @@ * @brief Enables the SERIAL over USB subsystem. */ #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL_USB FALSE +#define HAL_USE_SERIAL_USB TRUE #endif /** diff --git a/keyboards/chibios_test/teensy_lc_onekey/halconf.h b/keyboards/chibios_test/teensy_lc_onekey/halconf.h index 0436408b..f7121f1a 100644 --- a/keyboards/chibios_test/teensy_lc_onekey/halconf.h +++ b/keyboards/chibios_test/teensy_lc_onekey/halconf.h @@ -139,7 +139,7 @@ * @brief Enables the SERIAL over USB subsystem. */ #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL_USB FALSE +#define HAL_USE_SERIAL_USB TRUE #endif /** diff --git a/keyboards/clueboard/60/config.h b/keyboards/clueboard/60/config.h index 333698a0..5c5a8629 100644 --- a/keyboards/clueboard/60/config.h +++ b/keyboards/clueboard/60/config.h @@ -22,11 +22,9 @@ #define VENDOR_ID 0xC1ED #define PRODUCT_ID 0x2350 #define DEVICE_VER 0x0001 -#define MANUFACTURER "Clueboard" -#define USBSTR_MANUFACTURER 'C', '\x00', 'l', '\x00', 'u', '\x00', 'e', '\x00', 'b', '\x00', 'o', '\x00', 'a', '\x00', 'r', '\x00', 'd', '\x00' -#define PRODUCT "Clueboard60" -#define USBSTR_PRODUCT 'C', '\x00', 'l', '\x00', 'u', '\x00', 'e', '\x00', 'b', '\x00', 'o', '\x00', 'a', '\x00', 'r', '\x00', 'd', '\x00', ' ', '\x00', '6', '\x00', '0', '\x00', '%', '\x00' -#define DESCRIPTION "Clueboard 60%" +#define MANUFACTURER Clueboard +#define PRODUCT Clueboard 60% +#define DESCRIPTION Clueboard 60% /* key matrix size */ #define MATRIX_ROWS 5 diff --git a/keyboards/ergodox_infinity/config.h b/keyboards/ergodox_infinity/config.h index 094761e0..2f1be0d2 100644 --- a/keyboards/ergodox_infinity/config.h +++ b/keyboards/ergodox_infinity/config.h @@ -23,12 +23,8 @@ along with this program. If not, see . #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x6464 #define DEVICE_VER 0x0001 -/* in python2: list(u"whatever".encode('utf-16-le')) */ -/* at most 32 characters or the ugly hack in usb_main.c borks */ -#define MANUFACTURER "TMK" -#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00' -#define PRODUCT "Infinity keyboard/TMK" -#define USBSTR_PRODUCT 'I', '\x00', 'n', '\x00', 'f', '\x00', 'i', '\x00', 'n', '\x00', 'i', '\x00', 't', '\x00', 'y', '\x00', ' ', '\x00', 'k', '\x00', 'e', '\x00', 'y', '\x00', 'b', '\x00', 'o', '\x00', 'a', '\x00', 'r', '\x00', 'd', '\x00', '/', '\x00', 'T', '\x00', 'M', '\x00', 'K', '\x00' +#define MANUFACTURER Input Club +#define PRODUCT Ergodox Infinity (QMK) #define MOUSEKEY_INTERVAL 20 #define MOUSEKEY_DELAY 0 diff --git a/keyboards/infinity60/config.h b/keyboards/infinity60/config.h index 83930901..0a2f93e2 100644 --- a/keyboards/infinity60/config.h +++ b/keyboards/infinity60/config.h @@ -26,10 +26,8 @@ along with this program. If not, see . #define DEVICE_VER 0x0001 /* in python2: list(u"whatever".encode('utf-16-le')) */ /* at most 32 characters or the ugly hack in usb_main.c borks */ -#define MANUFACTURER "Input Club" -#define USBSTR_MANUFACTURER 'I', '\x00', 'n', '\x00', 'p', '\x00', 'u', '\x00', 't', '\x00', ' ', '\x00', 'C', '\x00', 'l', '\x00', 'u', '\x00', 'b', '\x00' -#define PRODUCT "Infinity keyboard/QMK" -#define USBSTR_PRODUCT 'I', '\x00', 'n', '\x00', 'f', '\x00', 'i', '\x00', 'n', '\x00', 'i', '\x00', 't', '\x00', 'y', '\x00', ' ', '\x00', 'k', '\x00', 'e', '\x00', 'y', '\x00', 'b', '\x00', 'o', '\x00', 'a', '\x00', 'r', '\x00', 'd', '\x00', '/', '\x00', 'Q', '\x00', 'M', '\x00', 'K', '\x00' +#define MANUFACTURER Input Club +#define PRODUCT Infinity 60% keyboard (QMK) /* key matrix size */ #define MATRIX_ROWS 9 #define MATRIX_COLS 7 diff --git a/keyboards/infinity60/halconf.h b/keyboards/infinity60/halconf.h index f89dfc2e..b3803152 100644 --- a/keyboards/infinity60/halconf.h +++ b/keyboards/infinity60/halconf.h @@ -139,7 +139,7 @@ * @brief Enables the SERIAL over USB subsystem. */ #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL_USB FALSE +#define HAL_USE_SERIAL_USB TRUE #endif /** diff --git a/keyboards/jm60/config.h b/keyboards/jm60/config.h index 25964133..847cf207 100644 --- a/keyboards/jm60/config.h +++ b/keyboards/jm60/config.h @@ -26,11 +26,9 @@ along with this program. If not, see . #define DEVICE_VER 0x0001 /* in python2: list(u"whatever".encode('utf-16-le')) */ /* at most 32 characters or the ugly hack in usb_main.c borks */ -#define MANUFACTURER "JMWS" -#define USBSTR_MANUFACTURER 'J', '\x00', 'M', '\x00', 'W', '\x00', 'S', '\x00' -#define PRODUCT "JM60 RGB Keyboard(QMK)" -#define USBSTR_PRODUCT 'J', '\x00', 'M', '\x00', '6', '\x00', '0', '\x00', ' ', '\x00', 'R', '\x00', 'G', '\x00', 'B', '\x00', ' ', '\x00', 'K', '\x00', 'e', '\x00', 'y', '\x00', 'b', '\x00', 'o', '\x00', 'a', '\x00', 'r', '\x00', 'd', '\x00', '(', '\x00', 'Q', '\x00', 'M', '\x00', 'K', '\x00', ')', '\x00' -#define DESCRIPTION "QMK keyboard firmware for JM60 RGB Keyboard" +#define MANUFACTURER JMWS +#define PRODUCT JM60 RGB Keyboard(QMK) +#define DESCRIPTION QMK keyboard firmware for JM60 RGB Keyboard /* key matrix size */ #define MATRIX_ROWS 5 diff --git a/keyboards/jm60/halconf.h b/keyboards/jm60/halconf.h index 1a450d63..46b37a4f 100644 --- a/keyboards/jm60/halconf.h +++ b/keyboards/jm60/halconf.h @@ -139,7 +139,7 @@ * @brief Enables the SERIAL over USB subsystem. */ #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL_USB FALSE +#define HAL_USE_SERIAL_USB TRUE #endif /** diff --git a/keyboards/whitefox/config.h b/keyboards/whitefox/config.h index dc33a7ce..9397bd61 100644 --- a/keyboards/whitefox/config.h +++ b/keyboards/whitefox/config.h @@ -26,10 +26,8 @@ along with this program. If not, see . #define DEVICE_VER 0x0001 /* in python2: list(u"whatever".encode('utf-16-le')) */ /* at most 32 characters or the ugly hack in usb_main.c borks */ -#define MANUFACTURER "Input Club" -#define USBSTR_MANUFACTURER 'I', '\x00', 'n', '\x00', 'p', '\x00', 'u', '\x00', 't', '\x00', ' ', '\x00', 'C', '\x00', 'l', '\x00', 'u', '\x00', 'b', '\x00' -#define PRODUCT "WhiteFox/QMK" -#define USBSTR_PRODUCT 'W', '\x00', 'h', '\x00', 'i', '\x00', 't', '\x00', 'e', '\x00', 'F', '\x00', 'o', '\x00', 'x', '\x00', ' ', '\x00' +#define MANUFACTURER Input Club +#define PRODUCT WhiteFox (QMK) /* key matrix size */ #define MATRIX_ROWS 9 @@ -81,4 +79,4 @@ along with this program. If not, see . //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION -#endif \ No newline at end of file +#endif diff --git a/lib/chibios b/lib/chibios index e26cb16a..587968d6 160000 --- a/lib/chibios +++ b/lib/chibios @@ -1 +1 @@ -Subproject commit e26cb16a7296a196d7c74eae22cbee00989cb7b6 +Subproject commit 587968d6cbc2b0e1c7147540872f2a67e59ca18b diff --git a/lib/chibios-contrib b/lib/chibios-contrib index 432bc176..ede48346 160000 --- a/lib/chibios-contrib +++ b/lib/chibios-contrib @@ -1 +1 @@ -Subproject commit 432bc1762f17eb7b506e8fbca8ec30a3d61629b8 +Subproject commit ede48346eee4b8d6847c19bc01420bee76a5e486 diff --git a/quantum/api/api_sysex.c b/quantum/api/api_sysex.c index 6a2ee901..89c66a2a 100644 --- a/quantum/api/api_sysex.c +++ b/quantum/api/api_sysex.c @@ -16,6 +16,7 @@ #include "api_sysex.h" #include "sysex_tools.h" #include "print.h" +#include "qmk_midi.h" void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint16_t length) { // SEND_STRING("\nTX: "); diff --git a/quantum/keymap.h b/quantum/keymap.h index 5d64be19..bfcb2f7c 100644 --- a/quantum/keymap.h +++ b/quantum/keymap.h @@ -23,6 +23,9 @@ along with this program. If not, see . #include "action.h" #if defined(__AVR__) #include +#elif defined PROTOCOL_CHIBIOS +//We need to ensure that chibios is include before redefining reset +#include "ch.h" #endif #include "keycode.h" #include "action_macro.h" diff --git a/quantum/process_keycode/process_midi.c b/quantum/process_keycode/process_midi.c index 9184feaa..9728076d 100644 --- a/quantum/process_keycode/process_midi.c +++ b/quantum/process_keycode/process_midi.c @@ -16,11 +16,13 @@ #include "process_midi.h" #ifdef MIDI_ENABLE +#include #include "midi.h" +#include "qmk_midi.h" #ifdef MIDI_BASIC -void process_midi_basic_noteon(uint8_t note) +void process_midi_basic_noteon(uint8_t note) { midi_send_noteon(&midi_device, 0, note, 128); } @@ -46,6 +48,7 @@ static uint8_t tone_status[MIDI_TONE_COUNT]; static uint8_t midi_modulation; static int8_t midi_modulation_step; static uint16_t midi_modulation_timer; +midi_config_t midi_config; inline uint8_t compute_velocity(uint8_t setting) { @@ -70,30 +73,6 @@ void midi_init(void) midi_modulation_timer = 0; } -void midi_task(void) -{ - if (timer_elapsed(midi_modulation_timer) < midi_config.modulation_interval) - return; - midi_modulation_timer = timer_read(); - - if (midi_modulation_step != 0) - { - dprintf("midi modulation %d\n", midi_modulation); - midi_send_cc(&midi_device, midi_config.channel, 0x1, midi_modulation); - - if (midi_modulation_step < 0 && midi_modulation < -midi_modulation_step) { - midi_modulation = 0; - midi_modulation_step = 0; - return; - } - - midi_modulation += midi_modulation_step; - - if (midi_modulation > 127) - midi_modulation = 127; - } -} - uint8_t midi_compute_note(uint16_t keycode) { return 12 * midi_config.octave + (keycode - MIDI_TONE_MIN) + midi_config.transpose; @@ -250,4 +229,33 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) #endif // MIDI_ADVANCED +void midi_task(void) +{ + midi_device_process(&midi_device); +#ifdef MIDI_ADVANCED + if (timer_elapsed(midi_modulation_timer) < midi_config.modulation_interval) + return; + midi_modulation_timer = timer_read(); + + if (midi_modulation_step != 0) + { + dprintf("midi modulation %d\n", midi_modulation); + midi_send_cc(&midi_device, midi_config.channel, 0x1, midi_modulation); + + if (midi_modulation_step < 0 && midi_modulation < -midi_modulation_step) { + midi_modulation = 0; + midi_modulation_step = 0; + return; + } + + midi_modulation += midi_modulation_step; + + if (midi_modulation > 127) + midi_modulation = 127; + } +#endif +} + + + #endif // MIDI_ENABLE diff --git a/quantum/process_keycode/process_midi.h b/quantum/process_keycode/process_midi.h index ccac8981..1968fbe3 100644 --- a/quantum/process_keycode/process_midi.h +++ b/quantum/process_keycode/process_midi.h @@ -27,6 +27,8 @@ void process_midi_basic_noteoff(uint8_t note); void process_midi_all_notes_off(void); #endif +void midi_task(void); + #ifdef MIDI_ADVANCED typedef union { uint32_t raw; @@ -39,10 +41,9 @@ typedef union { }; } midi_config_t; -midi_config_t midi_config; +extern midi_config_t midi_config; void midi_init(void); -void midi_task(void); bool process_midi(uint16_t keycode, keyrecord_t *record); #define MIDI_INVALID_NOTE 0xFF diff --git a/quantum/quantum.c b/quantum/quantum.c index d3685f50..bd95d5ea 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -34,6 +34,14 @@ extern backlight_config_t backlight_config; #include "fauxclicky.h" #endif +#ifdef API_ENABLE +#include "api.h" +#endif + +#ifdef MIDI_ENABLE +#include "process_midi.h" +#endif + #ifdef AUDIO_ENABLE #ifndef GOODBYE_SONG #define GOODBYE_SONG SONG(GOODBYE_SOUND) diff --git a/quantum/quantum.h b/quantum/quantum.h index 6ca5ecb5..b4c9e0b8 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -49,7 +49,6 @@ extern uint32_t default_layer_state; #endif #ifdef MIDI_ENABLE - #include #ifdef MIDI_ADVANCED #include "process_midi.h" #endif diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index 1cd0146f..7c7f658b 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk @@ -149,6 +149,7 @@ COMPILEFLAGS += -falign-functions=16 COMPILEFLAGS += -ffunction-sections COMPILEFLAGS += -fdata-sections COMPILEFLAGS += -fno-common +COMPILEFLAGS += -fshort-wchar COMPILEFLAGS += $(THUMBFLAGS) CFLAGS += $(COMPILEFLAGS) @@ -159,6 +160,7 @@ CPPFLAGS += $(COMPILEFLAGS) CPPFLAGS += -fno-rtti LDFLAGS +=-Wl,--gc-sections +LDFLAGS +=-Wl,--no-wchar-size-warning LDFLAGS += -mno-thumb-interwork -mthumb LDSYMBOLS =,--defsym=__process_stack_size__=$(USE_PROCESS_STACKSIZE) LDSYMBOLS :=$(LDSYMBOLS),--defsym=__main_stack_size__=$(USE_EXCEPTIONS_STACKSIZE) diff --git a/tmk_core/common/host_driver.h b/tmk_core/common/host_driver.h index 588d1c0b..e40f0bfd 100644 --- a/tmk_core/common/host_driver.h +++ b/tmk_core/common/host_driver.h @@ -30,11 +30,6 @@ typedef struct { void (*send_mouse)(report_mouse_t *); void (*send_system)(uint16_t); void (*send_consumer)(uint16_t); -#ifdef MIDI_ENABLE - void (*usb_send_func)(MidiDevice *, uint16_t, uint8_t, uint8_t, uint8_t); - void (*usb_get_midi)(MidiDevice *); - void (*midi_usb_init)(MidiDevice *); -#endif } host_driver_t; #endif diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index 436fb607..001fb00c 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c @@ -66,6 +66,9 @@ along with this program. If not, see . #ifdef POINTING_DEVICE_ENABLE # include "pointing_device.h" #endif +#ifdef MIDI_ENABLE +# include "process_midi.h" +#endif #ifdef MATRIX_HAS_GHOST extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; @@ -260,6 +263,10 @@ MATRIX_LOOP_END: pointing_device_task(); #endif +#ifdef MIDI_ENABLE + midi_task(); +#endif + // update LED if (led_status != host_keyboard_leds()) { led_status = host_keyboard_leds(); diff --git a/tmk_core/common/report.h b/tmk_core/common/report.h index a0811f9a..6c27eb9d 100644 --- a/tmk_core/common/report.h +++ b/tmk_core/common/report.h @@ -73,22 +73,20 @@ along with this program. If not, see . /* key report size(NKRO or boot mode) */ -#if defined(PROTOCOL_PJRC) && defined(NKRO_ENABLE) -# include "usb.h" -# define KEYBOARD_REPORT_SIZE KBD2_SIZE -# define KEYBOARD_REPORT_KEYS (KBD2_SIZE - 2) -# define KEYBOARD_REPORT_BITS (KBD2_SIZE - 1) - -#elif defined(PROTOCOL_LUFA) && defined(NKRO_ENABLE) -# include "protocol/lufa/descriptor.h" -# define KEYBOARD_REPORT_SIZE NKRO_EPSIZE -# define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2) -# define KEYBOARD_REPORT_BITS (NKRO_EPSIZE - 1) -#elif defined(PROTOCOL_CHIBIOS) && defined(NKRO_ENABLE) -# include "protocol/chibios/usb_main.h" -# define KEYBOARD_REPORT_SIZE NKRO_EPSIZE -# define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2) -# define KEYBOARD_REPORT_BITS (NKRO_EPSIZE - 1) +#if defined(NKRO_ENABLE) + #if defined(PROTOCOL_PJRC) + #include "usb.h" + #define KEYBOARD_REPORT_SIZE KBD2_SIZE + #define KEYBOARD_REPORT_KEYS (KBD2_SIZE - 2) + #define KEYBOARD_REPORT_BITS (KBD2_SIZE - 1) + #elif defined(PROTOCOL_LUFA) || defined(PROTOCOL_CHIBIOS) + #include "protocol/usb_descriptor.h" + #define KEYBOARD_REPORT_SIZE NKRO_EPSIZE + #define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2) + #define KEYBOARD_REPORT_BITS (NKRO_EPSIZE - 1) + #else + #error "NKRO not supported with this protocol" +#endif #else # define KEYBOARD_REPORT_SIZE 8 diff --git a/tmk_core/protocol/chibios.mk b/tmk_core/protocol/chibios.mk index 3f4e0a71..6e7cfbd8 100644 --- a/tmk_core/protocol/chibios.mk +++ b/tmk_core/protocol/chibios.mk @@ -4,7 +4,16 @@ CHIBIOS_DIR = $(PROTOCOL_DIR)/chibios SRC += $(CHIBIOS_DIR)/usb_main.c SRC += $(CHIBIOS_DIR)/main.c +SRC += usb_descriptor.c VPATH += $(TMK_PATH)/$(PROTOCOL_DIR) VPATH += $(TMK_PATH)/$(CHIBIOS_DIR) +VPATH += $(TMK_PATH)/$(CHIBIOS_DIR)/lufa_utils + +OPT_DEFS += -DFIXED_CONTROL_ENDPOINT_SIZE=64 +OPT_DEFS += -DFIXED_NUM_CONFIGURATIONS=1 + +ifeq ($(strip $(MIDI_ENABLE)), yes) + include $(TMK_PATH)/protocol/midi.mk +endif diff --git a/tmk_core/protocol/chibios/lufa_utils/LUFA/Drivers/USB/USB.h b/tmk_core/protocol/chibios/lufa_utils/LUFA/Drivers/USB/USB.h new file mode 100644 index 00000000..a5374d82 --- /dev/null +++ b/tmk_core/protocol/chibios/lufa_utils/LUFA/Drivers/USB/USB.h @@ -0,0 +1,42 @@ +#include "progmem.h" +#include "stddef.h" +#include "inttypes.h" + +#define ATTR_PACKED __attribute__ ((packed)) +/** Concatenates the given input into a single token, via the C Preprocessor. + * + * \param[in] x First item to concatenate. + * \param[in] y Second item to concatenate. + * + * \return Concatenated version of the input. + */ +#define CONCAT(x, y) x ## y + +/** CConcatenates the given input into a single token after macro expansion, via the C Preprocessor. + * + * \param[in] x First item to concatenate. + * \param[in] y Second item to concatenate. + * + * \return Concatenated version of the expanded input. + */ +#define CONCAT_EXPANDED(x, y) CONCAT(x, y) +#define CPU_TO_LE16(x) (x) + +// We don't need anything from the following files, or we have defined it already +#define __LUFA_COMMON_H__ +#define __USBMODE_H__ +#define __USBEVENTS_H__ +#define __HIDPARSER_H__ +#define __USBCONTROLLER_AVR8_H__ + +#define __INCLUDE_FROM_USB_DRIVER +#define __INCLUDE_FROM_HID_DRIVER +#define __INCLUDE_FROM_CDC_DRIVER +#define __INCLUDE_FROM_AUDIO_DRIVER +#define __INCLUDE_FROM_MIDI_DRIVER +#include "lib/lufa/LUFA/Drivers/USB/Class/Common/HIDClassCommon.h" +#include "lib/lufa/LUFA/Drivers/USB/Class/Common/HIDReportData.h" +#include "lib/lufa/LUFA/Drivers/USB/Class/Common/CDCClassCommon.h" +#include "lib/lufa/LUFA/Drivers/USB/Class/Common/AudioClassCommon.h" +#include "lib/lufa/LUFA/Drivers/USB/Class/Common/MIDIClassCommon.h" +#include "lib/lufa/LUFA/Drivers/USB/Core/USBController.h" diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index 47a7eb09..f2abc438 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -41,6 +41,9 @@ #ifdef VISUALIZER_ENABLE #include "visualizer/visualizer.h" #endif +#ifdef MIDI_ENABLE +#include "qmk_midi.h" +#endif #include "suspend.h" #include "wait.h" @@ -65,6 +68,17 @@ host_driver_t chibios_driver = { send_consumer }; +#ifdef VIRTSER_ENABLE +void virtser_task(void); +#endif + +#ifdef RAW_HID_ENABLE +void raw_hid_task(void); +#endif + +#ifdef CONSOLE_ENABLE +void console_task(void); +#endif /* TESTING * Amber LED blinker thread, times are in milliseconds. @@ -104,6 +118,10 @@ int main(void) { /* init printf */ init_printf(NULL,sendchar_pf); +#ifdef MIDI_ENABLE + setup_midi(); +#endif + #ifdef SERIAL_LINK_ENABLE init_serial_link(); #endif @@ -182,5 +200,14 @@ int main(void) { } keyboard_task(); +#ifdef CONSOLE_ENABLE + console_task(); +#endif +#ifdef VIRTSER_ENABLE + virtser_task(); +#endif +#ifdef RAW_HID_ENABLE + raw_hid_task(); +#endif } } diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index caa2770b..f980024a 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -28,6 +28,7 @@ #include "led.h" #endif #include "wait.h" +#include "usb_descriptor.h" #ifdef NKRO_ENABLE #include "keycode_config.h" @@ -63,24 +64,12 @@ report_mouse_t mouse_report_blank = {0}; uint8_t extra_report_blank[3] = {0}; #endif /* EXTRAKEY_ENABLE */ -#ifdef CONSOLE_ENABLE -/* The emission buffers queue */ -output_buffers_queue_t console_buf_queue; -static uint8_t console_queue_buffer[BQ_BUFFER_SIZE(CONSOLE_QUEUE_CAPACITY, CONSOLE_EPSIZE)]; - -static virtual_timer_t console_flush_timer; -void console_queue_onotify(io_buffers_queue_t *bqp); -static void console_flush_cb(void *arg); -#endif /* CONSOLE_ENABLE */ - /* --------------------------------------------------------- * Descriptors and USB driver objects * --------------------------------------------------------- */ /* HID specific constants */ -#define USB_DESCRIPTOR_HID 0x21 -#define USB_DESCRIPTOR_HID_REPORT 0x22 #define HID_GET_REPORT 0x01 #define HID_GET_IDLE 0x02 #define HID_GET_PROTOCOL 0x03 @@ -88,593 +77,21 @@ static void console_flush_cb(void *arg); #define HID_SET_IDLE 0x0A #define HID_SET_PROTOCOL 0x0B -/* USB Device Descriptor */ -static const uint8_t usb_device_descriptor_data[] = { - USB_DESC_DEVICE(0x0200, // bcdUSB (1.1) - 0, // bDeviceClass (defined in later in interface) - 0, // bDeviceSubClass - 0, // bDeviceProtocol - 64, // bMaxPacketSize (64 bytes) (the driver didn't work with 32) - VENDOR_ID, // idVendor - PRODUCT_ID, // idProduct - DEVICE_VER, // bcdDevice - 1, // iManufacturer - 2, // iProduct - 3, // iSerialNumber - 1) // bNumConfigurations -}; - -/* Device Descriptor wrapper */ -static const USBDescriptor usb_device_descriptor = { - sizeof usb_device_descriptor_data, - usb_device_descriptor_data -}; - -/* - * HID Report Descriptor - * - * See "Device Class Definition for Human Interface Devices (HID)" - * (http://www.usb.org/developers/hidpage/HID1_11.pdf) for the - * detailed descrition of all the fields - */ - -/* Keyboard Protocol 1, HID 1.11 spec, Appendix B, page 59-60 */ -static const uint8_t keyboard_hid_report_desc_data[] = { - 0x05, 0x01, // Usage Page (Generic Desktop), - 0x09, 0x06, // Usage (Keyboard), - 0xA1, 0x01, // Collection (Application), - 0x75, 0x01, // Report Size (1), - 0x95, 0x08, // Report Count (8), - 0x05, 0x07, // Usage Page (Key Codes), - 0x19, 0xE0, // Usage Minimum (224), - 0x29, 0xE7, // Usage Maximum (231), - 0x15, 0x00, // Logical Minimum (0), - 0x25, 0x01, // Logical Maximum (1), - 0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier byte - 0x95, 0x01, // Report Count (1), - 0x75, 0x08, // Report Size (8), - 0x81, 0x03, // Input (Constant), ;Reserved byte - 0x95, 0x05, // Report Count (5), - 0x75, 0x01, // Report Size (1), - 0x05, 0x08, // Usage Page (LEDs), - 0x19, 0x01, // Usage Minimum (1), - 0x29, 0x05, // Usage Maximum (5), - 0x91, 0x02, // Output (Data, Variable, Absolute), ;LED report - 0x95, 0x01, // Report Count (1), - 0x75, 0x03, // Report Size (3), - 0x91, 0x03, // Output (Constant), ;LED report padding - 0x95, KBD_REPORT_KEYS, // Report Count (), - 0x75, 0x08, // Report Size (8), - 0x15, 0x00, // Logical Minimum (0), - 0x26, 0xFF, 0x00, // Logical Maximum(255), - 0x05, 0x07, // Usage Page (Key Codes), - 0x19, 0x00, // Usage Minimum (0), - 0x29, 0xFF, // Usage Maximum (255), - 0x81, 0x00, // Input (Data, Array), - 0xc0 // End Collection -}; -/* wrapper */ -static const USBDescriptor keyboard_hid_report_descriptor = { - sizeof keyboard_hid_report_desc_data, - keyboard_hid_report_desc_data -}; - -#ifdef NKRO_ENABLE -static const uint8_t nkro_hid_report_desc_data[] = { - 0x05, 0x01, // Usage Page (Generic Desktop), - 0x09, 0x06, // Usage (Keyboard), - 0xA1, 0x01, // Collection (Application), - // bitmap of modifiers - 0x75, 0x01, // Report Size (1), - 0x95, 0x08, // Report Count (8), - 0x05, 0x07, // Usage Page (Key Codes), - 0x19, 0xE0, // Usage Minimum (224), - 0x29, 0xE7, // Usage Maximum (231), - 0x15, 0x00, // Logical Minimum (0), - 0x25, 0x01, // Logical Maximum (1), - 0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier byte - // LED output report - 0x95, 0x05, // Report Count (5), - 0x75, 0x01, // Report Size (1), - 0x05, 0x08, // Usage Page (LEDs), - 0x19, 0x01, // Usage Minimum (1), - 0x29, 0x05, // Usage Maximum (5), - 0x91, 0x02, // Output (Data, Variable, Absolute), - 0x95, 0x01, // Report Count (1), - 0x75, 0x03, // Report Size (3), - 0x91, 0x03, // Output (Constant), - // bitmap of keys - 0x95, NKRO_REPORT_KEYS * 8, // Report Count (), - 0x75, 0x01, // Report Size (1), - 0x15, 0x00, // Logical Minimum (0), - 0x25, 0x01, // Logical Maximum(1), - 0x05, 0x07, // Usage Page (Key Codes), - 0x19, 0x00, // Usage Minimum (0), - 0x29, NKRO_REPORT_KEYS * 8 - 1, // Usage Maximum (), - 0x81, 0x02, // Input (Data, Variable, Absolute), - 0xc0 // End Collection -}; -/* wrapper */ -static const USBDescriptor nkro_hid_report_descriptor = { - sizeof nkro_hid_report_desc_data, - nkro_hid_report_desc_data -}; -#endif /* NKRO_ENABLE */ - -#ifdef MOUSE_ENABLE -/* Mouse Protocol 1, HID 1.11 spec, Appendix B, page 59-60, with wheel extension - * http://www.microchip.com/forums/tm.aspx?high=&m=391435&mpage=1#391521 - * http://www.keil.com/forum/15671/ - * http://www.microsoft.com/whdc/device/input/wheel.mspx */ -static const uint8_t mouse_hid_report_desc_data[] = { - /* mouse */ - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x02, // USAGE (Mouse) - 0xa1, 0x01, // COLLECTION (Application) - //0x85, REPORT_ID_MOUSE, // REPORT_ID (1) - 0x09, 0x01, // USAGE (Pointer) - 0xa1, 0x00, // COLLECTION (Physical) - // ---------------------------- Buttons - 0x05, 0x09, // USAGE_PAGE (Button) - 0x19, 0x01, // USAGE_MINIMUM (Button 1) - 0x29, 0x05, // USAGE_MAXIMUM (Button 5) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x01, // LOGICAL_MAXIMUM (1) - 0x75, 0x01, // REPORT_SIZE (1) - 0x95, 0x05, // REPORT_COUNT (5) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x75, 0x03, // REPORT_SIZE (3) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x03, // INPUT (Cnst,Var,Abs) - // ---------------------------- X,Y position - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x30, // USAGE (X) - 0x09, 0x31, // USAGE (Y) - 0x15, 0x81, // LOGICAL_MINIMUM (-127) - 0x25, 0x7f, // LOGICAL_MAXIMUM (127) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x02, // REPORT_COUNT (2) - 0x81, 0x06, // INPUT (Data,Var,Rel) - // ---------------------------- Vertical wheel - 0x09, 0x38, // USAGE (Wheel) - 0x15, 0x81, // LOGICAL_MINIMUM (-127) - 0x25, 0x7f, // LOGICAL_MAXIMUM (127) - 0x35, 0x00, // PHYSICAL_MINIMUM (0) - reset physical - 0x45, 0x00, // PHYSICAL_MAXIMUM (0) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x06, // INPUT (Data,Var,Rel) - // ---------------------------- Horizontal wheel - 0x05, 0x0c, // USAGE_PAGE (Consumer Devices) - 0x0a, 0x38, 0x02, // USAGE (AC Pan) - 0x15, 0x81, // LOGICAL_MINIMUM (-127) - 0x25, 0x7f, // LOGICAL_MAXIMUM (127) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x06, // INPUT (Data,Var,Rel) - 0xc0, // END_COLLECTION - 0xc0, // END_COLLECTION -}; -/* wrapper */ -static const USBDescriptor mouse_hid_report_descriptor = { - sizeof mouse_hid_report_desc_data, - mouse_hid_report_desc_data -}; -#endif /* MOUSE_ENABLE */ - -#ifdef CONSOLE_ENABLE -static const uint8_t console_hid_report_desc_data[] = { - 0x06, 0x31, 0xFF, // Usage Page 0xFF31 (vendor defined) - 0x09, 0x74, // Usage 0x74 - 0xA1, 0x53, // Collection 0x53 - 0x75, 0x08, // report size = 8 bits - 0x15, 0x00, // logical minimum = 0 - 0x26, 0xFF, 0x00, // logical maximum = 255 - 0x95, CONSOLE_EPSIZE, // report count - 0x09, 0x75, // usage - 0x81, 0x02, // Input (array) - 0xC0 // end collection -}; -/* wrapper */ -static const USBDescriptor console_hid_report_descriptor = { - sizeof console_hid_report_desc_data, - console_hid_report_desc_data -}; -#endif /* CONSOLE_ENABLE */ - -#ifdef EXTRAKEY_ENABLE -/* audio controls & system controls - * http://www.microsoft.com/whdc/archive/w2kbd.mspx */ -static const uint8_t extra_hid_report_desc_data[] = { - /* system control */ - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x80, // USAGE (System Control) - 0xa1, 0x01, // COLLECTION (Application) - 0x85, REPORT_ID_SYSTEM, // REPORT_ID (2) - 0x15, 0x01, // LOGICAL_MINIMUM (0x1) - 0x25, 0xb7, // LOGICAL_MAXIMUM (0xb7) - 0x19, 0x01, // USAGE_MINIMUM (0x1) - 0x29, 0xb7, // USAGE_MAXIMUM (0xb7) - 0x75, 0x10, // REPORT_SIZE (16) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x00, // INPUT (Data,Array,Abs) - 0xc0, // END_COLLECTION - /* consumer */ - 0x05, 0x0c, // USAGE_PAGE (Consumer Devices) - 0x09, 0x01, // USAGE (Consumer Control) - 0xa1, 0x01, // COLLECTION (Application) - 0x85, REPORT_ID_CONSUMER, // REPORT_ID (3) - 0x15, 0x01, // LOGICAL_MINIMUM (0x1) - 0x26, 0x9c, 0x02, // LOGICAL_MAXIMUM (0x29c) - 0x19, 0x01, // USAGE_MINIMUM (0x1) - 0x2a, 0x9c, 0x02, // USAGE_MAXIMUM (0x29c) - 0x75, 0x10, // REPORT_SIZE (16) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x00, // INPUT (Data,Array,Abs) - 0xc0, // END_COLLECTION -}; -/* wrapper */ -static const USBDescriptor extra_hid_report_descriptor = { - sizeof extra_hid_report_desc_data, - extra_hid_report_desc_data -}; -#endif /* EXTRAKEY_ENABLE */ - - -/* - * Configuration Descriptor tree for a HID device - * - * The HID Specifications version 1.11 require the following order: - * - Configuration Descriptor - * - Interface Descriptor - * - HID Descriptor - * - Endpoints Descriptors - */ -#define KBD_HID_DESC_NUM 0 -#define KBD_HID_DESC_OFFSET (9 + (9 + 9 + 7) * KBD_HID_DESC_NUM + 9) - -#ifdef MOUSE_ENABLE -# define MOUSE_HID_DESC_NUM (KBD_HID_DESC_NUM + 1) -# define MOUSE_HID_DESC_OFFSET (9 + (9 + 9 + 7) * MOUSE_HID_DESC_NUM + 9) -#else /* MOUSE_ENABLE */ -# define MOUSE_HID_DESC_NUM (KBD_HID_DESC_NUM + 0) -#endif /* MOUSE_ENABLE */ - -#ifdef CONSOLE_ENABLE -#define CONSOLE_HID_DESC_NUM (MOUSE_HID_DESC_NUM + 1) -#define CONSOLE_HID_DESC_OFFSET (9 + (9 + 9 + 7) * CONSOLE_HID_DESC_NUM + 9) -#else /* CONSOLE_ENABLE */ -# define CONSOLE_HID_DESC_NUM (MOUSE_HID_DESC_NUM + 0) -#endif /* CONSOLE_ENABLE */ - -#ifdef EXTRAKEY_ENABLE -# define EXTRA_HID_DESC_NUM (CONSOLE_HID_DESC_NUM + 1) -# define EXTRA_HID_DESC_OFFSET (9 + (9 + 9 + 7) * EXTRA_HID_DESC_NUM + 9) -#else /* EXTRAKEY_ENABLE */ -# define EXTRA_HID_DESC_NUM (CONSOLE_HID_DESC_NUM + 0) -#endif /* EXTRAKEY_ENABLE */ - -#ifdef NKRO_ENABLE -# define NKRO_HID_DESC_NUM (EXTRA_HID_DESC_NUM + 1) -# define NKRO_HID_DESC_OFFSET (9 + (9 + 9 + 7) * EXTRA_HID_DESC_NUM + 9) -#else /* NKRO_ENABLE */ -# define NKRO_HID_DESC_NUM (EXTRA_HID_DESC_NUM + 0) -#endif /* NKRO_ENABLE */ - -#define NUM_INTERFACES (NKRO_HID_DESC_NUM + 1) -#define CONFIG1_DESC_SIZE (9 + (9 + 9 + 7) * NUM_INTERFACES) - -static const uint8_t hid_configuration_descriptor_data[] = { - /* Configuration Descriptor (9 bytes) USB spec 9.6.3, page 264-266, Table 9-10 */ - USB_DESC_CONFIGURATION(CONFIG1_DESC_SIZE, // wTotalLength - NUM_INTERFACES, // bNumInterfaces - 1, // bConfigurationValue - 0, // iConfiguration - 0xA0, // bmAttributes (RESERVED|REMOTEWAKEUP) - 50), // bMaxPower (50mA) - - /* Interface Descriptor (9 bytes) USB spec 9.6.5, page 267-269, Table 9-12 */ - USB_DESC_INTERFACE(KBD_INTERFACE, // bInterfaceNumber - 0, // bAlternateSetting - 1, // bNumEndpoints - 0x03, // bInterfaceClass: HID - 0x01, // bInterfaceSubClass: Boot - 0x01, // bInterfaceProtocol: Keyboard - 0), // iInterface - - /* HID descriptor (9 bytes) HID 1.11 spec, section 6.2.1 */ - USB_DESC_BYTE(9), // bLength - USB_DESC_BYTE(0x21), // bDescriptorType (HID class) - USB_DESC_BCD(0x0111), // bcdHID: HID version 1.11 - USB_DESC_BYTE(0), // bCountryCode - USB_DESC_BYTE(1), // bNumDescriptors - USB_DESC_BYTE(0x22), // bDescriptorType (report desc) - USB_DESC_WORD(sizeof(keyboard_hid_report_desc_data)), // wDescriptorLength - - /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ - USB_DESC_ENDPOINT(KBD_ENDPOINT | 0x80, // bEndpointAddress - 0x03, // bmAttributes (Interrupt) - KBD_EPSIZE,// wMaxPacketSize - 10), // bInterval - - #ifdef MOUSE_ENABLE - /* Interface Descriptor (9 bytes) USB spec 9.6.5, page 267-269, Table 9-12 */ - USB_DESC_INTERFACE(MOUSE_INTERFACE, // bInterfaceNumber - 0, // bAlternateSetting - 1, // bNumEndpoints - 0x03, // bInterfaceClass (0x03 = HID) - // ThinkPad T23 BIOS doesn't work with boot mouse. - 0x00, // bInterfaceSubClass (0x01 = Boot) - 0x00, // bInterfaceProtocol (0x02 = Mouse) - /* - 0x01, // bInterfaceSubClass (0x01 = Boot) - 0x02, // bInterfaceProtocol (0x02 = Mouse) - */ - 0), // iInterface - - /* HID descriptor (9 bytes) HID 1.11 spec, section 6.2.1 */ - USB_DESC_BYTE(9), // bLength - USB_DESC_BYTE(0x21), // bDescriptorType (HID class) - USB_DESC_BCD(0x0111), // bcdHID: HID version 1.11 - USB_DESC_BYTE(0), // bCountryCode - USB_DESC_BYTE(1), // bNumDescriptors - USB_DESC_BYTE(0x22), // bDescriptorType (report desc) - USB_DESC_WORD(sizeof(mouse_hid_report_desc_data)), // wDescriptorLength - - /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ - USB_DESC_ENDPOINT(MOUSE_ENDPOINT | 0x80, // bEndpointAddress - 0x03, // bmAttributes (Interrupt) - MOUSE_EPSIZE, // wMaxPacketSize - 1), // bInterval - #endif /* MOUSE_ENABLE */ - - #ifdef CONSOLE_ENABLE - /* Interface Descriptor (9 bytes) USB spec 9.6.5, page 267-269, Table 9-12 */ - USB_DESC_INTERFACE(CONSOLE_INTERFACE, // bInterfaceNumber - 0, // bAlternateSetting - 1, // bNumEndpoints - 0x03, // bInterfaceClass: HID - 0x00, // bInterfaceSubClass: None - 0x00, // bInterfaceProtocol: None - 0), // iInterface - - /* HID descriptor (9 bytes) HID 1.11 spec, section 6.2.1 */ - USB_DESC_BYTE(9), // bLength - USB_DESC_BYTE(0x21), // bDescriptorType (HID class) - USB_DESC_BCD(0x0111), // bcdHID: HID version 1.11 - USB_DESC_BYTE(0), // bCountryCode - USB_DESC_BYTE(1), // bNumDescriptors - USB_DESC_BYTE(0x22), // bDescriptorType (report desc) - USB_DESC_WORD(sizeof(console_hid_report_desc_data)), // wDescriptorLength - - /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ - USB_DESC_ENDPOINT(CONSOLE_ENDPOINT | 0x80, // bEndpointAddress - 0x03, // bmAttributes (Interrupt) - CONSOLE_EPSIZE, // wMaxPacketSize - 1), // bInterval - #endif /* CONSOLE_ENABLE */ - - #ifdef EXTRAKEY_ENABLE - /* Interface Descriptor (9 bytes) USB spec 9.6.5, page 267-269, Table 9-12 */ - USB_DESC_INTERFACE(EXTRA_INTERFACE, // bInterfaceNumber - 0, // bAlternateSetting - 1, // bNumEndpoints - 0x03, // bInterfaceClass: HID - 0x00, // bInterfaceSubClass: None - 0x00, // bInterfaceProtocol: None - 0), // iInterface - - /* HID descriptor (9 bytes) HID 1.11 spec, section 6.2.1 */ - USB_DESC_BYTE(9), // bLength - USB_DESC_BYTE(0x21), // bDescriptorType (HID class) - USB_DESC_BCD(0x0111), // bcdHID: HID version 1.11 - USB_DESC_BYTE(0), // bCountryCode - USB_DESC_BYTE(1), // bNumDescriptors - USB_DESC_BYTE(0x22), // bDescriptorType (report desc) - USB_DESC_WORD(sizeof(extra_hid_report_desc_data)), // wDescriptorLength - - /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ - USB_DESC_ENDPOINT(EXTRA_ENDPOINT | 0x80, // bEndpointAddress - 0x03, // bmAttributes (Interrupt) - EXTRA_EPSIZE, // wMaxPacketSize - 10), // bInterval - #endif /* EXTRAKEY_ENABLE */ - - #ifdef NKRO_ENABLE - /* Interface Descriptor (9 bytes) USB spec 9.6.5, page 267-269, Table 9-12 */ - USB_DESC_INTERFACE(NKRO_INTERFACE, // bInterfaceNumber - 0, // bAlternateSetting - 1, // bNumEndpoints - 0x03, // bInterfaceClass: HID - 0x00, // bInterfaceSubClass: None - 0x00, // bInterfaceProtocol: None - 0), // iInterface - - /* HID descriptor (9 bytes) HID 1.11 spec, section 6.2.1 */ - USB_DESC_BYTE(9), // bLength - USB_DESC_BYTE(0x21), // bDescriptorType (HID class) - USB_DESC_BCD(0x0111), // bcdHID: HID version 1.11 - USB_DESC_BYTE(0), // bCountryCode - USB_DESC_BYTE(1), // bNumDescriptors - USB_DESC_BYTE(0x22), // bDescriptorType (report desc) - USB_DESC_WORD(sizeof(nkro_hid_report_desc_data)), // wDescriptorLength - - /* Endpoint Descriptor (7 bytes) USB spec 9.6.6, page 269-271, Table 9-13 */ - USB_DESC_ENDPOINT(NKRO_ENDPOINT | 0x80, // bEndpointAddress - 0x03, // bmAttributes (Interrupt) - NKRO_EPSIZE, // wMaxPacketSize - 1), // bInterval - #endif /* NKRO_ENABLE */ -}; - -/* Configuration Descriptor wrapper */ -static const USBDescriptor hid_configuration_descriptor = { - sizeof hid_configuration_descriptor_data, - hid_configuration_descriptor_data -}; - -/* wrappers */ -#define HID_DESCRIPTOR_SIZE 9 -static const USBDescriptor keyboard_hid_descriptor = { - HID_DESCRIPTOR_SIZE, - &hid_configuration_descriptor_data[KBD_HID_DESC_OFFSET] -}; -#ifdef MOUSE_ENABLE -static const USBDescriptor mouse_hid_descriptor = { - HID_DESCRIPTOR_SIZE, - &hid_configuration_descriptor_data[MOUSE_HID_DESC_OFFSET] -}; -#endif /* MOUSE_ENABLE */ -#ifdef CONSOLE_ENABLE -static const USBDescriptor console_hid_descriptor = { - HID_DESCRIPTOR_SIZE, - &hid_configuration_descriptor_data[CONSOLE_HID_DESC_OFFSET] -}; -#endif /* CONSOLE_ENABLE */ -#ifdef EXTRAKEY_ENABLE -static const USBDescriptor extra_hid_descriptor = { - HID_DESCRIPTOR_SIZE, - &hid_configuration_descriptor_data[EXTRA_HID_DESC_OFFSET] -}; -#endif /* EXTRAKEY_ENABLE */ -#ifdef NKRO_ENABLE -static const USBDescriptor nkro_hid_descriptor = { - HID_DESCRIPTOR_SIZE, - &hid_configuration_descriptor_data[NKRO_HID_DESC_OFFSET] -}; -#endif /* NKRO_ENABLE */ - - -/* U.S. English language identifier */ -static const uint8_t usb_string_langid[] = { - USB_DESC_BYTE(4), // bLength - USB_DESC_BYTE(USB_DESCRIPTOR_STRING), // bDescriptorType - USB_DESC_WORD(0x0409) // wLANGID (U.S. English) -}; - -/* ugly ugly hack */ -#define PP_NARG(...) \ - PP_NARG_(__VA_ARGS__,PP_RSEQ_N()) -#define PP_NARG_(...) \ - PP_ARG_N(__VA_ARGS__) -#define PP_ARG_N( \ - _1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \ - _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \ - _21,_22,_23,_24,_25,_26,_27,_28,_29,_30, \ - _31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \ - _41,_42,_43,_44,_45,_46,_47,_48,_49,_50, \ - _51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \ - _61,_62,_63,N,...) N -#define PP_RSEQ_N() \ - 63,62,61,60, \ - 59,58,57,56,55,54,53,52,51,50, \ - 49,48,47,46,45,44,43,42,41,40, \ - 39,38,37,36,35,34,33,32,31,30, \ - 29,28,27,26,25,24,23,22,21,20, \ - 19,18,17,16,15,14,13,12,11,10, \ - 9,8,7,6,5,4,3,2,1,0 - -/* Vendor string = manufacturer */ -static const uint8_t usb_string_vendor[] = { - USB_DESC_BYTE(PP_NARG(USBSTR_MANUFACTURER)+2), // bLength - USB_DESC_BYTE(USB_DESCRIPTOR_STRING), // bDescriptorType - USBSTR_MANUFACTURER -}; - -/* Device Description string = product */ -static const uint8_t usb_string_description[] = { - USB_DESC_BYTE(PP_NARG(USBSTR_PRODUCT)+2), // bLength - USB_DESC_BYTE(USB_DESCRIPTOR_STRING), // bDescriptorType - USBSTR_PRODUCT -}; - -/* Serial Number string (will be filled by the function init_usb_serial_string) */ -static uint8_t usb_string_serial[] = { - USB_DESC_BYTE(22), // bLength - USB_DESC_BYTE(USB_DESCRIPTOR_STRING), // bDescriptorType - '0', 0, 'x', 0, 'D', 0, 'E', 0, 'A', 0, 'D', 0, 'B', 0, 'E', 0, 'E', 0, 'F', 0 -}; - -/* Strings wrappers array */ -static const USBDescriptor usb_strings[] = { - { sizeof usb_string_langid, usb_string_langid } - , - { sizeof usb_string_vendor, usb_string_vendor } - , - { sizeof usb_string_description, usb_string_description } - , - { sizeof usb_string_serial, usb_string_serial } -}; - /* * Handles the GET_DESCRIPTOR callback * * Returns the proper descriptor */ -static const USBDescriptor *usb_get_descriptor_cb(USBDriver *usbp, uint8_t dtype, uint8_t dindex, uint16_t lang) { +static const USBDescriptor *usb_get_descriptor_cb(USBDriver *usbp, uint8_t dtype, uint8_t dindex, uint16_t wIndex) { (void)usbp; - (void)lang; - switch(dtype) { - /* Generic descriptors */ - case USB_DESCRIPTOR_DEVICE: /* Device Descriptor */ - return &usb_device_descriptor; - - case USB_DESCRIPTOR_CONFIGURATION: /* Configuration Descriptor */ - return &hid_configuration_descriptor; - - case USB_DESCRIPTOR_STRING: /* Strings */ - if(dindex < 4) - return &usb_strings[dindex]; - break; - - /* HID specific descriptors */ - case USB_DESCRIPTOR_HID: /* HID Descriptors */ - switch(lang) { /* yea, poor label, it's actually wIndex from the setup packet */ - case KBD_INTERFACE: - return &keyboard_hid_descriptor; - -#ifdef MOUSE_ENABLE - case MOUSE_INTERFACE: - return &mouse_hid_descriptor; -#endif /* MOUSE_ENABLE */ -#ifdef CONSOLE_ENABLE - case CONSOLE_INTERFACE: - return &console_hid_descriptor; -#endif /* CONSOLE_ENABLE */ -#ifdef EXTRAKEY_ENABLE - case EXTRA_INTERFACE: - return &extra_hid_descriptor; -#endif /* EXTRAKEY_ENABLE */ -#ifdef NKRO_ENABLE - case NKRO_INTERFACE: - return &nkro_hid_descriptor; -#endif /* NKRO_ENABLE */ - } - - case USB_DESCRIPTOR_HID_REPORT: /* HID Report Descriptor */ - switch(lang) { - case KBD_INTERFACE: - return &keyboard_hid_report_descriptor; - -#ifdef MOUSE_ENABLE - case MOUSE_INTERFACE: - return &mouse_hid_report_descriptor; -#endif /* MOUSE_ENABLE */ -#ifdef CONSOLE_ENABLE - case CONSOLE_INTERFACE: - return &console_hid_report_descriptor; -#endif /* CONSOLE_ENABLE */ -#ifdef EXTRAKEY_ENABLE - case EXTRA_INTERFACE: - return &extra_hid_report_descriptor; -#endif /* EXTRAKEY_ENABLE */ -#ifdef NKRO_ENABLE - case NKRO_INTERFACE: - return &nkro_hid_report_descriptor; -#endif /* NKRO_ENABLE */ - } - } - return NULL; + static USBDescriptor desc; + uint16_t wValue = ((uint16_t)dtype << 8) | dindex; + desc.ud_string = NULL; + desc.ud_size = get_usb_descriptor(wValue, wIndex, (const void** const)&desc.ud_string); + if (desc.ud_string == NULL) + return NULL; + else + return &desc; } /* keyboard endpoint state structure */ @@ -685,7 +102,7 @@ static const USBEndpointConfig kbd_ep_config = { NULL, /* SETUP packet notification callback */ kbd_in_cb, /* IN notification callback */ NULL, /* OUT notification callback */ - KBD_EPSIZE, /* IN maximum packet size */ + KEYBOARD_EPSIZE, /* IN maximum packet size */ 0, /* OUT maximum packet size */ &kbd_ep_state, /* IN Endpoint state */ NULL, /* OUT endpoint state */ @@ -712,25 +129,6 @@ static const USBEndpointConfig mouse_ep_config = { }; #endif /* MOUSE_ENABLE */ -#ifdef CONSOLE_ENABLE -/* console endpoint state structure */ -static USBInEndpointState console_ep_state; - -/* console endpoint initialization structure (IN) */ -static const USBEndpointConfig console_ep_config = { - USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ - NULL, /* SETUP packet notification callback */ - console_in_cb, /* IN notification callback */ - NULL, /* OUT notification callback */ - CONSOLE_EPSIZE, /* IN maximum packet size */ - 0, /* OUT maximum packet size */ - &console_ep_state, /* IN Endpoint state */ - NULL, /* OUT endpoint state */ - 2, /* IN multiplier */ - NULL /* SETUP buffer (not a SETUP endpoint) */ -}; -#endif /* CONSOLE_ENABLE */ - #ifdef EXTRAKEY_ENABLE /* extrakey endpoint state structure */ static USBInEndpointState extra_ep_state; @@ -741,7 +139,7 @@ static const USBEndpointConfig extra_ep_config = { NULL, /* SETUP packet notification callback */ extra_in_cb, /* IN notification callback */ NULL, /* OUT notification callback */ - EXTRA_EPSIZE, /* IN maximum packet size */ + EXTRAKEY_EPSIZE, /* IN maximum packet size */ 0, /* OUT maximum packet size */ &extra_ep_state, /* IN Endpoint state */ NULL, /* OUT endpoint state */ @@ -769,6 +167,129 @@ static const USBEndpointConfig nkro_ep_config = { }; #endif /* NKRO_ENABLE */ +typedef struct { + size_t queue_capacity_in; + size_t queue_capacity_out; + uint8_t* queue_buffer_in; + uint8_t* queue_buffer_out; + USBInEndpointState in_ep_state; + USBOutEndpointState out_ep_state; + USBInEndpointState int_ep_state; + USBEndpointConfig in_ep_config; + USBEndpointConfig out_ep_config; + USBEndpointConfig int_ep_config; + const SerialUSBConfig config; + SerialUSBDriver driver; +} stream_driver_t; + +#define STREAM_DRIVER(stream, notification) { \ + .queue_capacity_in = stream##_IN_CAPACITY, \ + .queue_capacity_out = stream##_OUT_CAPACITY, \ + .queue_buffer_in = (uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]) {}, \ + .queue_buffer_out = (uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY,stream##_EPSIZE)]) {}, \ + .in_ep_config = { \ + .ep_mode = stream##_IN_MODE, \ + .setup_cb = NULL, \ + .in_cb = sduDataTransmitted, \ + .out_cb = NULL, \ + .in_maxsize = stream##_EPSIZE, \ + .out_maxsize = 0, \ + /* The pointer to the states will be filled during initialization */ \ + .in_state = NULL, \ + .out_state = NULL, \ + .ep_buffers = 2, \ + .setup_buf = NULL \ + }, \ + .out_ep_config = { \ + .ep_mode = stream##_OUT_MODE, \ + .setup_cb = NULL, \ + .in_cb = NULL, \ + .out_cb = sduDataReceived, \ + .in_maxsize = 0, \ + .out_maxsize = stream##_EPSIZE, \ + /* The pointer to the states will be filled during initialization */ \ + .in_state = NULL, \ + .out_state = NULL, \ + .ep_buffers = 2, \ + .setup_buf = NULL, \ + }, \ + .int_ep_config = { \ + .ep_mode = USB_EP_MODE_TYPE_INTR, \ + .setup_cb = NULL, \ + .in_cb = sduInterruptTransmitted, \ + .out_cb = NULL, \ + .in_maxsize = CDC_NOTIFICATION_EPSIZE, \ + .out_maxsize = 0, \ + /* The pointer to the states will be filled during initialization */ \ + .in_state = NULL, \ + .out_state = NULL, \ + .ep_buffers = 2, \ + .setup_buf = NULL, \ + }, \ + .config = { \ + .usbp = &USB_DRIVER, \ + .bulk_in = stream##_IN_EPNUM, \ + .bulk_out = stream##_OUT_EPNUM, \ + .int_in = notification \ + } \ +} + +typedef struct { + union { + struct { +#ifdef CONSOLE_ENABLE + stream_driver_t console_driver; +#endif +#ifdef RAW_ENABLE + stream_driver_t raw_driver; +#endif +#ifdef MIDI_ENABLE + stream_driver_t midi_driver; +#endif +#ifdef VIRTSER_ENABLE + stream_driver_t serial_driver; +#endif + }; + stream_driver_t array[0]; + }; +} stream_drivers_t; + +static stream_drivers_t drivers = { +#ifdef CONSOLE_ENABLE + #define CONSOLE_IN_CAPACITY 4 + #define CONSOLE_OUT_CAPACITY 4 + #define CONSOLE_IN_MODE USB_EP_MODE_TYPE_INTR + #define CONSOLE_OUT_MODE USB_EP_MODE_TYPE_INTR + .console_driver = STREAM_DRIVER(CONSOLE, 0), +#endif +#ifdef RAW_ENABLE + #define RAW_IN_CAPACITY 4 + #define RAW_OUT_CAPACITY 4 + #define RAW_IN_MODE USB_EP_MODE_TYPE_INTR + #define RAW_OUT_MODE USB_EP_MODE_TYPE_INTR + .raw_driver = STREAM_DRIVER(RAW, 0), +#endif + +#ifdef MIDI_ENABLE + #define MIDI_STREAM_IN_CAPACITY 4 + #define MIDI_STREAM_OUT_CAPACITY 4 + #define MIDI_STREAM_IN_MODE USB_EP_MODE_TYPE_BULK + #define MIDI_STREAM_OUT_MODE USB_EP_MODE_TYPE_BULK + .midi_driver = STREAM_DRIVER(MIDI_STREAM, 0), +#endif + +#ifdef VIRTSER_ENABLE + #define CDC_IN_CAPACITY 4 + #define CDC_OUT_CAPACITY 4 + #define CDC_IN_MODE USB_EP_MODE_TYPE_BULK + #define CDC_OUT_MODE USB_EP_MODE_TYPE_BULK + .serial_driver = STREAM_DRIVER(CDC, CDC_NOTIFICATION_EPNUM), +#endif +}; + +#define NUM_STREAM_DRIVERS (sizeof(drivers) / sizeof(stream_driver_t)) + + /* --------------------------------------------------------- * USB driver functions * --------------------------------------------------------- @@ -784,24 +305,27 @@ static void usb_event_cb(USBDriver *usbp, usbevent_t event) { case USB_EVENT_CONFIGURED: osalSysLockFromISR(); /* Enable the endpoints specified into the configuration. */ - usbInitEndpointI(usbp, KBD_ENDPOINT, &kbd_ep_config); + usbInitEndpointI(usbp, KEYBOARD_IN_EPNUM, &kbd_ep_config); #ifdef MOUSE_ENABLE - usbInitEndpointI(usbp, MOUSE_ENDPOINT, &mouse_ep_config); + usbInitEndpointI(usbp, MOUSE_IN_EPNUM, &mouse_ep_config); #endif /* MOUSE_ENABLE */ -#ifdef CONSOLE_ENABLE - usbInitEndpointI(usbp, CONSOLE_ENDPOINT, &console_ep_config); - /* don't need to start the flush timer, it starts from console_in_cb automatically */ -#endif /* CONSOLE_ENABLE */ #ifdef EXTRAKEY_ENABLE - usbInitEndpointI(usbp, EXTRA_ENDPOINT, &extra_ep_config); + usbInitEndpointI(usbp, EXTRAKEY_IN_EPNUM, &extra_ep_config); #endif /* EXTRAKEY_ENABLE */ #ifdef NKRO_ENABLE - usbInitEndpointI(usbp, NKRO_ENDPOINT, &nkro_ep_config); + usbInitEndpointI(usbp, NKRO_IN_EPNUM, &nkro_ep_config); #endif /* NKRO_ENABLE */ + for (int i=0;isetup[1]) { /* bRequest */ case HID_GET_REPORT: switch(usbp->setup[4]) { /* LSB(wIndex) (check MSB==0?) */ - case KBD_INTERFACE: + case KEYBOARD_INTERFACE: #ifdef NKRO_ENABLE case NKRO_INTERFACE: #endif /* NKRO_ENABLE */ @@ -883,15 +419,8 @@ static bool usb_request_hook_cb(USBDriver *usbp) { break; #endif /* MOUSE_ENABLE */ -#ifdef CONSOLE_ENABLE - case CONSOLE_INTERFACE: - usbSetupTransfer(usbp, console_queue_buffer, CONSOLE_EPSIZE, NULL); - return TRUE; - break; -#endif /* CONSOLE_ENABLE */ - #ifdef EXTRAKEY_ENABLE - case EXTRA_INTERFACE: + case EXTRAKEY_INTERFACE: if(usbp->setup[3] == 1) { /* MSB(wValue) [Report Type] == 1 [Input Report] */ switch(usbp->setup[2]) { /* LSB(wValue) [Report ID] */ case REPORT_ID_SYSTEM: @@ -921,7 +450,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) { break; case HID_GET_PROTOCOL: - if((usbp->setup[4] == KBD_INTERFACE) && (usbp->setup[5] == 0)) { /* wIndex */ + if((usbp->setup[4] == KEYBOARD_INTERFACE) && (usbp->setup[5] == 0)) { /* wIndex */ usbSetupTransfer(usbp, &keyboard_protocol, 1, NULL); return TRUE; } @@ -938,7 +467,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) { switch(usbp->setup[1]) { /* bRequest */ case HID_SET_REPORT: switch(usbp->setup[4]) { /* LSB(wIndex) (check MSB==0 and wLength==1?) */ - case KBD_INTERFACE: + case KEYBOARD_INTERFACE: #ifdef NKRO_ENABLE case NKRO_INTERFACE: #endif /* NKRO_ENABLE */ @@ -951,7 +480,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) { break; case HID_SET_PROTOCOL: - if((usbp->setup[4] == KBD_INTERFACE) && (usbp->setup[5] == 0)) { /* wIndex */ + if((usbp->setup[4] == KEYBOARD_INTERFACE) && (usbp->setup[5] == 0)) { /* wIndex */ keyboard_protocol = ((usbp->setup[2]) != 0x00); /* LSB(wValue) */ #ifdef NKRO_ENABLE keymap_config.nkro = !!keyboard_protocol; @@ -998,12 +527,24 @@ static bool usb_request_hook_cb(USBDriver *usbp) { return TRUE; } + for (int i=0;iibqueue.notify; + ibqObjectInit(&driver->ibqueue, false, drivers.array[i].queue_buffer_in, drivers.array[i].in_ep_config.in_maxsize, drivers.array[i].queue_capacity_in, notify, driver); + notify = driver->obqueue.notify; + ibqObjectInit(&driver->ibqueue, false, drivers.array[i].queue_buffer_out, drivers.array[i].out_ep_config.out_maxsize, drivers.array[i].queue_capacity_out, notify, driver); + sduStart(driver, &drivers.array[i].config); + } + /* * Activates the USB driver and then the USB bus pull-up on D+. * Note, a delay is inserted in order to not have to disconnect the cable @@ -1030,17 +584,12 @@ void init_usb_driver(USBDriver *usbp) { usbConnectBus(usbp); chVTObjectInit(&keyboard_idle_timer); -#ifdef CONSOLE_ENABLE - obqObjectInit(&console_buf_queue, false, console_queue_buffer, CONSOLE_EPSIZE, CONSOLE_QUEUE_CAPACITY, console_queue_onotify, (void*)usbp); - chVTObjectInit(&console_flush_timer); -#endif } /* --------------------------------------------------------- * Keyboard functions * --------------------------------------------------------- */ - /* keyboard IN callback hander (a kbd report has made it IN) */ void kbd_in_cb(USBDriver *usbp, usbep_t ep) { /* STUB */ @@ -1084,8 +633,8 @@ static void keyboard_idle_timer_cb(void *arg) { if(keyboard_idle) { #endif /* NKRO_ENABLE */ /* TODO: are we sure we want the KBD_ENDPOINT? */ - if(!usbGetTransmitStatusI(usbp, KBD_ENDPOINT)) { - usbStartTransmitI(usbp, KBD_ENDPOINT, (uint8_t *)&keyboard_report_sent, KBD_EPSIZE); + if(!usbGetTransmitStatusI(usbp, KEYBOARD_IN_EPNUM)) { + usbStartTransmitI(usbp, KEYBOARD_IN_EPNUM, (uint8_t *)&keyboard_report_sent, KEYBOARD_EPSIZE); } /* rearm the timer */ chVTSetI(&keyboard_idle_timer, 4*MS2ST(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp); @@ -1119,14 +668,14 @@ void send_keyboard(report_keyboard_t *report) { * this is more efficient */ /* busy wait, should be short and not very common */ osalSysLock(); - if(usbGetTransmitStatusI(&USB_DRIVER, NKRO_ENDPOINT)) { + if(usbGetTransmitStatusI(&USB_DRIVER, NKRO_IN_EPNUM)) { /* Need to either suspend, or loop and call unlock/lock during * every iteration - otherwise the system will remain locked, * no interrupts served, so USB not going through as well. * Note: for suspend, need USB_USE_WAIT == TRUE in halconf.h */ - osalThreadSuspendS(&(&USB_DRIVER)->epc[NKRO_ENDPOINT]->in_state->thread); + osalThreadSuspendS(&(&USB_DRIVER)->epc[NKRO_IN_EPNUM]->in_state->thread); } - usbStartTransmitI(&USB_DRIVER, NKRO_ENDPOINT, (uint8_t *)report, sizeof(report_keyboard_t)); + usbStartTransmitI(&USB_DRIVER, NKRO_IN_EPNUM, (uint8_t *)report, sizeof(report_keyboard_t)); osalSysUnlock(); } else #endif /* NKRO_ENABLE */ @@ -1134,14 +683,14 @@ void send_keyboard(report_keyboard_t *report) { /* need to wait until the previous packet has made it through */ /* busy wait, should be short and not very common */ osalSysLock(); - if(usbGetTransmitStatusI(&USB_DRIVER, KBD_ENDPOINT)) { + if(usbGetTransmitStatusI(&USB_DRIVER, KEYBOARD_IN_EPNUM)) { /* Need to either suspend, or loop and call unlock/lock during * every iteration - otherwise the system will remain locked, * no interrupts served, so USB not going through as well. * Note: for suspend, need USB_USE_WAIT == TRUE in halconf.h */ - osalThreadSuspendS(&(&USB_DRIVER)->epc[KBD_ENDPOINT]->in_state->thread); + osalThreadSuspendS(&(&USB_DRIVER)->epc[KEYBOARD_IN_EPNUM]->in_state->thread); } - usbStartTransmitI(&USB_DRIVER, KBD_ENDPOINT, (uint8_t *)report, KBD_EPSIZE); + usbStartTransmitI(&USB_DRIVER, KEYBOARD_IN_EPNUM, (uint8_t *)report, KEYBOARD_EPSIZE); osalSysUnlock(); } keyboard_report_sent = *report; @@ -1174,7 +723,7 @@ void send_mouse(report_mouse_t *report) { */ osalSysLock(); - usbStartTransmitI(&USB_DRIVER, MOUSE_ENDPOINT, (uint8_t *)report, sizeof(report_mouse_t)); + usbStartTransmitI(&USB_DRIVER, MOUSE_IN_EPNUM, (uint8_t *)report, sizeof(report_mouse_t)); osalSysUnlock(); } @@ -1210,7 +759,7 @@ static void send_extra_report(uint8_t report_id, uint16_t data) { .usage = data }; - usbStartTransmitI(&USB_DRIVER, EXTRA_ENDPOINT, (uint8_t *)&report, sizeof(report_extra_t)); + usbStartTransmitI(&USB_DRIVER, EXTRAKEY_IN_EPNUM, (uint8_t *)&report, sizeof(report_extra_t)); osalSysUnlock(); } @@ -1238,125 +787,107 @@ void send_consumer(uint16_t data) { #ifdef CONSOLE_ENABLE -/* console IN callback hander */ -void console_in_cb(USBDriver *usbp, usbep_t ep) { - (void)ep; /* should have ep == CONSOLE_ENDPOINT, so use that to save time/space */ - uint8_t *buf; - size_t n; +int8_t sendchar(uint8_t c) { + // The previous implmentation had timeouts, but I think it's better to just slow down + // and make sure that everything is transferred, rather than dropping stuff + return chnWrite(&drivers.console_driver.driver, &c, 1); +} - osalSysLockFromISR(); +// Just a dummy function for now, this could be exposed as a weak function +// Or connected to the actual QMK console +static void console_receive( uint8_t *data, uint8_t length ) { + (void)data; + (void)length; +} - /* rearm the timer */ - chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp); +void console_task(void) { + uint8_t buffer[CONSOLE_EPSIZE]; + size_t size = 0; + do { + size_t size = chnReadTimeout(&drivers.console_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE); + if (size > 0) { + console_receive(buffer, size); + } + } while(size > 0); +} - /* Freeing the buffer just transmitted, if it was not a zero size packet.*/ - if (usbp->epc[CONSOLE_ENDPOINT]->in_state->txsize > 0U) { - obqReleaseEmptyBufferI(&console_buf_queue); - } +#else /* CONSOLE_ENABLE */ +int8_t sendchar(uint8_t c) { + (void)c; + return 0; +} +#endif /* CONSOLE_ENABLE */ - /* Checking if there is a buffer ready for transmission.*/ - buf = obqGetFullBufferI(&console_buf_queue, &n); +void sendchar_pf(void *p, char c) { + (void)p; + sendchar((uint8_t)c); +} - if (buf != NULL) { - /* The endpoint cannot be busy, we are in the context of the callback, - so it is safe to transmit without a check.*/ - /* Should have n == CONSOLE_EPSIZE; check it? */ - usbStartTransmitI(usbp, CONSOLE_ENDPOINT, buf, CONSOLE_EPSIZE); - } else { - /* Nothing to transmit.*/ - } +#ifdef RAW_ENABLE +void raw_hid_send( uint8_t *data, uint8_t length ) { + // TODO: implement variable size packet + if ( length != RAW_EPSIZE ) + { + return; - osalSysUnlockFromISR(); + } + chnWrite(&drivers.raw_driver.driver, data, length); } -/* Callback when data is inserted into the output queue - * Called from a locked state */ -void console_queue_onotify(io_buffers_queue_t *bqp) { - size_t n; - USBDriver *usbp = bqGetLinkX(bqp); - - if(usbGetDriverStateI(usbp) != USB_ACTIVE) - return; +__attribute__ ((weak)) +void raw_hid_receive( uint8_t *data, uint8_t length ) { + // Users should #include "raw_hid.h" in their own code + // and implement this function there. Leave this as weak linkage + // so users can opt to not handle data coming in. +} - /* Checking if there is already a transaction ongoing on the endpoint.*/ - if (!usbGetTransmitStatusI(usbp, CONSOLE_ENDPOINT)) { - /* Trying to get a full buffer.*/ - uint8_t *buf = obqGetFullBufferI(&console_buf_queue, &n); - if (buf != NULL) { - /* Buffer found, starting a new transaction.*/ - /* Should have n == CONSOLE_EPSIZE; check this? */ - usbStartTransmitI(usbp, CONSOLE_ENDPOINT, buf, CONSOLE_EPSIZE); +void raw_hid_task(void) { + uint8_t buffer[RAW_EPSIZE]; + size_t size = 0; + do { + size_t size = chnReadTimeout(&drivers.raw_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE); + if (size > 0) { + raw_hid_receive(buffer, size); } - } + } while(size > 0); } -/* Flush timer code - * callback (called from ISR, unlocked state) */ -static void console_flush_cb(void *arg) { - USBDriver *usbp = (USBDriver *)arg; - osalSysLockFromISR(); +#endif - /* check that the states of things are as they're supposed to */ - if(usbGetDriverStateI(usbp) != USB_ACTIVE) { - /* rearm the timer */ - chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp); - osalSysUnlockFromISR(); - return; - } +#ifdef MIDI_ENABLE - /* If there is already a transaction ongoing then another one cannot be - started.*/ - if (usbGetTransmitStatusI(usbp, CONSOLE_ENDPOINT)) { - /* rearm the timer */ - chVTSetI(&console_flush_timer, MS2ST(CONSOLE_FLUSH_MS), console_flush_cb, (void *)usbp); - osalSysUnlockFromISR(); - return; - } +void send_midi_packet(MIDI_EventPacket_t* event) { + chnWrite(&drivers.midi_driver.driver, (uint8_t*)event, sizeof(MIDI_EventPacket_t)); +} - /* Checking if there only a buffer partially filled, if so then it is - enforced in the queue and transmitted.*/ - if(obqTryFlushI(&console_buf_queue)) { - size_t n,i; - uint8_t *buf = obqGetFullBufferI(&console_buf_queue, &n); +bool recv_midi_packet(MIDI_EventPacket_t* const event) { + size_t size = chnReadTimeout(&drivers.midi_driver.driver, (uint8_t*)event, sizeof(MIDI_EventPacket_t), TIME_IMMEDIATE); + return size == sizeof(MIDI_EventPacket_t); +} - osalDbgAssert(buf != NULL, "queue is empty"); +#endif - /* zero the rest of the buffer (buf should point to allocated space) */ - for(i=n; i 0); } -#endif /* CONSOLE_ENABLE */ -void sendchar_pf(void *p, char c) { - (void)p; - sendchar((uint8_t)c); -} +#endif diff --git a/tmk_core/protocol/chibios/usb_main.h b/tmk_core/protocol/chibios/usb_main.h index b4f894f2..1f7eb12f 100644 --- a/tmk_core/protocol/chibios/usb_main.h +++ b/tmk_core/protocol/chibios/usb_main.h @@ -41,20 +41,6 @@ void init_usb_driver(USBDriver *usbp); * --------------- */ -/* main keyboard (6kro) */ -#define KBD_INTERFACE 0 -#define KBD_ENDPOINT 1 -#define KBD_EPSIZE 8 -#define KBD_REPORT_KEYS (KBD_EPSIZE - 2) - -/* secondary keyboard */ -#ifdef NKRO_ENABLE -#define NKRO_INTERFACE 4 -#define NKRO_ENDPOINT 5 -#define NKRO_EPSIZE 16 -#define NKRO_REPORT_KEYS (NKRO_EPSIZE - 1) -#endif - /* extern report_keyboard_t keyboard_report_sent; */ /* keyboard IN request callback handler */ @@ -75,10 +61,6 @@ void nkro_in_cb(USBDriver *usbp, usbep_t ep); #ifdef MOUSE_ENABLE -#define MOUSE_INTERFACE 1 -#define MOUSE_ENDPOINT 2 -#define MOUSE_EPSIZE 8 - /* mouse IN request callback handler */ void mouse_in_cb(USBDriver *usbp, usbep_t ep); #endif /* MOUSE_ENABLE */ @@ -90,10 +72,6 @@ void mouse_in_cb(USBDriver *usbp, usbep_t ep); #ifdef EXTRAKEY_ENABLE -#define EXTRA_INTERFACE 3 -#define EXTRA_ENDPOINT 4 -#define EXTRA_EPSIZE 8 - /* extrakey IN request callback handler */ void extra_in_cb(USBDriver *usbp, usbep_t ep); @@ -111,24 +89,12 @@ typedef struct { #ifdef CONSOLE_ENABLE -#define CONSOLE_INTERFACE 2 -#define CONSOLE_ENDPOINT 3 -#define CONSOLE_EPSIZE 16 - -/* Number of IN reports that can be stored inside the output queue */ -#define CONSOLE_QUEUE_CAPACITY 4 - -/* Console flush time */ -#define CONSOLE_FLUSH_MS 50 - /* Putchar over the USB console */ int8_t sendchar(uint8_t c); /* Flush output (send everything immediately) */ void console_flush_output(void); -/* console IN request callback handler */ -void console_in_cb(USBDriver *usbp, usbep_t ep); #endif /* CONSOLE_ENABLE */ void sendchar_pf(void *p, char c); diff --git a/tmk_core/protocol/lufa.mk b/tmk_core/protocol/lufa.mk index 4d005deb..bb82a31e 100644 --- a/tmk_core/protocol/lufa.mk +++ b/tmk_core/protocol/lufa.mk @@ -15,7 +15,7 @@ else endif LUFA_SRC = lufa.c \ - descriptor.c \ + usb_descriptor.c \ outputselect.c \ $(LUFA_SRC_USB) @@ -64,7 +64,7 @@ LUFA_OPTS = -DUSB_DEVICE_ONLY LUFA_OPTS += -DUSE_FLASH_DESCRIPTORS LUFA_OPTS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" #LUFA_OPTS += -DINTERRUPT_CONTROL_ENDPOINT -LUFA_OPTS += -DFIXED_CONTROL_ENDPOINT_SIZE=8 +LUFA_OPTS += -DFIXED_CONTROL_ENDPOINT_SIZE=8 LUFA_OPTS += -DFIXED_CONTROL_ENDPOINT_SIZE=8 LUFA_OPTS += -DFIXED_NUM_CONFIGURATIONS=1 diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index e3f8724e..a1cab98a 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -49,7 +49,7 @@ #endif #include "suspend.h" -#include "descriptor.h" +#include "usb_descriptor.h" #include "lufa.h" #include "quantum.h" #include @@ -83,7 +83,7 @@ #endif #ifdef MIDI_ENABLE - #include "sysex_tools.h" + #include "qmk_midi.h" #endif #ifdef RAW_ENABLE @@ -97,12 +97,6 @@ static uint8_t keyboard_led_stats = 0; static report_keyboard_t keyboard_report_sent; -#ifdef MIDI_ENABLE -static void usb_send_func(MidiDevice * device, uint16_t cnt, uint8_t byte0, uint8_t byte1, uint8_t byte2); -static void usb_get_midi(MidiDevice * device); -static void midi_usb_init(MidiDevice * device); -#endif - /* Host driver */ static uint8_t keyboard_leds(void); static void send_keyboard(report_keyboard_t *report); @@ -115,48 +109,8 @@ host_driver_t lufa_driver = { send_mouse, send_system, send_consumer, -#ifdef MIDI_ENABLE - usb_send_func, - usb_get_midi, - midi_usb_init -#endif -}; - -/******************************************************************************* - * MIDI - ******************************************************************************/ - -#ifdef MIDI_ENABLE -USB_ClassInfo_MIDI_Device_t USB_MIDI_Interface = -{ - .Config = - { - .StreamingInterfaceNumber = AS_INTERFACE, - .DataINEndpoint = - { - .Address = MIDI_STREAM_IN_EPADDR, - .Size = MIDI_STREAM_EPSIZE, - .Banks = 1, - }, - .DataOUTEndpoint = - { - .Address = MIDI_STREAM_OUT_EPADDR, - .Size = MIDI_STREAM_EPSIZE, - .Banks = 1, - }, - }, }; -#define SYSEX_START_OR_CONT 0x40 -#define SYSEX_ENDS_IN_1 0x50 -#define SYSEX_ENDS_IN_2 0x60 -#define SYSEX_ENDS_IN_3 0x70 - -#define SYS_COMMON_1 0x50 -#define SYS_COMMON_2 0x20 -#define SYS_COMMON_3 0x30 -#endif - #ifdef VIRTSER_ENABLE USB_ClassInfo_CDC_Device_t cdc_device = { @@ -853,170 +807,32 @@ int8_t sendchar(uint8_t c) ******************************************************************************/ #ifdef MIDI_ENABLE -static void usb_send_func(MidiDevice * device, uint16_t cnt, uint8_t byte0, uint8_t byte1, uint8_t byte2) { - MIDI_EventPacket_t event; - event.Data1 = byte0; - event.Data2 = byte1; - event.Data3 = byte2; - - uint8_t cable = 0; - -// Endpoint_SelectEndpoint(MIDI_STREAM_IN_EPNUM); - - //if the length is undefined we assume it is a SYSEX message - if (midi_packet_length(byte0) == UNDEFINED) { - switch(cnt) { - case 3: - if (byte2 == SYSEX_END) - event.Event = MIDI_EVENT(cable, SYSEX_ENDS_IN_3); - else - event.Event = MIDI_EVENT(cable, SYSEX_START_OR_CONT); - break; - case 2: - if (byte1 == SYSEX_END) - event.Event = MIDI_EVENT(cable, SYSEX_ENDS_IN_2); - else - event.Event = MIDI_EVENT(cable, SYSEX_START_OR_CONT); - break; - case 1: - if (byte0 == SYSEX_END) - event.Event = MIDI_EVENT(cable, SYSEX_ENDS_IN_1); - else - event.Event = MIDI_EVENT(cable, SYSEX_START_OR_CONT); - break; - default: - return; //invalid cnt - } - } else { - //deal with 'system common' messages - //TODO are there any more? - switch(byte0 & 0xF0){ - case MIDI_SONGPOSITION: - event.Event = MIDI_EVENT(cable, SYS_COMMON_3); - break; - case MIDI_SONGSELECT: - case MIDI_TC_QUARTERFRAME: - event.Event = MIDI_EVENT(cable, SYS_COMMON_2); - break; - default: - event.Event = MIDI_EVENT(cable, byte0); - break; - } - } - -// Endpoint_Write_Stream_LE(&event, sizeof(event), NULL); -// Endpoint_ClearIN(); - - MIDI_Device_SendEventPacket(&USB_MIDI_Interface, &event); - MIDI_Device_Flush(&USB_MIDI_Interface); - MIDI_Device_USBTask(&USB_MIDI_Interface); - USB_USBTask(); -} - -static void usb_get_midi(MidiDevice * device) { - MIDI_EventPacket_t event; - while (MIDI_Device_ReceiveEventPacket(&USB_MIDI_Interface, &event)) { - - midi_packet_length_t length = midi_packet_length(event.Data1); - uint8_t input[3]; - input[0] = event.Data1; - input[1] = event.Data2; - input[2] = event.Data3; - if (length == UNDEFINED) { - //sysex - if (event.Event == MIDI_EVENT(0, SYSEX_START_OR_CONT) || event.Event == MIDI_EVENT(0, SYSEX_ENDS_IN_3)) { - length = 3; - } else if (event.Event == MIDI_EVENT(0, SYSEX_ENDS_IN_2)) { - length = 2; - } else if(event.Event == MIDI_EVENT(0, SYSEX_ENDS_IN_1)) { - length = 1; - } else { - //XXX what to do? - } - } - - //pass the data to the device input function - if (length != UNDEFINED) - midi_device_input(device, length, input); - } - MIDI_Device_USBTask(&USB_MIDI_Interface); - USB_USBTask(); -} - -static void midi_usb_init(MidiDevice * device){ - midi_device_init(device); - midi_device_set_send_func(device, usb_send_func); - midi_device_set_pre_input_process_func(device, usb_get_midi); - - // SetupHardware(); - sei(); -} - -void MIDI_Task(void) +USB_ClassInfo_MIDI_Device_t USB_MIDI_Interface = { - - /* 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()) + .Config = + { + .StreamingInterfaceNumber = AS_INTERFACE, + .DataINEndpoint = { - - 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()) + .Address = MIDI_STREAM_IN_EPADDR, + .Size = MIDI_STREAM_EPSIZE, + .Banks = 1, + }, + .DataOUTEndpoint = { - MIDI_EventPacket_t MIDIEvent; + .Address = MIDI_STREAM_OUT_EPADDR, + .Size = MIDI_STREAM_EPSIZE, + .Banks = 1, + }, + }, +}; - /* Read the MIDI event packet from the endpoint */ - Endpoint_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent), NULL); +void send_midi_packet(MIDI_EventPacket_t* event) { + MIDI_Device_SendEventPacket(&USB_MIDI_Interface, event); +} - /* If the endpoint is now empty, clear the bank */ - if (!(Endpoint_BytesInEndpoint())) - { - /* Clear the endpoint ready for new packet */ - Endpoint_ClearOUT(); - } - } +bool recv_midi_packet(MIDI_EventPacket_t* const event) { + return MIDI_Device_ReceiveEventPacket(&USB_MIDI_Interface, event); } #endif @@ -1105,26 +921,6 @@ static void setup_usb(void) print_set_sendchar(sendchar); } - -#ifdef MIDI_ENABLE -void fallthrough_callback(MidiDevice * device, - uint16_t cnt, uint8_t byte0, uint8_t byte1, uint8_t byte2); -void cc_callback(MidiDevice * device, - uint8_t chan, uint8_t num, uint8_t val); -void sysex_callback(MidiDevice * device, - uint16_t start, uint8_t length, uint8_t * data); - -void setup_midi(void) -{ -#ifdef MIDI_ADVANCED - midi_init(); -#endif - midi_device_init(&midi_device); - midi_device_set_send_func(&midi_device, usb_send_func); - midi_device_set_pre_input_process_func(&midi_device, usb_get_midi); -} -#endif - int main(void) __attribute__ ((weak)); int main(void) { @@ -1137,18 +933,6 @@ int main(void) setup_usb(); sei(); -#ifdef MIDI_ENABLE - midi_register_fallthrough_callback(&midi_device, fallthrough_callback); - midi_register_cc_callback(&midi_device, cc_callback); - midi_register_sysex_callback(&midi_device, sysex_callback); - - // init_notes(); - // 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 - #if defined(MODULE_ADAFRUIT_EZKEY) || defined(MODULE_RN42) serial_init(); #endif @@ -1193,10 +977,7 @@ int main(void) keyboard_task(); #ifdef MIDI_ENABLE - midi_device_process(&midi_device); -#ifdef MIDI_ADVANCED - midi_task(); -#endif + MIDI_Device_USBTask(&USB_MIDI_Interface); #endif #if defined(RGBLIGHT_ANIMATIONS) & defined(RGBLIGHT_ENABLE) @@ -1223,71 +1004,10 @@ int main(void) } } -#ifdef MIDI_ENABLE -void fallthrough_callback(MidiDevice * device, - uint16_t cnt, uint8_t byte0, uint8_t byte1, uint8_t byte2){ - -#ifdef AUDIO_ENABLE - if (cnt == 3) { - switch (byte0 & 0xF0) { - case MIDI_NOTEON: - play_note(((double)261.6)*pow(2.0, -4.0)*pow(2.0,(byte1 & 0x7F)/12.0), (byte2 & 0x7F) / 8); - break; - case MIDI_NOTEOFF: - stop_note(((double)261.6)*pow(2.0, -4.0)*pow(2.0,(byte1 & 0x7F)/12.0)); - break; - } - } - if (byte0 == MIDI_STOP) { - stop_all_notes(); - } -#endif -} - - -void cc_callback(MidiDevice * device, - uint8_t chan, uint8_t num, uint8_t val) { - //sending it back on the next channel - // midi_send_cc(device, (chan + 1) % 16, num, val); -} - -#ifdef API_SYSEX_ENABLE -uint8_t midi_buffer[MIDI_SYSEX_BUFFER] = {0}; -#endif - -void sysex_callback(MidiDevice * device, uint16_t start, uint8_t length, uint8_t * data) { - #ifdef API_SYSEX_ENABLE - // SEND_STRING("\n"); - // send_word(start); - // SEND_STRING(": "); - // Don't store the header - int16_t pos = start - 4; - for (uint8_t place = 0; place < length; place++) { - // send_byte(*data); - if (pos >= 0) { - if (*data == 0xF7) { - // SEND_STRING("\nRD: "); - // for (uint8_t i = 0; i < start + place + 1; i++){ - // send_byte(midi_buffer[i]); - // SEND_STRING(" "); - // } - const unsigned decoded_length = sysex_decoded_length(pos); - uint8_t decoded[API_SYSEX_MAX_SIZE]; - sysex_decode(decoded, midi_buffer, pos); - process_api(decoded_length, decoded); - return; - } - else if (pos >= MIDI_SYSEX_BUFFER) { - return; - } - midi_buffer[pos] = *data; - } - // SEND_STRING(" "); - data++; - pos++; - } - #endif +uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint16_t wIndex, + const void** const DescriptorAddress) +{ + return get_usb_descriptor(wValue, wIndex, DescriptorAddress); } - -#endif diff --git a/tmk_core/protocol/lufa/lufa.h b/tmk_core/protocol/lufa/lufa.h index a5157378..7364cdf7 100644 --- a/tmk_core/protocol/lufa/lufa.h +++ b/tmk_core/protocol/lufa/lufa.h @@ -1,4 +1,4 @@ -/* +/* * Copyright 2012 Jun Wako * This file is based on: * LUFA-120219/Demos/Device/Lowlevel/KeyboardMouse @@ -48,9 +48,6 @@ #include #include #include "host.h" -#ifdef MIDI_ENABLE - #include "process_midi.h" -#endif #ifdef __cplusplus extern "C" { #endif @@ -67,11 +64,6 @@ typedef struct { uint16_t usage; } __attribute__ ((packed)) report_extra_t; -#ifdef MIDI_ENABLE - void MIDI_Task(void); - MidiDevice midi_device; -#endif - #ifdef API_ENABLE #include "api.h" #endif diff --git a/tmk_core/protocol/midi.mk b/tmk_core/protocol/midi.mk index 4855b23d..a5f76b2d 100644 --- a/tmk_core/protocol/midi.mk +++ b/tmk_core/protocol/midi.mk @@ -5,6 +5,7 @@ SRC += midi.c \ bytequeue/bytequeue.c \ bytequeue/interrupt_setting.c \ sysex_tools.c \ + qmk_midi.c \ $(LUFA_SRC_USBCLASS) -VPATH += $(TMK_PATH)/$(MIDI_DIR) \ No newline at end of file +VPATH += $(TMK_PATH)/$(MIDI_DIR) diff --git a/tmk_core/protocol/midi/bytequeue/interrupt_setting.c b/tmk_core/protocol/midi/bytequeue/interrupt_setting.c index eafef527..0ab8b546 100755 --- a/tmk_core/protocol/midi/bytequeue/interrupt_setting.c +++ b/tmk_core/protocol/midi/bytequeue/interrupt_setting.c @@ -1,5 +1,5 @@ //Copyright 20010 Alex Norman -//writen by Alex Norman +//writen by Alex Norman // //This file is part of avr-bytequeue. // @@ -22,6 +22,7 @@ //implementations of the typedef and these functions #include "interrupt_setting.h" +#if defined(__AVR__) #include interrupt_setting_t store_and_clear_interrupt(void) { @@ -33,4 +34,16 @@ interrupt_setting_t store_and_clear_interrupt(void) { void restore_interrupt_setting(interrupt_setting_t setting) { SREG = setting; } +#elif defined(__arm__) +#include "ch.h" + +interrupt_setting_t store_and_clear_interrupt(void) { + chSysLock(); + return 0; +} + +void restore_interrupt_setting(interrupt_setting_t setting) { + chSysUnlock(); +} +#endif diff --git a/tmk_core/protocol/midi/qmk_midi.c b/tmk_core/protocol/midi/qmk_midi.c new file mode 100644 index 00000000..d4de6caa --- /dev/null +++ b/tmk_core/protocol/midi/qmk_midi.c @@ -0,0 +1,184 @@ +#include +#include "qmk_midi.h" +#include "sysex_tools.h" +#include "midi.h" +#include "usb_descriptor.h" +#include "process_midi.h" +#if API_SYSEX_ENABLE +#include "api.h" +#endif + +/******************************************************************************* + * MIDI + ******************************************************************************/ + +MidiDevice midi_device; + +#define SYSEX_START_OR_CONT 0x40 +#define SYSEX_ENDS_IN_1 0x50 +#define SYSEX_ENDS_IN_2 0x60 +#define SYSEX_ENDS_IN_3 0x70 + +#define SYS_COMMON_1 0x50 +#define SYS_COMMON_2 0x20 +#define SYS_COMMON_3 0x30 + +static void usb_send_func(MidiDevice * device, uint16_t cnt, uint8_t byte0, uint8_t byte1, uint8_t byte2) { + MIDI_EventPacket_t event; + event.Data1 = byte0; + event.Data2 = byte1; + event.Data3 = byte2; + + uint8_t cable = 0; + + //if the length is undefined we assume it is a SYSEX message + if (midi_packet_length(byte0) == UNDEFINED) { + switch(cnt) { + case 3: + if (byte2 == SYSEX_END) + event.Event = MIDI_EVENT(cable, SYSEX_ENDS_IN_3); + else + event.Event = MIDI_EVENT(cable, SYSEX_START_OR_CONT); + break; + case 2: + if (byte1 == SYSEX_END) + event.Event = MIDI_EVENT(cable, SYSEX_ENDS_IN_2); + else + event.Event = MIDI_EVENT(cable, SYSEX_START_OR_CONT); + break; + case 1: + if (byte0 == SYSEX_END) + event.Event = MIDI_EVENT(cable, SYSEX_ENDS_IN_1); + else + event.Event = MIDI_EVENT(cable, SYSEX_START_OR_CONT); + break; + default: + return; //invalid cnt + } + } else { + //deal with 'system common' messages + //TODO are there any more? + switch(byte0 & 0xF0){ + case MIDI_SONGPOSITION: + event.Event = MIDI_EVENT(cable, SYS_COMMON_3); + break; + case MIDI_SONGSELECT: + case MIDI_TC_QUARTERFRAME: + event.Event = MIDI_EVENT(cable, SYS_COMMON_2); + break; + default: + event.Event = MIDI_EVENT(cable, byte0); + break; + } + } + + send_midi_packet(&event); +} + +static void usb_get_midi(MidiDevice * device) { + MIDI_EventPacket_t event; + while (recv_midi_packet(&event)) { + + midi_packet_length_t length = midi_packet_length(event.Data1); + uint8_t input[3]; + input[0] = event.Data1; + input[1] = event.Data2; + input[2] = event.Data3; + if (length == UNDEFINED) { + //sysex + if (event.Event == MIDI_EVENT(0, SYSEX_START_OR_CONT) || event.Event == MIDI_EVENT(0, SYSEX_ENDS_IN_3)) { + length = 3; + } else if (event.Event == MIDI_EVENT(0, SYSEX_ENDS_IN_2)) { + length = 2; + } else if(event.Event == MIDI_EVENT(0, SYSEX_ENDS_IN_1)) { + length = 1; + } else { + //XXX what to do? + } + } + + //pass the data to the device input function + if (length != UNDEFINED) + midi_device_input(device, length, input); + } +} + +static void fallthrough_callback(MidiDevice * device, + uint16_t cnt, uint8_t byte0, uint8_t byte1, uint8_t byte2){ + +#ifdef AUDIO_ENABLE + if (cnt == 3) { + switch (byte0 & 0xF0) { + case MIDI_NOTEON: + play_note(((double)261.6)*pow(2.0, -4.0)*pow(2.0,(byte1 & 0x7F)/12.0), (byte2 & 0x7F) / 8); + break; + case MIDI_NOTEOFF: + stop_note(((double)261.6)*pow(2.0, -4.0)*pow(2.0,(byte1 & 0x7F)/12.0)); + break; + } + } + if (byte0 == MIDI_STOP) { + stop_all_notes(); + } +#endif +} + + +static void cc_callback(MidiDevice * device, + uint8_t chan, uint8_t num, uint8_t val) { + //sending it back on the next channel + // midi_send_cc(device, (chan + 1) % 16, num, val); +} + +#ifdef API_SYSEX_ENABLE +uint8_t midi_buffer[MIDI_SYSEX_BUFFER] = {0}; + +static void sysex_callback(MidiDevice * device, uint16_t start, uint8_t length, uint8_t * data) { + // SEND_STRING("\n"); + // send_word(start); + // SEND_STRING(": "); + // Don't store the header + int16_t pos = start - 4; + for (uint8_t place = 0; place < length; place++) { + // send_byte(*data); + if (pos >= 0) { + if (*data == 0xF7) { + // SEND_STRING("\nRD: "); + // for (uint8_t i = 0; i < start + place + 1; i++){ + // send_byte(midi_buffer[i]); + // SEND_STRING(" "); + // } + const unsigned decoded_length = sysex_decoded_length(pos); + uint8_t decoded[API_SYSEX_MAX_SIZE]; + sysex_decode(decoded, midi_buffer, pos); + process_api(decoded_length, decoded); + return; + } + else if (pos >= MIDI_SYSEX_BUFFER) { + return; + } + midi_buffer[pos] = *data; + } + // SEND_STRING(" "); + data++; + pos++; + } +} +#endif + +void midi_init(void); + +void setup_midi(void) +{ +#ifdef MIDI_ADVANCED + midi_init(); +#endif + midi_device_init(&midi_device); + midi_device_set_send_func(&midi_device, usb_send_func); + midi_device_set_pre_input_process_func(&midi_device, usb_get_midi); + midi_register_fallthrough_callback(&midi_device, fallthrough_callback); + midi_register_cc_callback(&midi_device, cc_callback); +#ifdef API_SYSEX_ENABLE + midi_register_sysex_callback(&midi_device, sysex_callback); +#endif +} diff --git a/tmk_core/protocol/midi/qmk_midi.h b/tmk_core/protocol/midi/qmk_midi.h new file mode 100644 index 00000000..7282a19d --- /dev/null +++ b/tmk_core/protocol/midi/qmk_midi.h @@ -0,0 +1,9 @@ +#pragma once + +#ifdef MIDI_ENABLE + #include "midi.h" + extern MidiDevice midi_device; + void setup_midi(void); + void send_midi_packet(MIDI_EventPacket_t* event); + bool recv_midi_packet(MIDI_EventPacket_t* const event); +#endif diff --git a/tmk_core/protocol/lufa/descriptor.c b/tmk_core/protocol/usb_descriptor.c similarity index 97% rename from tmk_core/protocol/lufa/descriptor.c rename to tmk_core/protocol/usb_descriptor.c index bfa91f25..cab34467 100644 --- a/tmk_core/protocol/lufa/descriptor.c +++ b/tmk_core/protocol/usb_descriptor.c @@ -38,7 +38,7 @@ #include "util.h" #include "report.h" -#include "descriptor.h" +#include "usb_descriptor.h" #ifndef USB_MAX_POWER_CONSUMPTION #define USB_MAX_POWER_CONSUMPTION 500 @@ -571,6 +571,19 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = #endif #ifdef MIDI_ENABLE + .Audio_Interface_Association = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_Association_t), .Type = DTYPE_InterfaceAssociation}, + + .FirstInterfaceIndex = AC_INTERFACE, + .TotalInterfaces = 2, + + .Class = AUDIO_CSCP_AudioClass, + .SubClass = AUDIO_CSCP_ControlSubclass, + .Protocol = AUDIO_CSCP_ControlProtocol, + + .IADStrIndex = NO_DESCRIPTOR, + }, .Audio_ControlInterface = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, @@ -622,8 +635,9 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .AudioSpecification = VERSION_BCD(1,0,0), - .TotalLength = (sizeof(USB_Descriptor_Configuration_t) - - offsetof(USB_Descriptor_Configuration_t, Audio_StreamInterface_SPC)) + .TotalLength = offsetof(USB_Descriptor_Configuration_t, MIDI_Out_Jack_Endpoint_SPC) + + sizeof(USB_MIDI_Descriptor_Jack_Endpoint_t) + - offsetof(USB_Descriptor_Configuration_t, Audio_StreamInterface_SPC) }, .MIDI_In_Jack_Emb = @@ -879,9 +893,9 @@ const USB_Descriptor_String_t PROGMEM SerialNumberString = * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * USB host. */ -uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, - const uint16_t wIndex, - const void** const DescriptorAddress) +uint16_t get_usb_descriptor(const uint16_t wValue, + const uint16_t wIndex, + const void** const DescriptorAddress) { const uint8_t DescriptorType = (wValue >> 8); const uint8_t DescriptorIndex = (wValue & 0xFF); diff --git a/tmk_core/protocol/lufa/descriptor.h b/tmk_core/protocol/usb_descriptor.h similarity index 79% rename from tmk_core/protocol/lufa/descriptor.h rename to tmk_core/protocol/usb_descriptor.h index 61c42c9d..1eedfe5a 100644 --- a/tmk_core/protocol/lufa/descriptor.h +++ b/tmk_core/protocol/usb_descriptor.h @@ -45,8 +45,9 @@ #define _DESCRIPTORS_H_ #include -#include - +#ifdef PROTOCOL_CHIBIOS +#include "hal.h" +#endif typedef struct { @@ -95,25 +96,26 @@ typedef struct #endif #ifdef MIDI_ENABLE - // MIDI Audio Control Interface - USB_Descriptor_Interface_t Audio_ControlInterface; - USB_Audio_Descriptor_Interface_AC_t Audio_ControlInterface_SPC; - - // MIDI Audio Streaming Interface - USB_Descriptor_Interface_t Audio_StreamInterface; - USB_MIDI_Descriptor_AudioInterface_AS_t Audio_StreamInterface_SPC; - USB_MIDI_Descriptor_InputJack_t MIDI_In_Jack_Emb; - USB_MIDI_Descriptor_InputJack_t MIDI_In_Jack_Ext; - USB_MIDI_Descriptor_OutputJack_t MIDI_Out_Jack_Emb; - USB_MIDI_Descriptor_OutputJack_t MIDI_Out_Jack_Ext; - USB_Audio_Descriptor_StreamEndpoint_Std_t MIDI_In_Jack_Endpoint; - USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_In_Jack_Endpoint_SPC; - USB_Audio_Descriptor_StreamEndpoint_Std_t MIDI_Out_Jack_Endpoint; - USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC; + USB_Descriptor_Interface_Association_t Audio_Interface_Association; + // MIDI Audio Control Interface + USB_Descriptor_Interface_t Audio_ControlInterface; + USB_Audio_Descriptor_Interface_AC_t Audio_ControlInterface_SPC; + + // MIDI Audio Streaming Interface + USB_Descriptor_Interface_t Audio_StreamInterface; + USB_MIDI_Descriptor_AudioInterface_AS_t Audio_StreamInterface_SPC; + USB_MIDI_Descriptor_InputJack_t MIDI_In_Jack_Emb; + USB_MIDI_Descriptor_InputJack_t MIDI_In_Jack_Ext; + USB_MIDI_Descriptor_OutputJack_t MIDI_Out_Jack_Emb; + USB_MIDI_Descriptor_OutputJack_t MIDI_Out_Jack_Ext; + USB_Audio_Descriptor_StreamEndpoint_Std_t MIDI_In_Jack_Endpoint; + USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_In_Jack_Endpoint_SPC; + USB_Audio_Descriptor_StreamEndpoint_Std_t MIDI_Out_Jack_Endpoint; + USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC; #endif #ifdef VIRTSER_ENABLE - USB_Descriptor_Interface_Association_t CDC_Interface_Association; + USB_Descriptor_Interface_Association_t CDC_Interface_Association; // CDC Control Interface USB_Descriptor_Interface_t CDC_CCI_Interface; @@ -208,8 +210,14 @@ typedef struct #ifdef CONSOLE_ENABLE # define CONSOLE_IN_EPNUM (RAW_OUT_EPNUM + 1) -//# define CONSOLE_OUT_EPNUM (RAW_OUT_EPNUM + 2) +#ifdef PROTOCOL_CHIBIOS +// ChibiOS has enough memory and descriptor to actually enable the endpoint +// It could use the same endpoint numbers, as that's supported by ChibiOS +// But the QMK code currently assumes that the endpoint numbers are different +# define CONSOLE_OUT_EPNUM (RAW_OUT_EPNUM + 2) +#else # define CONSOLE_OUT_EPNUM (RAW_OUT_EPNUM + 1) +#endif #else # define CONSOLE_OUT_EPNUM RAW_OUT_EPNUM #endif @@ -241,27 +249,24 @@ typedef struct # define CDC_OUT_EPNUM MIDI_STREAM_OUT_EPNUM #endif -#if (defined(__AVR_ATmega32U2__) && CDC_OUT_EPNUM > 4) || \ - (defined(__AVR_ATmega32U4__) && CDC_OUT_EPNUM > 6) -# error "Endpoints are not available enough to support all functions. Remove some in Makefile.(MOUSEKEY, EXTRAKEY, CONSOLE, NKRO, MIDI, SERIAL)" +#if (defined(PROTOCOL_LUFA) && CDC_OUT_EPNUM > (ENDPOINT_TOTAL_ENDPOINTS - 1)) || \ + (defined(PROTOCOL_CHIBIOS) && CDC_OUT_EPNUM > USB_MAX_ENDPOINTS) +# error "There are not enough available endpoints to support all functions. Remove some in the rules.mk file.(MOUSEKEY, EXTRAKEY, CONSOLE, NKRO, MIDI, SERIAL, STENO)" #endif #define KEYBOARD_EPSIZE 8 #define MOUSE_EPSIZE 8 #define EXTRAKEY_EPSIZE 8 -#define RAW_EPSIZE 32 +#define RAW_EPSIZE 32 #define CONSOLE_EPSIZE 32 #define NKRO_EPSIZE 32 #define MIDI_STREAM_EPSIZE 64 -#define CDC_NOTIFICATION_EPSIZE 8 +#define CDC_NOTIFICATION_EPSIZE 32 #define CDC_EPSIZE 16 - -uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, - const uint16_t wIndex, - const void** const DescriptorAddress) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); - +uint16_t get_usb_descriptor(const uint16_t wValue, + const uint16_t wIndex, + const void** const DescriptorAddress); /* new API */ #if LUFA_VERSION_INTEGER < 0x140302 From 361810dca80b31b2ba236df8fdea48b89fedfd4d Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Thu, 25 Jan 2018 16:36:01 -0500 Subject: [PATCH 070/173] Only search through newly detected devices and discard ones that disappeared --- tmk_core/avr.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index 24722736..e11ba2e2 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk @@ -175,10 +175,11 @@ avrdude: $(BUILD_DIR)/$(TARGET).hex check-size ls /dev/tty* > /tmp/1; \ echo -e "Detecting USB port, reset your controller now.\c"; \ while [ -z $$USB ]; do \ - sleep 1; \ echo -e ".\c"; \ + sleep 0.5; \ ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ + USB=`comm -13 /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ + mv /tmp/2 /tmp/1; \ done; \ echo ""; \ echo "Detected controller on USB port at $$USB"; \ From c5d81a84a0519c78de1b5e165f5f2c1eb773bc11 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Mon, 29 Jan 2018 10:49:26 -0500 Subject: [PATCH 071/173] Switch from echo to printf for output without newlines --- tmk_core/avr.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index e11ba2e2..106b7715 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk @@ -172,11 +172,11 @@ avrdude: $(BUILD_DIR)/$(TARGET).hex check-size if grep -q -s Microsoft /proc/version; then \ echo 'ERROR: AVR flashing cannot be automated within the Windows Subsystem for Linux (WSL) currently. Instead, take the .hex file generated and flash it using AVRDUDE, AVRDUDESS, or XLoader.'; \ else \ + printf "Detecting USB port, reset your controller now."; \ ls /dev/tty* > /tmp/1; \ - echo -e "Detecting USB port, reset your controller now.\c"; \ while [ -z $$USB ]; do \ - echo -e ".\c"; \ sleep 0.5; \ + printf "."; \ ls /dev/tty* > /tmp/2; \ USB=`comm -13 /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ mv /tmp/2 /tmp/1; \ From 6835ae82095427b2b5d5b3839a8d54845244169b Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Thu, 8 Feb 2018 12:16:06 -0800 Subject: [PATCH 072/173] Add the ability to disable Music Mode completely (#2339) * Skip process_music in NO_MUSIC_MODE is defined * Skip matrix_scan_music if NO_MUSIC_MODE is defined * Skip music_all_notes_off if NO_MUSIC_MODE is defined * Leave matrix_scan_music in, because it reduces firmware size by 150b.... * Add docs for NO_MUSIC_MODE --- docs/feature_audio.md | 4 ++++ keyboards/orthodox/keymaps/drashna/config.h | 1 + quantum/quantum.c | 6 +++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/feature_audio.md b/docs/feature_audio.md index 6b991a9a..c7133b29 100644 --- a/docs/feature_audio.md +++ b/docs/feature_audio.md @@ -82,6 +82,10 @@ The pitch standard (`PITCH_STANDARD_A`) is 440.0f by default - to change this, a #define PITCH_STANDARD_A 432.0f +You can completely disable Music Mode as well. This is useful, if you're pressed for space on your controller. To disable it, add this to your `confid.h`: + + #define NO_MUSIC_MODE + ## MIDI Functionality This is still a WIP, but check out `quantum/keymap_midi.c` to see what's happening. Enable from the Makefile. diff --git a/keyboards/orthodox/keymaps/drashna/config.h b/keyboards/orthodox/keymaps/drashna/config.h index c83380bd..107f16d5 100644 --- a/keyboards/orthodox/keymaps/drashna/config.h +++ b/keyboards/orthodox/keymaps/drashna/config.h @@ -69,6 +69,7 @@ along with this program. If not, see . #ifdef AUDIO_ENABLE #define C6_AUDIO #define STARTUP_SONG SONG(IMPERIAL_MARCH) +#define NO_MUSIC_MODE #endif #undef PRODUCT diff --git a/quantum/quantum.c b/quantum/quantum.c index bd95d5ea..66feca2f 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -147,7 +147,7 @@ void reset_keyboard(void) { #if defined(MIDI_ENABLE) && defined(MIDI_BASIC) process_midi_all_notes_off(); #endif -#if defined(AUDIO_ENABLE) +#if defined(AUDIO_ENABLE) && !defined(NO_MUSIC_MODE) music_all_notes_off(); uint16_t timer_start = timer_read(); PLAY_SONG(goodbye_song); @@ -236,7 +236,7 @@ bool process_record_quantum(keyrecord_t *record) { #ifdef STENO_ENABLE process_steno(keycode, record) && #endif - #if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC)) + #if ( defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))) && !defined(NO_MUSIC_MODE) process_music(keycode, record) && #endif #ifdef TAP_DANCE_ENABLE @@ -834,7 +834,7 @@ void matrix_init_quantum() { } void matrix_scan_quantum() { - #ifdef AUDIO_ENABLE + #if defined(AUDIO_ENABLE) matrix_scan_music(); #endif From fae81322959a2e6877238ca4e542cac805a2e7c2 Mon Sep 17 00:00:00 2001 From: "Michael F. Lamb" Date: Tue, 6 Feb 2018 12:05:48 -0800 Subject: [PATCH 073/173] make check_size work across platforms --- tmk_core/rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index a1df7fc2..18aef8d8 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk @@ -371,7 +371,7 @@ show_path: @echo OBJ=$(OBJ) check-size: - $(eval MAX_SIZE=$(shell n=`avr-gcc -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | perl -ne 'print "$&\n" if /(?<=AVR_SIZE: ).+/'`; echo $$(($$n)) || echo 0)) + $(eval MAX_SIZE=$(shell n=`avr-gcc -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne '/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'`; echo $$(($$n)) || echo 0)) $(eval CURRENT_SIZE=$(shell if [ -f $(BUILD_DIR)/$(TARGET).hex ]; then $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(AWK) 'NR==2 {print $$4}'; else printf 0; fi)) if [ $(MAX_SIZE) -gt 0 ] && [ $(CURRENT_SIZE) -gt 0 ]; then \ $(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \ From fca31693df15f62cc3fd5851a0d1bae40eb179c2 Mon Sep 17 00:00:00 2001 From: "Michael F. Lamb" Date: Tue, 6 Feb 2018 16:32:31 -0800 Subject: [PATCH 074/173] add conditional to perform check-size only for supported architectures --- tmk_core/rules.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index 18aef8d8..ff6af4a8 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk @@ -370,6 +370,7 @@ show_path: @echo SRC=$(SRC) @echo OBJ=$(OBJ) +ifeq ($(CC),avr-gcc) check-size: $(eval MAX_SIZE=$(shell n=`avr-gcc -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne '/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'`; echo $$(($$n)) || echo 0)) $(eval CURRENT_SIZE=$(shell if [ -f $(BUILD_DIR)/$(TARGET).hex ]; then $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(AWK) 'NR==2 {print $$4}'; else printf 0; fi)) @@ -377,6 +378,10 @@ check-size: $(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \ if [ $(CURRENT_SIZE) -gt $(MAX_SIZE) ]; then $(PRINT_WARNING_PLAIN); $(SILENT) || printf " * $(MSG_FILE_TOO_BIG)" ; else $(PRINT_OK); $(SILENT) || printf " * $(MSG_FILE_JUST_RIGHT)"; fi \ fi +else +check-size: + echo "(Firmware size check does not yet support $(MCU) microprocessors; skipping.)" +endif # Create build directory $(shell mkdir -p $(BUILD_DIR) 2>/dev/null) From 8c2ae4a4701439e98569dc2f2acee7016b4c0f20 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sat, 10 Feb 2018 23:09:03 +0200 Subject: [PATCH 075/173] Fix reset for STM32 devices --- .../60/boards/GENERIC_STM32_F303XC/board.c | 4 ++- .../60/boards/GENERIC_STM32_F303XC/board.h | 4 +-- keyboards/clueboard/60/rules.mk | 2 +- tmk_core/common/chibios/bootloader.c | 34 +++++++++---------- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/keyboards/clueboard/60/boards/GENERIC_STM32_F303XC/board.c b/keyboards/clueboard/60/boards/GENERIC_STM32_F303XC/board.c index 897f20a8..4331155d 100644 --- a/keyboards/clueboard/60/boards/GENERIC_STM32_F303XC/board.c +++ b/keyboards/clueboard/60/boards/GENERIC_STM32_F303XC/board.c @@ -62,13 +62,15 @@ const PALConfig pal_default_config = { }; #endif +void enter_bootloader_mode_if_requested(void); + /** * @brief Early initialization code. * @details This initialization must be performed just after stack setup * and before any other initialization. */ void __early_init(void) { - + enter_bootloader_mode_if_requested(); stm32_clock_init(); } diff --git a/keyboards/clueboard/60/boards/GENERIC_STM32_F303XC/board.h b/keyboards/clueboard/60/boards/GENERIC_STM32_F303XC/board.h index 7405c0ea..e09112eb 100644 --- a/keyboards/clueboard/60/boards/GENERIC_STM32_F303XC/board.h +++ b/keyboards/clueboard/60/boards/GENERIC_STM32_F303XC/board.h @@ -1164,14 +1164,14 @@ /* * USB bus activation macro, required by the USB driver. */ -// #define usb_lld_connect_bus(usbp) +// #define usb_lld_connect_bus(usbp) #define usb_lld_connect_bus(usbp) (palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_ALTERNATE(14))) // #define usb_lld_connect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_INPUT) /* * USB bus de-activation macro, required by the USB driver. */ // #define usb_lld_disconnect_bus(usbp) -#define usb_lld_disconnect_bus(usbp) (palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_OUTPUT_PUSHPULL)) +#define usb_lld_disconnect_bus(usbp) (palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_OUTPUT_PUSHPULL)); palClearPad(GPIOA, GPIOA_USB_DP) // #define usb_lld_disconnect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_OUTPUT_PUSHPULL); palClearPad(GPIOA, 12) #if !defined(_FROM_ASM_) diff --git a/keyboards/clueboard/60/rules.mk b/keyboards/clueboard/60/rules.mk index e0c4b850..3664b6d2 100644 --- a/keyboards/clueboard/60/rules.mk +++ b/keyboards/clueboard/60/rules.mk @@ -37,7 +37,7 @@ USE_FPU = yes OPT_DEFS = # Options to pass to dfu-util when flashing -DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000 -R +DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave # Build Options # comment out to disable the options. diff --git a/tmk_core/common/chibios/bootloader.c b/tmk_core/common/chibios/bootloader.c index fc17fca1..2dd3ade3 100644 --- a/tmk_core/common/chibios/bootloader.c +++ b/tmk_core/common/chibios/bootloader.c @@ -6,32 +6,32 @@ #ifdef STM32_BOOTLOADER_ADDRESS /* STM32 */ -#if defined(STM32F0XX) /* This code should be checked whether it runs correctly on platforms */ #define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0)) extern uint32_t __ram0_end__; +#define BOOTLOADER_MAGIC 0xDEADBEEF +#define MAGIC_ADDR (unsigned long*)(SYMVAL(__ram0_end__) - 4) -void bootloader_jump(void) { - *((unsigned long *)(SYMVAL(__ram0_end__) - 4)) = 0xDEADBEEF; // set magic flag => reset handler will jump into boot loader - NVIC_SystemReset(); -} - -#elif defined(STM32F3XX) -/* This code should be checked whether it runs correctly on platforms. - * It was added for clueboard60 BUT HAS NOT BEEN TESTED. - * FIXME - Test this - */ -#define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0)) -extern uint32_t __ram0_end__; void bootloader_jump(void) { - *((unsigned long *)(SYMVAL(__ram0_end__) - 4)) = 0xDEADBEEF; // set magic flag => reset handler will jump into boot loader + *MAGIC_ADDR = BOOTLOADER_MAGIC; // set magic flag => reset handler will jump into boot loader NVIC_SystemReset(); } -#else /* defined(STM32F0XX) */ -#error Check that the bootloader code works on your platform and add it to bootloader.c! -#endif /* defined(STM32F0XX) */ +void enter_bootloader_mode_if_requested(void) { + unsigned long* check = MAGIC_ADDR; + if(*check == BOOTLOADER_MAGIC) { + *check = 0; + __set_CONTROL(0); + __set_MSP(*(__IO uint32_t*)STM32_BOOTLOADER_ADDRESS); + __enable_irq(); + + typedef void (*BootJump_t)(void); + BootJump_t boot_jump = *(BootJump_t*)(STM32_BOOTLOADER_ADDRESS + 4); + boot_jump(); + while(1); + } + } #elif defined(KL2x) || defined(K20x) /* STM32_BOOTLOADER_ADDRESS */ /* Kinetis */ From a972b262748efe977d9a0f8f47fdc36dc9c787e3 Mon Sep 17 00:00:00 2001 From: Jason Barnachea Date: Sat, 10 Feb 2018 14:24:54 -0800 Subject: [PATCH 076/173] Add JC65 ps2avrGB keyboard (#2351) * Adds JC65 ps2avrGB keyboard * Adds default keymap * Adds personal keymap * Backlight On/off support Migrated code from the BFake. Functionality only on BL_ON, BL_OFF, BL_TOGG. * Backlighting config adjustment Only 1 level supported. * Personal keymap update BL toggle added and RGB layer updates. * Renamed jc65 ps2avrgb directory Renamed directory for more clarity. * Default keymap and default rules * Personal keymap and personal rules * Group JC65 QMK and PS2 versions Group JC65 QMK and PS2 versions, Split directories, Readme for parent folder. * Default keycaps and personal keymaps re-added Default and personal keymaps re-added. Keymaps, Readme, Rules.mk, and config.h * v32a default keymap rules Default to no. * RGB and Backlight default settings Set to yes. * Rules.mk defaults for personal keymap Rules.mk defaults for personal keymap * Revised keyboard readme make paths Revised. * Path correction * jc65 default folder set set default pcb to qmk version * default rules for v32a set to enable backlight and rgb by default. --- keyboards/jc65/jc65.c | 35 -- keyboards/jc65/jc65.h | 21 +- keyboards/jc65/readme.md | 18 +- keyboards/jc65/rules.mk | 69 +-- keyboards/jc65/v32a/config.h | 46 ++ keyboards/jc65/v32a/i2c.c | 106 +++++ keyboards/jc65/v32a/i2c.h | 27 ++ keyboards/jc65/v32a/keymaps/default/keymap.c | 11 + keyboards/jc65/v32a/keymaps/default/readme.md | 10 + keyboards/jc65/v32a/keymaps/default/rules.mk | 2 + keyboards/jc65/v32a/keymaps/naut/keymap.c | 81 ++++ keyboards/jc65/v32a/keymaps/naut/readme.md | 16 + keyboards/jc65/v32a/keymaps/naut/rules.mk | 2 + keyboards/jc65/v32a/matrix.c | 106 +++++ keyboards/jc65/v32a/readme.md | 24 ++ keyboards/jc65/v32a/rules.mk | 50 +++ keyboards/jc65/v32a/usbconfig.h | 396 ++++++++++++++++++ keyboards/jc65/v32a/v32a.c | 65 +++ keyboards/jc65/v32a/v32a.h | 58 +++ keyboards/jc65/{ => v32u4}/config.h | 0 .../jc65/{ => v32u4}/keymaps/coth/config.h | 0 .../jc65/{ => v32u4}/keymaps/coth/keymap.c | 2 +- .../jc65/{ => v32u4}/keymaps/coth/readme.md | 0 .../jc65/{ => v32u4}/keymaps/coth/rules.mk | 0 .../jc65/{ => v32u4}/keymaps/default/config.h | 0 .../jc65/{ => v32u4}/keymaps/default/keymap.c | 2 +- .../{ => v32u4}/keymaps/default/readme.md | 0 .../jc65/{ => v32u4}/keymaps/default/rules.mk | 0 .../keymaps/jetpacktuxedo/config.h | 0 .../keymaps/jetpacktuxedo/keymap.c | 2 +- .../keymaps/jetpacktuxedo/readme.md | 0 .../keymaps/jetpacktuxedo/rules.mk | 0 .../{ => v32u4}/keymaps/na7thana/config.h | 0 .../{ => v32u4}/keymaps/na7thana/keymap.c | 2 +- .../{ => v32u4}/keymaps/na7thana/readme.md | 0 .../{ => v32u4}/keymaps/na7thana/rules.mk | 0 keyboards/jc65/v32u4/readme.md | 22 + keyboards/jc65/v32u4/rules.mk | 68 +++ keyboards/jc65/v32u4/v32u4.c | 36 ++ keyboards/jc65/v32u4/v32u4.h | 21 + 40 files changed, 1164 insertions(+), 134 deletions(-) create mode 100644 keyboards/jc65/v32a/config.h create mode 100644 keyboards/jc65/v32a/i2c.c create mode 100644 keyboards/jc65/v32a/i2c.h create mode 100644 keyboards/jc65/v32a/keymaps/default/keymap.c create mode 100644 keyboards/jc65/v32a/keymaps/default/readme.md create mode 100644 keyboards/jc65/v32a/keymaps/default/rules.mk create mode 100644 keyboards/jc65/v32a/keymaps/naut/keymap.c create mode 100644 keyboards/jc65/v32a/keymaps/naut/readme.md create mode 100644 keyboards/jc65/v32a/keymaps/naut/rules.mk create mode 100644 keyboards/jc65/v32a/matrix.c create mode 100644 keyboards/jc65/v32a/readme.md create mode 100644 keyboards/jc65/v32a/rules.mk create mode 100644 keyboards/jc65/v32a/usbconfig.h create mode 100644 keyboards/jc65/v32a/v32a.c create mode 100644 keyboards/jc65/v32a/v32a.h rename keyboards/jc65/{ => v32u4}/config.h (100%) rename keyboards/jc65/{ => v32u4}/keymaps/coth/config.h (100%) rename keyboards/jc65/{ => v32u4}/keymaps/coth/keymap.c (99%) rename keyboards/jc65/{ => v32u4}/keymaps/coth/readme.md (100%) rename keyboards/jc65/{ => v32u4}/keymaps/coth/rules.mk (100%) rename keyboards/jc65/{ => v32u4}/keymaps/default/config.h (100%) rename keyboards/jc65/{ => v32u4}/keymaps/default/keymap.c (97%) rename keyboards/jc65/{ => v32u4}/keymaps/default/readme.md (100%) rename keyboards/jc65/{ => v32u4}/keymaps/default/rules.mk (100%) rename keyboards/jc65/{ => v32u4}/keymaps/jetpacktuxedo/config.h (100%) rename keyboards/jc65/{ => v32u4}/keymaps/jetpacktuxedo/keymap.c (99%) rename keyboards/jc65/{ => v32u4}/keymaps/jetpacktuxedo/readme.md (100%) rename keyboards/jc65/{ => v32u4}/keymaps/jetpacktuxedo/rules.mk (100%) rename keyboards/jc65/{ => v32u4}/keymaps/na7thana/config.h (100%) rename keyboards/jc65/{ => v32u4}/keymaps/na7thana/keymap.c (98%) rename keyboards/jc65/{ => v32u4}/keymaps/na7thana/readme.md (100%) rename keyboards/jc65/{ => v32u4}/keymaps/na7thana/rules.mk (100%) create mode 100644 keyboards/jc65/v32u4/readme.md create mode 100644 keyboards/jc65/v32u4/rules.mk create mode 100644 keyboards/jc65/v32u4/v32u4.c create mode 100644 keyboards/jc65/v32u4/v32u4.h diff --git a/keyboards/jc65/jc65.c b/keyboards/jc65/jc65.c index 6f51c0d6..a4bd8687 100644 --- a/keyboards/jc65/jc65.c +++ b/keyboards/jc65/jc65.c @@ -1,36 +1 @@ #include "jc65.h" - -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - - matrix_init_user(); -} - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - matrix_scan_user(); -} - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - // put your per-action keyboard code here - // runs for every action, just before processing by the firmware - - return process_record_user(keycode, record); -} - -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - if (usb_led & (1< + +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 CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +#define VENDOR_ID 0x1234 +#define PRODUCT_ID 0x5679 +#define MANUFACTURER winkeyless.kr +#define PRODUCT JC65 PS2AVRGB + +/* matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 16 + +#define NO_BACKLIGHT_CLOCK +#define BACKLIGHT_LEVELS 1 +#define RGBLED_NUM 16 +#define RGBLIGHT_ANIMATIONS +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 +#define RGBLIGHT_EFFECT_KNIGHT_LED_NUM 8 + +#define NO_UART 1 + +/* key combination for command */ +#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) + +#endif diff --git a/keyboards/jc65/v32a/i2c.c b/keyboards/jc65/v32a/i2c.c new file mode 100644 index 00000000..a4f95213 --- /dev/null +++ b/keyboards/jc65/v32a/i2c.c @@ -0,0 +1,106 @@ +/* +Copyright 2016 Luiz Ribeiro + +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 . +*/ + +// Please do not modify this file + +#include +#include + +#include "i2c.h" + +void i2c_set_bitrate(uint16_t bitrate_khz) { + uint8_t bitrate_div = ((F_CPU / 1000l) / bitrate_khz); + if (bitrate_div >= 16) { + bitrate_div = (bitrate_div - 16) / 2; + } + TWBR = bitrate_div; +} + +void i2c_init(void) { + // set pull-up resistors on I2C bus pins + PORTC |= 0b11; + + i2c_set_bitrate(400); + + // enable TWI (two-wire interface) + TWCR |= (1 << TWEN); + + // enable TWI interrupt and slave address ACK + TWCR |= (1 << TWIE); + TWCR |= (1 << TWEA); +} + +uint8_t i2c_start(uint8_t address) { + // reset TWI control register + TWCR = 0; + + // begin transmission and wait for it to end + TWCR = (1< + +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 . +*/ + +// Please do not modify this file + +#ifndef __I2C_H__ +#define __I2C_H__ + +void i2c_init(void); +void i2c_set_bitrate(uint16_t bitrate_khz); +uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length); + +#endif diff --git a/keyboards/jc65/v32a/keymaps/default/keymap.c b/keyboards/jc65/v32a/keymaps/default/keymap.c new file mode 100644 index 00000000..de7a7135 --- /dev/null +++ b/keyboards/jc65/v32a/keymaps/default/keymap.c @@ -0,0 +1,11 @@ +#include "v32a.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = KEYMAP( + KC_GESC, 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_BSLS,KC_BSPC, KC_INS, + KC_TAB, 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, KC_DEL, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L,KC_SCLN,KC_QUOT,KC_NUHS, KC_ENT,KC_PGUP, + KC_LSFT,KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP,KC_PGDN, + KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT,KC_RGUI,KC_RCTL,KC_LEFT,KC_DOWN,KC_RGHT + ), +}; diff --git a/keyboards/jc65/v32a/keymaps/default/readme.md b/keyboards/jc65/v32a/keymaps/default/readme.md new file mode 100644 index 00000000..61e55f3c --- /dev/null +++ b/keyboards/jc65/v32a/keymaps/default/readme.md @@ -0,0 +1,10 @@ +Default Keymap +======= + +Default plain keymap with only a base layer. + +Keymap Maintainer: [Jason Barnachea](https://github.com/nautxx) + +Difference from base layout: None. + +Intended usage: Reference layout. diff --git a/keyboards/jc65/v32a/keymaps/default/rules.mk b/keyboards/jc65/v32a/keymaps/default/rules.mk new file mode 100644 index 00000000..d7463419 --- /dev/null +++ b/keyboards/jc65/v32a/keymaps/default/rules.mk @@ -0,0 +1,2 @@ +RGBLIGHT_ENABLE = yes +BACKLIGHT_ENABLE = yes diff --git a/keyboards/jc65/v32a/keymaps/naut/keymap.c b/keyboards/jc65/v32a/keymaps/naut/keymap.c new file mode 100644 index 00000000..90c5a221 --- /dev/null +++ b/keyboards/jc65/v32a/keymaps/naut/keymap.c @@ -0,0 +1,81 @@ +#include "v32a.h" + +// Define Layers +#define _BASE 0 +#define _FNX 1 +#define _MAC 2 +#define _RGB 3 + +// Define Macros +#define M_PRTS M(0) +#define M_PRTA M(1) +#define M_MSSN M(2) +#define M_APPS M(3) +#define M_SPOT M(4) +#define M_LEFT M(5) +#define M_RGHT M(6) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + // Base Layer + [_BASE] = KEYMAP( + 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_BSLS, KC_GRV, KC_INS, + KC_TAB, 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_BSPC, KC_DEL, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L,KC_SCLN,KC_QUOT, KC_NO, KC_ENT,KC_PGUP, + KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP,KC_PGDN, + MO(1),KC_LALT,KC_LGUI, KC_SPC, KC_SPC, KC_SPC, KC_RGUI, KC_NO,KC_RALT,KC_LEFT,KC_DOWN,KC_RGHT + ), + // Fn Layer + [_FNX] = KEYMAP( + KC_TRNS, 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, TG(3), + KC_CAPS,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,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, TG(2),KC_VOLU,KC_MPLY, + KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_MRWD,KC_VOLD,KC_MFFD + ), + // Mac Layer + [_MAC] = KEYMAP( + TO(0), KC_F14, KC_F15, M_APPS, M_MSSN, KC_F11, KC_F12,KC_MRWD,KC_MPLY,KC_MFFD,KC_MUTE,KC_VOLD,KC_VOLU,KC_EJCT, KC_NO, KC_NO, + KC_TRNS, M_PRTS, M_PRTA,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,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, TO(0), M_MSSN,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS, M_SPOT, M_SPOT, M_SPOT, KC_TRNS,KC_TRNS,KC_TRNS, M_LEFT, M_APPS, M_RGHT + ), + // RGB and BL Layer + [_RGB] = KEYMAP( + TO(0), 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, TO(0), + KC_NO,RGB_HUD,RGB_HUI, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,BL_TOGG, + KC_NO,RGB_SAD,RGB_SAI, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,RGB_TOG, + KC_NO, KC_NO,RGB_VAD,RGB_VAI, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,RGB_MOD,RGB_RMOD, KC_NO,RGB_M_P,RGB_M_R, + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,RGB_M_G,RGB_M_SW + ), +}; + +// The Macros +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + if (record->event.pressed) { + switch(id) { + case 0: + return MACRO(D(LGUI), D(LSFT), T(3), U(LSFT), U(LGUI), END); //Mac print screen + break; + case 1: + return MACRO(D(LGUI), D(LSFT), T(4), U(LSFT), U(LGUI), END); //Mac print area + break; + case 2: + return MACRO(D(LCTL), T(UP), U(LCTL), END); //Mac mission control + break; + case 3: + return MACRO(D(LCTL), T(DOWN), U(LCTL), END); //Mac applications + break; + case 4: + return MACRO(D(LGUI), T(SPC), U(LGUI), END); //Mac spotlight search + break; + case 5: + return MACRO(D(LCTL), T(LEFT), U(LCTL), END); //Mac mission left + break; + case 6: + return MACRO(D(LGUI), T(RGHT), U(LGUI), END); //Mac mission right + break; + } + } + return MACRO_NONE; +}; \ No newline at end of file diff --git a/keyboards/jc65/v32a/keymaps/naut/readme.md b/keyboards/jc65/v32a/keymaps/naut/readme.md new file mode 100644 index 00000000..e7d10966 --- /dev/null +++ b/keyboards/jc65/v32a/keymaps/naut/readme.md @@ -0,0 +1,16 @@ +Naut's Keymap +======= + +Layer 1: HHKB Split backspace, 6.25u space, control on caps, Fn on L-Ctl. + +Layer 2: F Row on numrow, caps on tab, media shortcuts on arrows + +Layer 3: Mac Media buttons on numrow + +Layer 4: RGB control + +Keymap Maintainer: [Jason Barnachea](https://github.com/nautxx) + +Difference from base layout: HHKBish layout. HHKB Fn layer. Mac media layer. RGB control layer. + +Intended usage: Daily driver for keyboard peacocking. diff --git a/keyboards/jc65/v32a/keymaps/naut/rules.mk b/keyboards/jc65/v32a/keymaps/naut/rules.mk new file mode 100644 index 00000000..d7463419 --- /dev/null +++ b/keyboards/jc65/v32a/keymaps/naut/rules.mk @@ -0,0 +1,2 @@ +RGBLIGHT_ENABLE = yes +BACKLIGHT_ENABLE = yes diff --git a/keyboards/jc65/v32a/matrix.c b/keyboards/jc65/v32a/matrix.c new file mode 100644 index 00000000..57aa36b5 --- /dev/null +++ b/keyboards/jc65/v32a/matrix.c @@ -0,0 +1,106 @@ +/* +Copyright 2017 Luiz Ribeiro + +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 +#include + +#include "matrix.h" + +#ifndef DEBOUNCE +#define DEBOUNCE 5 +#endif + +static uint8_t debouncing = DEBOUNCE; + +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +void matrix_init(void) { + // all outputs for rows high + DDRB = 0xFF; + PORTB = 0xFF; + // all inputs for columns + DDRA = 0x00; + DDRC &= ~(0x111111<<2); + DDRD &= ~(1<> 1) & 0x55) | ((x << 1) & 0xaa); + x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc); + x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0); + return x; +} + +uint8_t matrix_scan(void) { + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + matrix_set_row_status(row); + _delay_us(5); + + matrix_row_t cols = ( + // cols 0..7, PORTA 0 -> 7 + (~PINA) & 0xFF + ) | ( + // cols 8..13, PORTC 7 -> 0 + bit_reverse((~PINC) & 0xFF) << 8 + ) | ( + // col 14, PORTD 7 + ((~PIND) & (1 << PIND7)) << 7 + ); + + if (matrix_debouncing[row] != cols) { + matrix_debouncing[row] = cols; + debouncing = DEBOUNCE; + } + } + + if (debouncing) { + if (--debouncing) { + _delay_ms(1); + } else { + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = matrix_debouncing[i]; + } + } + } + + matrix_scan_user(); + + return 1; +} + +inline matrix_row_t matrix_get_row(uint8_t row) { + return matrix[row]; +} + +void matrix_print(void) { +} diff --git a/keyboards/jc65/v32a/readme.md b/keyboards/jc65/v32a/readme.md new file mode 100644 index 00000000..976217f1 --- /dev/null +++ b/keyboards/jc65/v32a/readme.md @@ -0,0 +1,24 @@ +JC65 ps2avrGB +======= + +A 65% keyboard with RGB + +Keyboard Maintainer: [Jason Barnachea](https://github.com/nautxx) + +Hardware Supported: JC65 rev.ps2avrgb + +Hardware Availability: [keyclack.com](https://keyclack.com/) + +The JC65 PCB actually has two revisions: A QMK native version, and a PS2AVRGB version. Jchan offered both PCBs as options during the M65-A Round 1 group buy, and were also available choices for the 65% acrylic case group buy. In the near future both PCB versions should be available from keyclack.com when the storefront part opens. + +These docs are for the PS2AVRGB version of the PCB. More info on qmk.fm + +Make example for this keyboard (after setting up your build environment): + + make jc65/v32a:default + +Flash example for this keyboard: + + bootloadHID -r jc65_v32a_default.hex + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. \ No newline at end of file diff --git a/keyboards/jc65/v32a/rules.mk b/keyboards/jc65/v32a/rules.mk new file mode 100644 index 00000000..1ea19fe0 --- /dev/null +++ b/keyboards/jc65/v32a/rules.mk @@ -0,0 +1,50 @@ +# Copyright 2017 Luiz Ribeiro +# +# 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 . + +# MCU name +MCU = atmega32a +PROTOCOL = VUSB + +# unsupported features for now +NO_UART = yes +NO_SUSPEND_POWER_DOWN = yes + +# processor frequency +F_CPU = 12000000 + +# Bootloader +# This definition is optional, and if your keyboard supports multiple bootloaders of +# different sizes, comment this out, and the correct address will be loaded +# automatically (+60). See bootloader.mk for all options. +BOOTLOADER = bootloadHID + +# build options +BOOTMAGIC_ENABLE = yes +MOUSEKEY_ENABLE = yes +EXTRAKEY_ENABLE = yes +CONSOLE_ENABLE = yes +COMMAND_ENABLE = yes +BACKLIGHT_ENABLE = yes +RGBLIGHT_ENABLE = yes +RGBLIGHT_CUSTOM_DRIVER = yes + +OPT_DEFS = -DDEBUG_LEVEL=0 + +# custom matrix setup +CUSTOM_MATRIX = yes +SRC = matrix.c i2c.c + +# programming options +PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex diff --git a/keyboards/jc65/v32a/usbconfig.h b/keyboards/jc65/v32a/usbconfig.h new file mode 100644 index 00000000..d2d848fc --- /dev/null +++ b/keyboards/jc65/v32a/usbconfig.h @@ -0,0 +1,396 @@ +/* Name: usbconfig.h + * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers + * Author: Christian Starkjohann + * Creation Date: 2005-04-01 + * Tabsize: 4 + * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH + * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) + * This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $ + */ + +#ifndef __usbconfig_h_included__ +#define __usbconfig_h_included__ + +#include "config.h" + +/* +General Description: +This file is an example configuration (with inline documentation) for the USB +driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is +also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may +wire the lines to any other port, as long as D+ is also wired to INT0 (or any +other hardware interrupt, as long as it is the highest level interrupt, see +section at the end of this file). +*/ + +/* ---------------------------- Hardware Config ---------------------------- */ + +#define USB_CFG_IOPORTNAME D +/* This is the port where the USB bus is connected. When you configure it to + * "B", the registers PORTB, PINB and DDRB will be used. + */ +#define USB_CFG_DMINUS_BIT 3 +/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. + * This may be any bit in the port. + */ +#define USB_CFG_DPLUS_BIT 2 +/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. + * This may be any bit in the port. Please note that D+ must also be connected + * to interrupt pin INT0! [You can also use other interrupts, see section + * "Optional MCU Description" below, or you can connect D- to the interrupt, as + * it is required if you use the USB_COUNT_SOF feature. If you use D- for the + * interrupt, the USB interrupt will also be triggered at Start-Of-Frame + * markers every millisecond.] + */ +#define USB_CFG_CLOCK_KHZ (F_CPU/1000) +/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000, + * 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code + * require no crystal, they tolerate +/- 1% deviation from the nominal + * frequency. All other rates require a precision of 2000 ppm and thus a + * crystal! + * Since F_CPU should be defined to your actual clock rate anyway, you should + * not need to modify this setting. + */ +#define USB_CFG_CHECK_CRC 0 +/* Define this to 1 if you want that the driver checks integrity of incoming + * data packets (CRC checks). CRC checks cost quite a bit of code size and are + * currently only available for 18 MHz crystal clock. You must choose + * USB_CFG_CLOCK_KHZ = 18000 if you enable this option. + */ + +/* ----------------------- Optional Hardware Config ------------------------ */ + +/* #define USB_CFG_PULLUP_IOPORTNAME D */ +/* If you connect the 1.5k pullup resistor from D- to a port pin instead of + * V+, you can connect and disconnect the device from firmware by calling + * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h). + * This constant defines the port on which the pullup resistor is connected. + */ +/* #define USB_CFG_PULLUP_BIT 4 */ +/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined + * above) where the 1.5k pullup resistor is connected. See description + * above for details. + */ + +/* --------------------------- Functional Range ---------------------------- */ + +#define USB_CFG_HAVE_INTRIN_ENDPOINT 1 +/* Define this to 1 if you want to compile a version with two endpoints: The + * default control endpoint 0 and an interrupt-in endpoint (any other endpoint + * number). + */ +#define USB_CFG_HAVE_INTRIN_ENDPOINT3 1 +/* Define this to 1 if you want to compile a version with three endpoints: The + * default control endpoint 0, an interrupt-in endpoint 3 (or the number + * configured below) and a catch-all default interrupt-in endpoint as above. + * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature. + */ +#define USB_CFG_EP3_NUMBER 3 +/* If the so-called endpoint 3 is used, it can now be configured to any other + * endpoint number (except 0) with this macro. Default if undefined is 3. + */ +/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */ +/* The above macro defines the startup condition for data toggling on the + * interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1. + * Since the token is toggled BEFORE sending any data, the first packet is + * sent with the oposite value of this configuration! + */ +#define USB_CFG_IMPLEMENT_HALT 0 +/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature + * for endpoint 1 (interrupt endpoint). Although you may not need this feature, + * it is required by the standard. We have made it a config option because it + * bloats the code considerably. + */ +#define USB_CFG_SUPPRESS_INTR_CODE 0 +/* Define this to 1 if you want to declare interrupt-in endpoints, but don't + * want to send any data over them. If this macro is defined to 1, functions + * usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if + * you need the interrupt-in endpoints in order to comply to an interface + * (e.g. HID), but never want to send any data. This option saves a couple + * of bytes in flash memory and the transmit buffers in RAM. + */ +#define USB_CFG_INTR_POLL_INTERVAL 1 +/* If you compile a version with endpoint 1 (interrupt-in), this is the poll + * interval. The value is in milliseconds and must not be less than 10 ms for + * low speed devices. + */ +#define USB_CFG_IS_SELF_POWERED 0 +/* Define this to 1 if the device has its own power supply. Set it to 0 if the + * device is powered from the USB bus. + */ +#define USB_CFG_MAX_BUS_POWER 500 +/* Set this variable to the maximum USB bus power consumption of your device. + * The value is in milliamperes. [It will be divided by two since USB + * communicates power requirements in units of 2 mA.] + */ +#define USB_CFG_IMPLEMENT_FN_WRITE 1 +/* Set this to 1 if you want usbFunctionWrite() to be called for control-out + * transfers. Set it to 0 if you don't need it and want to save a couple of + * bytes. + */ +#define USB_CFG_IMPLEMENT_FN_READ 0 +/* Set this to 1 if you need to send control replies which are generated + * "on the fly" when usbFunctionRead() is called. If you only want to send + * data from a static buffer, set it to 0 and return the data from + * usbFunctionSetup(). This saves a couple of bytes. + */ +#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0 +/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints. + * You must implement the function usbFunctionWriteOut() which receives all + * interrupt/bulk data sent to any endpoint other than 0. The endpoint number + * can be found in 'usbRxToken'. + */ +#define USB_CFG_HAVE_FLOWCONTROL 0 +/* Define this to 1 if you want flowcontrol over USB data. See the definition + * of the macros usbDisableAllRequests() and usbEnableAllRequests() in + * usbdrv.h. + */ +#define USB_CFG_DRIVER_FLASH_PAGE 0 +/* If the device has more than 64 kBytes of flash, define this to the 64 k page + * where the driver's constants (descriptors) are located. Or in other words: + * Define this to 1 for boot loaders on the ATMega128. + */ +#define USB_CFG_LONG_TRANSFERS 0 +/* Define this to 1 if you want to send/receive blocks of more than 254 bytes + * in a single control-in or control-out transfer. Note that the capability + * for long transfers increases the driver size. + */ +/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */ +/* This macro is a hook if you want to do unconventional things. If it is + * defined, it's inserted at the beginning of received message processing. + * If you eat the received message and don't want default processing to + * proceed, do a return after doing your things. One possible application + * (besides debugging) is to flash a status LED on each packet. + */ +/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */ +/* This macro is a hook if you need to know when an USB RESET occurs. It has + * one parameter which distinguishes between the start of RESET state and its + * end. + */ +/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */ +/* This macro (if defined) is executed when a USB SET_ADDRESS request was + * received. + */ +#define USB_COUNT_SOF 1 +/* define this macro to 1 if you need the global variable "usbSofCount" which + * counts SOF packets. This feature requires that the hardware interrupt is + * connected to D- instead of D+. + */ +/* #ifdef __ASSEMBLER__ + * macro myAssemblerMacro + * in YL, TCNT0 + * sts timer0Snapshot, YL + * endm + * #endif + * #define USB_SOF_HOOK myAssemblerMacro + * This macro (if defined) is executed in the assembler module when a + * Start Of Frame condition is detected. It is recommended to define it to + * the name of an assembler macro which is defined here as well so that more + * than one assembler instruction can be used. The macro may use the register + * YL and modify SREG. If it lasts longer than a couple of cycles, USB messages + * immediately after an SOF pulse may be lost and must be retried by the host. + * What can you do with this hook? Since the SOF signal occurs exactly every + * 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in + * designs running on the internal RC oscillator. + * Please note that Start Of Frame detection works only if D- is wired to the + * interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES! + */ +#define USB_CFG_CHECK_DATA_TOGGLING 0 +/* define this macro to 1 if you want to filter out duplicate data packets + * sent by the host. Duplicates occur only as a consequence of communication + * errors, when the host does not receive an ACK. Please note that you need to + * implement the filtering yourself in usbFunctionWriteOut() and + * usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable + * for each control- and out-endpoint to check for duplicate packets. + */ +#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0 +/* define this macro to 1 if you want the function usbMeasureFrameLength() + * compiled in. This function can be used to calibrate the AVR's RC oscillator. + */ +#define USB_USE_FAST_CRC 0 +/* The assembler module has two implementations for the CRC algorithm. One is + * faster, the other is smaller. This CRC routine is only used for transmitted + * messages where timing is not critical. The faster routine needs 31 cycles + * per byte while the smaller one needs 61 to 69 cycles. The faster routine + * may be worth the 32 bytes bigger code size if you transmit lots of data and + * run the AVR close to its limit. + */ + +/* -------------------------- Device Description --------------------------- */ + +#define USB_CFG_VENDOR_ID (VENDOR_ID & 0xFF), ((VENDOR_ID >> 8) & 0xFF) +/* USB vendor ID for the device, low byte first. If you have registered your + * own Vendor ID, define it here. Otherwise you may use one of obdev's free + * shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules! + * *** IMPORTANT NOTE *** + * This template uses obdev's shared VID/PID pair for Vendor Class devices + * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand + * the implications! + */ +#define USB_CFG_DEVICE_ID (PRODUCT_ID & 0xFF), ((PRODUCT_ID >> 8) & 0xFF) +/* This is the ID of the product, low byte first. It is interpreted in the + * scope of the vendor ID. If you have registered your own VID with usb.org + * or if you have licensed a PID from somebody else, define it here. Otherwise + * you may use one of obdev's free shared VID/PID pairs. See the file + * USB-IDs-for-free.txt for details! + * *** IMPORTANT NOTE *** + * This template uses obdev's shared VID/PID pair for Vendor Class devices + * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand + * the implications! + */ +#define USB_CFG_DEVICE_VERSION 0x00, 0x02 +/* Version number of the device: Minor number first, then major number. + */ +#define USB_CFG_VENDOR_NAME 'w', 'i', 'n', 'k', 'e', 'y', 'l', 'e', 's', 's', '.', 'k', 'r' +#define USB_CFG_VENDOR_NAME_LEN 13 +/* These two values define the vendor name returned by the USB device. The name + * must be given as a list of characters under single quotes. The characters + * are interpreted as Unicode (UTF-16) entities. + * If you don't want a vendor name string, undefine these macros. + * ALWAYS define a vendor name containing your Internet domain name if you use + * obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for + * details. + */ +#define USB_CFG_DEVICE_NAME 'p', 's', '2', 'a', 'v', 'r', 'G', 'B' +#define USB_CFG_DEVICE_NAME_LEN 8 +/* Same as above for the device name. If you don't want a device name, undefine + * the macros. See the file USB-IDs-for-free.txt before you assign a name if + * you use a shared VID/PID. + */ +/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */ +/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */ +/* Same as above for the serial number. If you don't want a serial number, + * undefine the macros. + * It may be useful to provide the serial number through other means than at + * compile time. See the section about descriptor properties below for how + * to fine tune control over USB descriptors such as the string descriptor + * for the serial number. + */ +#define USB_CFG_DEVICE_CLASS 0 +#define USB_CFG_DEVICE_SUBCLASS 0 +/* See USB specification if you want to conform to an existing device class. + * Class 0xff is "vendor specific". + */ +#define USB_CFG_INTERFACE_CLASS 3 /* HID */ +#define USB_CFG_INTERFACE_SUBCLASS 1 /* Boot */ +#define USB_CFG_INTERFACE_PROTOCOL 1 /* Keyboard */ +/* See USB specification if you want to conform to an existing device class or + * protocol. The following classes must be set at interface level: + * HID class is 3, no subclass and protocol required (but may be useful!) + * CDC class is 2, use subclass 2 and protocol 1 for ACM + */ +#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0 +/* Define this to the length of the HID report descriptor, if you implement + * an HID device. Otherwise don't define it or define it to 0. + * If you use this define, you must add a PROGMEM character array named + * "usbHidReportDescriptor" to your code which contains the report descriptor. + * Don't forget to keep the array and this define in sync! + */ + +/* #define USB_PUBLIC static */ +/* Use the define above if you #include usbdrv.c instead of linking against it. + * This technique saves a couple of bytes in flash memory. + */ + +/* ------------------- Fine Control over USB Descriptors ------------------- */ +/* If you don't want to use the driver's default USB descriptors, you can + * provide our own. These can be provided as (1) fixed length static data in + * flash memory, (2) fixed length static data in RAM or (3) dynamically at + * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more + * information about this function. + * Descriptor handling is configured through the descriptor's properties. If + * no properties are defined or if they are 0, the default descriptor is used. + * Possible properties are: + * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched + * at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is + * used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if + * you want RAM pointers. + * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found + * in static memory is in RAM, not in flash memory. + * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash), + * the driver must know the descriptor's length. The descriptor itself is + * found at the address of a well known identifier (see below). + * List of static descriptor names (must be declared PROGMEM if in flash): + * char usbDescriptorDevice[]; + * char usbDescriptorConfiguration[]; + * char usbDescriptorHidReport[]; + * char usbDescriptorString0[]; + * int usbDescriptorStringVendor[]; + * int usbDescriptorStringDevice[]; + * int usbDescriptorStringSerialNumber[]; + * Other descriptors can't be provided statically, they must be provided + * dynamically at runtime. + * + * Descriptor properties are or-ed or added together, e.g.: + * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18)) + * + * The following descriptors are defined: + * USB_CFG_DESCR_PROPS_DEVICE + * USB_CFG_DESCR_PROPS_CONFIGURATION + * USB_CFG_DESCR_PROPS_STRINGS + * USB_CFG_DESCR_PROPS_STRING_0 + * USB_CFG_DESCR_PROPS_STRING_VENDOR + * USB_CFG_DESCR_PROPS_STRING_PRODUCT + * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER + * USB_CFG_DESCR_PROPS_HID + * USB_CFG_DESCR_PROPS_HID_REPORT + * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver) + * + * Note about string descriptors: String descriptors are not just strings, they + * are Unicode strings prefixed with a 2 byte header. Example: + * int serialNumberDescriptor[] = { + * USB_STRING_DESCRIPTOR_HEADER(6), + * 'S', 'e', 'r', 'i', 'a', 'l' + * }; + */ + +#define USB_CFG_DESCR_PROPS_DEVICE 0 +#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC +//#define USB_CFG_DESCR_PROPS_CONFIGURATION 0 +#define USB_CFG_DESCR_PROPS_STRINGS 0 +#define USB_CFG_DESCR_PROPS_STRING_0 0 +#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0 +#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0 +#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0 +#define USB_CFG_DESCR_PROPS_HID USB_PROP_IS_DYNAMIC +//#define USB_CFG_DESCR_PROPS_HID 0 +#define USB_CFG_DESCR_PROPS_HID_REPORT USB_PROP_IS_DYNAMIC +//#define USB_CFG_DESCR_PROPS_HID_REPORT 0 +#define USB_CFG_DESCR_PROPS_UNKNOWN 0 + +#define usbMsgPtr_t unsigned short +/* If usbMsgPtr_t is not defined, it defaults to 'uchar *'. We define it to + * a scalar type here because gcc generates slightly shorter code for scalar + * arithmetics than for pointer arithmetics. Remove this define for backward + * type compatibility or define it to an 8 bit type if you use data in RAM only + * and all RAM is below 256 bytes (tiny memory model in IAR CC). + */ + +/* ----------------------- Optional MCU Description ------------------------ */ + +/* The following configurations have working defaults in usbdrv.h. You + * usually don't need to set them explicitly. Only if you want to run + * the driver on a device which is not yet supported or with a compiler + * which is not fully supported (such as IAR C) or if you use a differnt + * interrupt than INT0, you may have to define some of these. + */ +/* #define USB_INTR_CFG MCUCR */ +/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */ +/* #define USB_INTR_CFG_CLR 0 */ +/* #define USB_INTR_ENABLE GIMSK */ +/* #define USB_INTR_ENABLE_BIT INT0 */ +/* #define USB_INTR_PENDING GIFR */ +/* #define USB_INTR_PENDING_BIT INTF0 */ +/* #define USB_INTR_VECTOR INT0_vect */ + +/* Set INT1 for D- falling edge to count SOF */ +/* #define USB_INTR_CFG EICRA */ +#define USB_INTR_CFG_SET ((1 << ISC11) | (0 << ISC10)) +/* #define USB_INTR_CFG_CLR 0 */ +/* #define USB_INTR_ENABLE EIMSK */ +#define USB_INTR_ENABLE_BIT INT1 +/* #define USB_INTR_PENDING EIFR */ +#define USB_INTR_PENDING_BIT INTF1 +#define USB_INTR_VECTOR INT1_vect + +#endif /* __usbconfig_h_included__ */ diff --git a/keyboards/jc65/v32a/v32a.c b/keyboards/jc65/v32a/v32a.c new file mode 100644 index 00000000..62178942 --- /dev/null +++ b/keyboards/jc65/v32a/v32a.c @@ -0,0 +1,65 @@ +/* +Copyright 2017 Luiz Ribeiro + +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 "v32a.h" +#ifdef BACKLIGHT_ENABLE +#include "backlight.h" +#endif +#ifdef RGBLIGHT_ENABLE +#include "rgblight.h" +#endif + +#include + +#include "action_layer.h" +#include "i2c.h" +#include "quantum.h" + +extern rgblight_config_t rgblight_config; + +void rgblight_set(void) { + if (!rgblight_config.enable) { + for (uint8_t i = 0; i < RGBLED_NUM; i++) { + led[i].r = 0; + led[i].g = 0; + led[i].b = 0; + } + } + + i2c_init(); + i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { + rgblight_task(); +} + +void backlight_init_ports(void) { + DDRD |= (1<<0 | 1<<1 | 1<<4 | 1<<6); + PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6); +} + +void backlight_set(uint8_t level) { + if (level == 0) { + // Turn out the lights + PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6); + } else { + // Turn on the lights + PORTD |= (1<<0 | 1<<1 | 1<<4 | 1<<6); + } +} \ No newline at end of file diff --git a/keyboards/jc65/v32a/v32a.h b/keyboards/jc65/v32a/v32a.h new file mode 100644 index 00000000..00464141 --- /dev/null +++ b/keyboards/jc65/v32a/v32a.h @@ -0,0 +1,58 @@ +/* +Copyright 2017 Luiz Ribeiro + +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 V32A_H +#define V32A_H + +#include "quantum.h" + +#define KEYMAP( \ + K04,K14,K24,K34,K44,K54,K16,KB6,KB7,K17,KA4,KB4,KC4,KD4,KE4,KD0, \ + K03,K13,K23,K33,K43,K53,K26,KC6,KC7,K27,KA3,KB3,KC3, KD3,K67, \ + K02,K12,K22,K32,K42,K52,K36,KD6,KD7,K37,KA2,KB2,KC2, KD2,K87, \ + K01,K30,K11,K21,K31,K41,K51,K46,KE6,KE7,K47,KA1, KB1,K86,K77, \ + K00,K10,K20, K40,K56,K50, K57,KB0,KC0,K96,K76,K66 \ +){ \ + { K00, K10, K20, K30, K40, K50,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO, KB0, KC0, KD0,KC_NO,KC_NO }, \ + { K01, K11, K21, K31, K41, K51,KC_NO,KC_NO,KC_NO,KC_NO, KA1, KB1,KC_NO,KC_NO,KC_NO,KC_NO }, \ + { K02, K12, K22, K32, K42, K52,KC_NO,KC_NO,KC_NO,KC_NO, KA2, KB2, KC2, KD2,KC_NO,KC_NO }, \ + { K03, K13, K23, K33, K43, K53,KC_NO,KC_NO,KC_NO,KC_NO, KA3, KB3, KC3, KD3,KC_NO,KC_NO }, \ + { K04, K14, K24, K34, K44, K54,KC_NO,KC_NO,KC_NO,KC_NO, KA4, KB4, KC4, KD4, KE4,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, K16, K26, K36, K46, K56, K66, K76, K86, K96,KC_NO, KB6, KC6, KD6, KE6,KC_NO }, \ + { KC_NO, K17, K27, K37, K47, K57, K67, K77, K87,KC_NO,KC_NO, KB7, KC7, KD7, KE7,KC_NO } \ +} + +#define KC_KEYMAP( \ + K04,K14,K24,K34,K44,K54,K16,KB6,KB7,K17,KA4,KB4,KC4,KD4,KE4,KD0, \ + K03,K13,K23,K33,K43,K53,K26,KC6,KC7,K27,KA3,KB3,KC3, KD3,K67, \ + K02,K12,K22,K32,K42,K52,K36,KD6,KD7,K37,KA2,KB2,KC2, KD2,K87, \ + K01,K30,K11,K21,K31,K41,K51,K46,KE6,KE7,K47,KA1, KB1,K86,K77, \ + K00,K10,K20, K40,K56,K50, K57,KB0,KC0,K96,K76,K66 \ +) \ +{ \ + { KC_##K00,KC_##K10,KC_##K20,KC_##K30,KC_##K40,KC_##K50, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,KC_##KB0,KC_##KC0,KC_##KD0, KC_NO,KC_NO }, \ + { KC_##K01,KC_##K11,KC_##K21,KC_##K31,KC_##K41,KC_##K51, KC_NO, KC_NO, KC_NO, KC_NO,KC_##KA1,KC_##KB1, KC_NO, KC_NO, KC_NO,KC_NO }, \ + { KC_##K02,KC_##K12,KC_##K22,KC_##K32,KC_##K42,KC_##K52, KC_NO, KC_NO, KC_NO, KC_NO,KC_##KA2,KC_##KB2,KC_##KC2,KC_##KD2, KC_NO,KC_NO }, \ + { KC_##K03,KC_##K13,KC_##K23,KC_##K33,KC_##K43,KC_##K53, KC_NO, KC_NO, KC_NO, KC_NO,KC_##KA3,KC_##KB3,KC_##KC3,KC_##KD3, KC_NO,KC_NO }, \ + { KC_##K04,KC_##K14,KC_##K24,KC_##K34,KC_##K44,KC_##K54, KC_NO, KC_NO, KC_NO, KC_NO,KC_##KA4,KC_##KB4,KC_##KC4,KC_##KD4,KC_##KE4,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,KC_##K16,KC_##K26,KC_##K36,KC_##K46,KC_##K56,KC_##K66,KC_##K76,KC_##K86,KC_##K96, KC_NO,KC_##KB6,KC_##KC6,KC_##KD6,KC_##KE6,KC_NO }, \ + { KC_NO,KC_##K17,KC_##K27,KC_##K37,KC_##K47,KC_##K57,KC_##K67,KC_##K77,KC_##K87, KC_NO, KC_NO,KC_##KB7,KC_##KC7,KC_##KD7,KC_##KE7,KC_NO } \ +} + +#endif diff --git a/keyboards/jc65/config.h b/keyboards/jc65/v32u4/config.h similarity index 100% rename from keyboards/jc65/config.h rename to keyboards/jc65/v32u4/config.h diff --git a/keyboards/jc65/keymaps/coth/config.h b/keyboards/jc65/v32u4/keymaps/coth/config.h similarity index 100% rename from keyboards/jc65/keymaps/coth/config.h rename to keyboards/jc65/v32u4/keymaps/coth/config.h diff --git a/keyboards/jc65/keymaps/coth/keymap.c b/keyboards/jc65/v32u4/keymaps/coth/keymap.c similarity index 99% rename from keyboards/jc65/keymaps/coth/keymap.c rename to keyboards/jc65/v32u4/keymaps/coth/keymap.c index be7a98b8..d6c1dacf 100644 --- a/keyboards/jc65/keymaps/coth/keymap.c +++ b/keyboards/jc65/v32u4/keymaps/coth/keymap.c @@ -1,4 +1,4 @@ -#include "jc65.h" +#include "v32u4.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = KEYMAP( diff --git a/keyboards/jc65/keymaps/coth/readme.md b/keyboards/jc65/v32u4/keymaps/coth/readme.md similarity index 100% rename from keyboards/jc65/keymaps/coth/readme.md rename to keyboards/jc65/v32u4/keymaps/coth/readme.md diff --git a/keyboards/jc65/keymaps/coth/rules.mk b/keyboards/jc65/v32u4/keymaps/coth/rules.mk similarity index 100% rename from keyboards/jc65/keymaps/coth/rules.mk rename to keyboards/jc65/v32u4/keymaps/coth/rules.mk diff --git a/keyboards/jc65/keymaps/default/config.h b/keyboards/jc65/v32u4/keymaps/default/config.h similarity index 100% rename from keyboards/jc65/keymaps/default/config.h rename to keyboards/jc65/v32u4/keymaps/default/config.h diff --git a/keyboards/jc65/keymaps/default/keymap.c b/keyboards/jc65/v32u4/keymaps/default/keymap.c similarity index 97% rename from keyboards/jc65/keymaps/default/keymap.c rename to keyboards/jc65/v32u4/keymaps/default/keymap.c index de787f38..9c9e0f1f 100644 --- a/keyboards/jc65/keymaps/default/keymap.c +++ b/keyboards/jc65/v32u4/keymaps/default/keymap.c @@ -1,4 +1,4 @@ -#include "jc65.h" +#include "v32u4.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = KEYMAP( diff --git a/keyboards/jc65/keymaps/default/readme.md b/keyboards/jc65/v32u4/keymaps/default/readme.md similarity index 100% rename from keyboards/jc65/keymaps/default/readme.md rename to keyboards/jc65/v32u4/keymaps/default/readme.md diff --git a/keyboards/jc65/keymaps/default/rules.mk b/keyboards/jc65/v32u4/keymaps/default/rules.mk similarity index 100% rename from keyboards/jc65/keymaps/default/rules.mk rename to keyboards/jc65/v32u4/keymaps/default/rules.mk diff --git a/keyboards/jc65/keymaps/jetpacktuxedo/config.h b/keyboards/jc65/v32u4/keymaps/jetpacktuxedo/config.h similarity index 100% rename from keyboards/jc65/keymaps/jetpacktuxedo/config.h rename to keyboards/jc65/v32u4/keymaps/jetpacktuxedo/config.h diff --git a/keyboards/jc65/keymaps/jetpacktuxedo/keymap.c b/keyboards/jc65/v32u4/keymaps/jetpacktuxedo/keymap.c similarity index 99% rename from keyboards/jc65/keymaps/jetpacktuxedo/keymap.c rename to keyboards/jc65/v32u4/keymaps/jetpacktuxedo/keymap.c index af02b6f1..451b4312 100644 --- a/keyboards/jc65/keymaps/jetpacktuxedo/keymap.c +++ b/keyboards/jc65/v32u4/keymaps/jetpacktuxedo/keymap.c @@ -1,4 +1,4 @@ -#include "jc65.h" +#include "v32u4.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = KEYMAP( diff --git a/keyboards/jc65/keymaps/jetpacktuxedo/readme.md b/keyboards/jc65/v32u4/keymaps/jetpacktuxedo/readme.md similarity index 100% rename from keyboards/jc65/keymaps/jetpacktuxedo/readme.md rename to keyboards/jc65/v32u4/keymaps/jetpacktuxedo/readme.md diff --git a/keyboards/jc65/keymaps/jetpacktuxedo/rules.mk b/keyboards/jc65/v32u4/keymaps/jetpacktuxedo/rules.mk similarity index 100% rename from keyboards/jc65/keymaps/jetpacktuxedo/rules.mk rename to keyboards/jc65/v32u4/keymaps/jetpacktuxedo/rules.mk diff --git a/keyboards/jc65/keymaps/na7thana/config.h b/keyboards/jc65/v32u4/keymaps/na7thana/config.h similarity index 100% rename from keyboards/jc65/keymaps/na7thana/config.h rename to keyboards/jc65/v32u4/keymaps/na7thana/config.h diff --git a/keyboards/jc65/keymaps/na7thana/keymap.c b/keyboards/jc65/v32u4/keymaps/na7thana/keymap.c similarity index 98% rename from keyboards/jc65/keymaps/na7thana/keymap.c rename to keyboards/jc65/v32u4/keymaps/na7thana/keymap.c index 2f262efa..2e61e95d 100644 --- a/keyboards/jc65/keymaps/na7thana/keymap.c +++ b/keyboards/jc65/v32u4/keymaps/na7thana/keymap.c @@ -1,4 +1,4 @@ -#include "jc65.h" +#include "v32u4.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = KEYMAP( diff --git a/keyboards/jc65/keymaps/na7thana/readme.md b/keyboards/jc65/v32u4/keymaps/na7thana/readme.md similarity index 100% rename from keyboards/jc65/keymaps/na7thana/readme.md rename to keyboards/jc65/v32u4/keymaps/na7thana/readme.md diff --git a/keyboards/jc65/keymaps/na7thana/rules.mk b/keyboards/jc65/v32u4/keymaps/na7thana/rules.mk similarity index 100% rename from keyboards/jc65/keymaps/na7thana/rules.mk rename to keyboards/jc65/v32u4/keymaps/na7thana/rules.mk diff --git a/keyboards/jc65/v32u4/readme.md b/keyboards/jc65/v32u4/readme.md new file mode 100644 index 00000000..c6a2b2b8 --- /dev/null +++ b/keyboards/jc65/v32u4/readme.md @@ -0,0 +1,22 @@ +JC65 +=== + +![JC65](https://imgur.com/a/C2oa5) + +The JC65 PCB actually has two revisions: A QMK native version, and a PS2AVRGB version. Jchan offered both PCBs as options during the M65-A Round 1 group buy, and were also available choices for the 65% acrylic case group buy. In the near future both PCB versions should be available from keyclack.com when the storefront part opens. + +These docs are for the QMK version of the PCB. [More info on qmk.fm](http://qmk.fm/planck/) + +Keyboard Maintainer: [Ethan Madden](https://github.com/jetpacktuxedo) +Hardware Supported: JC65 rev.qmk +Hardware Availability: [keyclack.com](https://keyclack.com/) + +Make example for this keyboard (after setting up your build environment): + + make jc65/v32u4:default + +Or to make and flash: + + make jc65/v32u4:default:dfu + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. diff --git a/keyboards/jc65/v32u4/rules.mk b/keyboards/jc65/v32u4/rules.mk new file mode 100644 index 00000000..c2c02b61 --- /dev/null +++ b/keyboards/jc65/v32u4/rules.mk @@ -0,0 +1,68 @@ +# MCU name +#MCU = at90usb1287 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default +RGBLIGHT_ENABLE = yes +MIDI_ENABLE = no # MIDI controls +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 diff --git a/keyboards/jc65/v32u4/v32u4.c b/keyboards/jc65/v32u4/v32u4.c new file mode 100644 index 00000000..c69c5d53 --- /dev/null +++ b/keyboards/jc65/v32u4/v32u4.c @@ -0,0 +1,36 @@ +#include "v32u4.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + + matrix_init_user(); +} + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + + matrix_scan_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware + + return process_record_user(keycode, record); +} + +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + if (usb_led & (1< Date: Sun, 4 Feb 2018 15:05:22 -0800 Subject: [PATCH 077/173] Added raylas keymap for TADA68 --- keyboards/tada68/keymaps/raylas/keymap.c | 52 +++++++++++++++++++++++ keyboards/tada68/keymaps/raylas/readme.md | 6 +++ keyboards/tada68/keymaps/raylas/rules.mk | 21 +++++++++ 3 files changed, 79 insertions(+) create mode 100755 keyboards/tada68/keymaps/raylas/keymap.c create mode 100755 keyboards/tada68/keymaps/raylas/readme.md create mode 100644 keyboards/tada68/keymaps/raylas/rules.mk diff --git a/keyboards/tada68/keymaps/raylas/keymap.c b/keyboards/tada68/keymaps/raylas/keymap.c new file mode 100755 index 00000000..2f25a861 --- /dev/null +++ b/keyboards/tada68/keymaps/raylas/keymap.c @@ -0,0 +1,52 @@ +#include "tada68.h" + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _BL 0 +#define _FL 1 + +#define _______ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap _BL: (Base Layer) Default Layer + * ,----------------------------------------------------------------. + * |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |~ ` | + * |----------------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |Del | + * |----------------------------------------------------------------| + * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return |PgUp| + * |----------------------------------------------------------------| + * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | Up|PgDn| + * |----------------------------------------------------------------| + * |Ctrl|Alt |Cmd | Space | FN|Ctrl|Alt|Lef|Dow|Rig | + * `----------------------------------------------------------------' + */ +[_BL] = KEYMAP_ANSI( + 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,KC_GRV, \ + KC_TAB, 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,KC_DEL, \ + KC_CAPS, 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_PGUP, \ + 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_UP,KC_PGDN, \ + KC_LCTL, KC_LALT,KC_LGUI, KC_SPC, MO(_FL),KC_RCTRL,KC_RALT, KC_LEFT,KC_DOWN,KC_RGHT), + + /* Keymap _FL: Function Layer + * ,----------------------------------------------------------------. + * | ~ | F1|F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Del |Ins | + * |----------------------------------------------------------------| + * | | |Up | | | | | | | | | | | |Hme | + * |----------------------------------------------------------------| + * | |<- |Dn | ->| | | | | | | | | |End | + * |----------------------------------------------------------------| + * | | | |Bl-|BL |BL+| |VU-|VU+|MUT| | McL|MsU|McR | + * |----------------------------------------------------------------| + * | | | | | | | |MsL|MsD|MsR | + * `----------------------------------------------------------------' + */ +[_FL] = KEYMAP_ANSI( + KC_TILDE,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_INS , \ + _______,_______, KC_UP,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,KC_HOME, \ + _______,KC_LEFT,KC_DOWN,KC_RIGHT,_______,_______,_______,_______,_______,_______,_______,_______, _______,KC_END, \ + _______,_______,_______,BL_DEC, BL_TOGG,BL_INC, _______,KC_VOLD,KC_VOLU,KC_MUTE,_______,KC_BTN1, KC_MS_U, KC_BTN2, \ + _______,_______,_______, _______, _______,_______,_______,KC_MS_L,KC_MS_D, KC_MS_R), +}; diff --git a/keyboards/tada68/keymaps/raylas/readme.md b/keyboards/tada68/keymaps/raylas/readme.md new file mode 100755 index 00000000..aaec1258 --- /dev/null +++ b/keyboards/tada68/keymaps/raylas/readme.md @@ -0,0 +1,6 @@ +![TADA68 layout image](https://i.imgur.com/cV9niMC.jpg) + +# raylas's TADA68 layout + +A layout with some bottom row key swapping to accomadate macOS a little more, whilst keeping the TADA68 quirks alive. +- Also added a function-accessed tilde to the Esc key diff --git a/keyboards/tada68/keymaps/raylas/rules.mk b/keyboards/tada68/keymaps/raylas/rules.mk new file mode 100644 index 00000000..2a7ff277 --- /dev/null +++ b/keyboards/tada68/keymaps/raylas/rules.mk @@ -0,0 +1,21 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif From cd0c089b49c1b6e5b0fb13491935f278e9c1986f Mon Sep 17 00:00:00 2001 From: IslandMan93 Date: Sun, 4 Feb 2018 16:50:49 -0500 Subject: [PATCH 078/173] Diverge 3 initial commit woo it works use lets split code Final working. Uses serial Update license --- keyboards/diverge3/config.h | 192 +++++++++++++++++++ keyboards/diverge3/diverge3.c | 16 ++ keyboards/diverge3/diverge3.h | 51 +++++ keyboards/diverge3/keymaps/default/config.h | 27 +++ keyboards/diverge3/keymaps/default/keymap.c | 161 ++++++++++++++++ keyboards/diverge3/keymaps/default/readme.md | 6 + keyboards/diverge3/keymaps/default/rules.mk | 1 + keyboards/diverge3/readme.md | 16 ++ keyboards/diverge3/rules.mk | 73 +++++++ 9 files changed, 543 insertions(+) create mode 100644 keyboards/diverge3/config.h create mode 100644 keyboards/diverge3/diverge3.c create mode 100644 keyboards/diverge3/diverge3.h create mode 100644 keyboards/diverge3/keymaps/default/config.h create mode 100644 keyboards/diverge3/keymaps/default/keymap.c create mode 100644 keyboards/diverge3/keymaps/default/readme.md create mode 100644 keyboards/diverge3/keymaps/default/rules.mk create mode 100644 keyboards/diverge3/readme.md create mode 100644 keyboards/diverge3/rules.mk diff --git a/keyboards/diverge3/config.h b/keyboards/diverge3/config.h new file mode 100644 index 00000000..db3c6a6f --- /dev/null +++ b/keyboards/diverge3/config.h @@ -0,0 +1,192 @@ +/* +Copyright 2017 IslandMan93 + +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 CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x1257 +#define DEVICE_VER 0x0001 +#define MANUFACTURER UniKeyboard +#define PRODUCT diverge3 +#define DESCRIPTION Split 72 key keyboard + +/* key matrix size */ +#define MATRIX_ROWS 10 +#define MATRIX_COLS 8 +// SERIAL is the only supported +#define USE_SERIAL + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ +#define MATRIX_ROW_PINS { D4, D7, E6, B4, B5 } +#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2, B6 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ +#define DIODE_DIRECTION ROW2COL + +// #define BACKLIGHT_PIN B7 +// #define BACKLIGHT_BREATHING +// #define BACKLIGHT_LEVELS 3 + + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. + * This is userful for the Windows task manager shortcut (ctrl+shift+esc). + */ +// #define GRAVE_ESC_CTRL_OVERRIDE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Magic Key Options + * + * Magic keys are hotkey commands that allow control over firmware functions of + * the keyboard. They are best used in combination with the HID Listen program, + * found here: https://www.pjrc.com/teensy/hid_listen.html + * + * The options below allow the magic key functionality to be changed. This is + * useful if your keyboard/keypad is missing keys and you want magic key support. + * + */ + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* control how magic key switches layers */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false + +/* override magic key keymap */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM +//#define MAGIC_KEY_HELP1 H +//#define MAGIC_KEY_HELP2 SLASH +//#define MAGIC_KEY_DEBUG D +//#define MAGIC_KEY_DEBUG_MATRIX X +//#define MAGIC_KEY_DEBUG_KBD K +//#define MAGIC_KEY_DEBUG_MOUSE M +//#define MAGIC_KEY_VERSION V +//#define MAGIC_KEY_STATUS S +//#define MAGIC_KEY_CONSOLE C +//#define MAGIC_KEY_LAYER0_ALT1 ESC +//#define MAGIC_KEY_LAYER0_ALT2 GRAVE +//#define MAGIC_KEY_LAYER0 0 +//#define MAGIC_KEY_LAYER1 1 +//#define MAGIC_KEY_LAYER2 2 +//#define MAGIC_KEY_LAYER3 3 +//#define MAGIC_KEY_LAYER4 4 +//#define MAGIC_KEY_LAYER5 5 +//#define MAGIC_KEY_LAYER6 6 +//#define MAGIC_KEY_LAYER7 7 +//#define MAGIC_KEY_LAYER8 8 +//#define MAGIC_KEY_LAYER9 9 +//#define MAGIC_KEY_BOOTLOADER PAUSE +//#define MAGIC_KEY_LOCK CAPS +//#define MAGIC_KEY_EEPROM E +//#define MAGIC_KEY_NKRO N +//#define MAGIC_KEY_SLEEP_LED Z + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ +//#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 1 + +#endif diff --git a/keyboards/diverge3/diverge3.c b/keyboards/diverge3/diverge3.c new file mode 100644 index 00000000..4143b142 --- /dev/null +++ b/keyboards/diverge3/diverge3.c @@ -0,0 +1,16 @@ +/* Copyright 2017 IslandMan93 + * + * 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 "diverge3.h" diff --git a/keyboards/diverge3/diverge3.h b/keyboards/diverge3/diverge3.h new file mode 100644 index 00000000..0d508677 --- /dev/null +++ b/keyboards/diverge3/diverge3.h @@ -0,0 +1,51 @@ +/* Copyright 2017 IslandMan93 + * + * 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 DIVERGE3_H +#define DIVERGE3_H + +#include "quantum.h" + +#ifdef USE_I2C +#include +#ifdef __AVR__ + #include + #include +#endif +#endif + +// This a shortcut to help you visually see your layout. +// The second converts the arguments into a two-dimensional array +// Used to create a keymap using only KC_ prefixed keys +#define KC_KEYMAP( \ + L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06, \ + L10, L11, L12, L13, L14, L15, L16, R10, R11, R12, R13, R14, R15, R16, \ + L20, L21, L22, L23, L24, L25, L26, R20, R21, R22, R23, R24, R25, R26, \ + L30, L31, L32, L33, L34, L35, L36, R30, R31, R32, R33, R34, R35, R36, \ + L40, L41, L42, L43, L44, LT0, LT1, LT2, RT2, RT1, RT0, R40, R41, R42, R43, R44 \ + ) \ + { \ + { KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##L06, KC_NO }, \ + { KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##L16, KC_NO }, \ + { KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##L26, KC_NO }, \ + { KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##L36, KC_NO }, \ + { KC_##L40, KC_##L41, KC_##L42, KC_##L43, KC_##L44, KC_##LT0, KC_##LT1, KC_##LT2 }, \ + { KC_##R06, KC_##R05, KC_##R04, KC_##R03, KC_##R02, KC_##R01, KC_##R00, KC_NO }, \ + { KC_##R16, KC_##R15, KC_##R14, KC_##R13, KC_##R12, KC_##R11, KC_##R10, KC_NO }, \ + { KC_##R26, KC_##R25, KC_##R24, KC_##R23, KC_##R22, KC_##R21, KC_##R20, KC_NO }, \ + { KC_##R36, KC_##R35, KC_##R34, KC_##R33, KC_##R32, KC_##R31, KC_##R30, KC_NO }, \ + { KC_##R44, KC_##R43, KC_##R42, KC_##R41, KC_##R40, KC_##RT0, KC_##RT1, KC_##RT2 } \ + } +#endif diff --git a/keyboards/diverge3/keymaps/default/config.h b/keyboards/diverge3/keymaps/default/config.h new file mode 100644 index 00000000..87ce06b3 --- /dev/null +++ b/keyboards/diverge3/keymaps/default/config.h @@ -0,0 +1,27 @@ +/* Copyright 2017 IslandMan93 + * + * 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 CONFIG_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +// place overrides here +#define MASTER_RIGHT +#define PERMISSIVE_HOLD +#define TAPPING_TERM 150 + +#endif diff --git a/keyboards/diverge3/keymaps/default/keymap.c b/keyboards/diverge3/keymaps/default/keymap.c new file mode 100644 index 00000000..c24a6328 --- /dev/null +++ b/keyboards/diverge3/keymaps/default/keymap.c @@ -0,0 +1,161 @@ +/* Copyright 2017 IslandMan93 + * + * 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 "diverge3.h" +#include "action_layer.h" +#include "eeconfig.h" + +//**************** Definitions needed for quad function to work *********************// +enum { + SE_TAP_DANCE = 0 +}; +//Enums used to clearly convey the state of the tap dance +enum { + SINGLE_TAP = 1, + SINGLE_HOLD = 2, + DOUBLE_TAP = 3, + DOUBLE_HOLD = 4, + DOUBLE_SINGLE_TAP = 5 //send SINGLE_TAP twice - NOT DOUBLE_TAP + // Add more enums here if you want for triple, quadruple, etc. +}; + +typedef struct { + bool is_press_action; + int state; +} tap; + +int cur_dance (qk_tap_dance_state_t *state) { + if (state->count == 1) { + //If count = 1, and it has been interrupted - it doesn't matter if it is pressed or not: Send SINGLE_TAP + if (state->interrupted || state->pressed==0) return SINGLE_TAP; + else return SINGLE_HOLD; + } + //If count = 2, and it has been interrupted - assume that user is trying to type the letter associated + //with single tap. In example below, that means to send `xx` instead of `Escape`. + else if (state->count == 2) { + if (state->interrupted) return DOUBLE_SINGLE_TAP; + else if (state->pressed) return DOUBLE_HOLD; + else return DOUBLE_TAP; + } + else return 6; //magic number. At some point this method will expand to work for more presses +} + +//**************** Definitions needed for quad function to work *********************// +// Backspace Shift TD +//instanalize an instance of 'tap' for the 'x' tap dance. +static tap se_tap_state = { + .is_press_action = true, + .state = 0 +}; + +void se_finished (qk_tap_dance_state_t *state, void *user_data) { + se_tap_state.state = cur_dance(state); + switch (se_tap_state.state) { + case SINGLE_TAP: register_code(KC_SPC); break; + case SINGLE_HOLD: register_code(KC_ENT); break; + default: register_code(KC_SPC); unregister_code(KC_SPC); register_code(KC_SPC); + //Last case is for fast typing. Assuming your key is `f`: + //For example, when typing the word `buffer`, and you want to make sure that you send `ff` and not `Esc`. + //In order to type `ff` when typing fast, the next character will have to be hit within the `TAPPING_TERM`, which by default is 200ms. + } +} + +void se_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (se_tap_state.state) { + case SINGLE_TAP: unregister_code(KC_SPC); break; + case SINGLE_HOLD: unregister_code(KC_ENT); break; + default: unregister_code(KC_SPC); + } + se_tap_state.state = 0; +} + +qk_tap_dance_action_t tap_dance_actions[] = { + [SE_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, se_finished, se_reset) +}; + +// KEYMAP +extern keymap_config_t keymap_config; + +#define _QWERTY 0 +#define _LOWER 1 + +enum custom_keycodes { + PAREN_MACRO = SAFE_RANGE, + ARROW_MACRO, + PSELF_MACRO +}; + +// Make layer undefined do nothing +#define KC_ KC_TRNS + +// Macros +#define KC_PMAC PAREN_MACRO +#define KC_AMAC ARROW_MACRO + +// Holds for layer +#define KC_DEL1 LT(_LOWER, KC_DEL) +#define KC_TAB1 LT(_LOWER, KC_TAB) + +// Space on tap, enter on hold. +#define KC_SPNT TD(SE_TAP_DANCE) + +#define KC_BSHT SFT_T(KC_BSPC) + +// Jumps the cursor a word right or left +#define KC_WRDRT LCTL(KC_RIGHT) +#define KC_WRDLT LCTL(KC_LEFT) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = KC_KEYMAP( + //,----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + ESC, 1 , 2 , 3 , 4 , 5 ,MUTE, MPLY, 6 , 7 , 8 , 9 , 0 ,PSCR, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + GRV, Q , W , E , R , T ,VOLD, VOLU, Y , U , I , O , P ,CAPS, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + TAB, A , S , D , F , G ,PGDN, PGUP, H , J , K , L ,SCLN,BSLS, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + LSFT, Z , X , C , V , B ,WRDLT, WRDRT, N , M ,COMM,DOT ,SLSH,QUOT, + //|----+----+----+----+----+----+----+----|||----+----+----+----+----+----+----+----| + LCTL,LGUI, APP,LALT,HOME,SPNT,DEL1,BSHT , ENT ,TAB1,BSHT,END ,DOWN, UP ,LEFT,RIGHT + ), + + [_LOWER] = KC_KEYMAP( + //,----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , F1 , F2 , F3 , F4 , F5 ,F11 , F12, F6 , F7 , F8 , F9 , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + TILD,EXLM, AT ,HASH,DLR ,PERC, , ,CIRC,AMPR,ASTR, , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , ,LBRC,LPRN,UNDS,LCBR, , ,RCBR, EQL,RPRN,RBRC,COLN, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , ,PMAC,MINS,AMAC, , , ,PLUS, , , , , + //|----+----+----+----+----+----+----+----|||----+----+----+----+----+----+----+----| + , , , , , , , , , , , , , , , + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + switch(keycode) { + case PAREN_MACRO: + SEND_STRING("()"); + return false; break; + case ARROW_MACRO: + SEND_STRING("->"); + return false; break; + } + } + return true; +}; diff --git a/keyboards/diverge3/keymaps/default/readme.md b/keyboards/diverge3/keymaps/default/readme.md new file mode 100644 index 00000000..c2e698b3 --- /dev/null +++ b/keyboards/diverge3/keymaps/default/readme.md @@ -0,0 +1,6 @@ +# The default keymap for diverge3 + +Just a keymap that I use for programming. + +The focus is to have the thumbs do all the work for spacing/backspacing, shifting, and symbols. +Also there is some duplicated functionality on the left hand for when editing with a mouse. diff --git a/keyboards/diverge3/keymaps/default/rules.mk b/keyboards/diverge3/keymaps/default/rules.mk new file mode 100644 index 00000000..e5ddcae8 --- /dev/null +++ b/keyboards/diverge3/keymaps/default/rules.mk @@ -0,0 +1 @@ +TAP_DANCE_ENABLE = yes diff --git a/keyboards/diverge3/readme.md b/keyboards/diverge3/readme.md new file mode 100644 index 00000000..f8ad69a2 --- /dev/null +++ b/keyboards/diverge3/readme.md @@ -0,0 +1,16 @@ +# diverge3 + +A split 5x7 keyboard with 3 thumb keys. Made by [Unikeyboard](https://unikeyboard.io). + +Keyboard Maintainer: [IslandMan93](https://github.com/islandman93) +Hardware Supported: Pro Micro +Hardware Availability: [Diverge 3](https://unikeyboard.io/product/diverge/) + +Make example for this keyboard (after setting up your build environment): + + make diverge3:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. + +# Reflashing Animus +Reflashing the stock firmware is pretty easy. Just follow the same steps in the [original guide](https://imgur.com/a/8UapN). You will have to manually reset the Pro Micro (by shorting the GND and RST) during the upload step. Then reapply your keymap through Arbites. \ No newline at end of file diff --git a/keyboards/diverge3/rules.mk b/keyboards/diverge3/rules.mk new file mode 100644 index 00000000..aa745305 --- /dev/null +++ b/keyboards/diverge3/rules.mk @@ -0,0 +1,73 @@ +SRC += ../lets_split/matrix.c \ + ../lets_split/serial.c \ + ../lets_split/split_util.c + +# MCU name +#MCU = at90usb1286 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +# OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +CUSTOM_MATRIX = yes From 88a7fa762f0b6b696b15334dde4851fdc601b558 Mon Sep 17 00:00:00 2001 From: yiancar Date: Sat, 10 Feb 2018 23:47:15 +0100 Subject: [PATCH 079/173] New keyboard: Cu75 (#2374) * Added Modular keyboards L,R and NUM Created code modules for the 3 modules of the modular keyboard. Original idea by MechboardsUK. Uses i2c implementation similar to lets split * Remove modular from master This is to fix incorrect branching * Addition of cu75 Addition of cu75 keyboard, uses libraries from LFKeyboards directory which are path linked to reduce file duplication. Minor fix on cu24 readme * Minor Readme Fix --- keyboards/cu24/readme.md | 2 +- keyboards/cu75/config.h | 151 ++++++++++++++++++++ keyboards/cu75/cu75.c | 179 ++++++++++++++++++++++++ keyboards/cu75/cu75.h | 110 +++++++++++++++ keyboards/cu75/keymaps/default/config.h | 8 ++ keyboards/cu75/keymaps/default/keymap.c | 91 ++++++++++++ keyboards/cu75/keymaps/default/rules.mk | 53 +++++++ keyboards/cu75/keymaps/iso/config.h | 8 ++ keyboards/cu75/keymaps/iso/keymap.c | 91 ++++++++++++ keyboards/cu75/keymaps/iso/rules.mk | 53 +++++++ keyboards/cu75/readme.md | 17 +++ keyboards/cu75/rules.mk | 41 ++++++ 12 files changed, 803 insertions(+), 1 deletion(-) create mode 100644 keyboards/cu75/config.h create mode 100644 keyboards/cu75/cu75.c create mode 100644 keyboards/cu75/cu75.h create mode 100644 keyboards/cu75/keymaps/default/config.h create mode 100644 keyboards/cu75/keymaps/default/keymap.c create mode 100644 keyboards/cu75/keymaps/default/rules.mk create mode 100644 keyboards/cu75/keymaps/iso/config.h create mode 100644 keyboards/cu75/keymaps/iso/keymap.c create mode 100644 keyboards/cu75/keymaps/iso/rules.mk create mode 100644 keyboards/cu75/readme.md create mode 100644 keyboards/cu75/rules.mk diff --git a/keyboards/cu24/readme.md b/keyboards/cu24/readme.md index a017cd66..4624c1aa 100644 --- a/keyboards/cu24/readme.md +++ b/keyboards/cu24/readme.md @@ -6,7 +6,7 @@ A luxurious 24 key keypad with various layouts. Includes RGB underglow, backligh Keyboard Maintainer: [Yiancar](https://github.com/yiancar) Hardware Supported: PCB v1.0 (uses a 32u4) -Hardware Availability: http://caps-unlocked.com/ +Hardware Availability: [caps-unlocked.com](http://caps-unlocked.com/) Make example for this keyboard (after setting up your build environment): diff --git a/keyboards/cu75/config.h b/keyboards/cu75/config.h new file mode 100644 index 00000000..c21e1da0 --- /dev/null +++ b/keyboards/cu75/config.h @@ -0,0 +1,151 @@ +/* +Copyright 2012 Jun Wako + +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 CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6062 +#define DEVICE_VER 0x0001 +#define MANUFACTURER LFKeyboards/CapsUnlocked +#define PRODUCT CU75 +#define DESCRIPTION A luxurious fully customisable 75% + +#define DIODE_DIRECTION COL2ROW +#define MATRIX_ROWS 6 +#define MATRIX_COLS 16 +#define MATRIX_ROW_PINS {F1, B7, B3, D2, D3, B2} +#define MATRIX_COL_PINS {F4, F5, F6, F7, C7, C6, B6, B5, B4, D7, D6, D4, D5, B1, B0, F0} +#define UNUSED_PINS {} + +#define RGB_DI_PIN C7 // Have to set it to something to get the ws2812 code to compile +#define RGBLED_NUM 24 // Number of LEDs +#define RGBLIGHT_ANIMATIONS +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 8 +#define BACKLIGHT_PWM_MAP {8, 16, 40, 55, 70, 128, 200, 255} + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Magic Key Options + * + * Magic keys are hotkey commands that allow control over firmware functions of + * the keyboard. They are best used in combination with the HID Listen program, + * found here: https://www.pjrc.com/teensy/hid_listen.html + * + * The options below allow the magic key functionality to be changed. This is + * useful if your keyboard/keypad is missing keys and you want magic key support. + * + */ + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* control how magic key switches layers */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false + +/* override magic key keymap */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM +//#define MAGIC_KEY_HELP1 H +//#define MAGIC_KEY_HELP2 SLASH +//#define MAGIC_KEY_DEBUG D +//#define MAGIC_KEY_DEBUG_MATRIX X +//#define MAGIC_KEY_DEBUG_KBD K +//#define MAGIC_KEY_DEBUG_MOUSE M +//#define MAGIC_KEY_VERSION V +//#define MAGIC_KEY_STATUS S +//#define MAGIC_KEY_CONSOLE C +//#define MAGIC_KEY_LAYER0_ALT1 ESC +//#define MAGIC_KEY_LAYER0_ALT2 GRAVE +//#define MAGIC_KEY_LAYER0 0 +//#define MAGIC_KEY_LAYER1 1 +//#define MAGIC_KEY_LAYER2 2 +//#define MAGIC_KEY_LAYER3 3 +//#define MAGIC_KEY_LAYER4 4 +//#define MAGIC_KEY_LAYER5 5 +//#define MAGIC_KEY_LAYER6 6 +//#define MAGIC_KEY_LAYER7 7 +//#define MAGIC_KEY_LAYER8 8 +//#define MAGIC_KEY_LAYER9 9 +//#define MAGIC_KEY_BOOTLOADER PAUSE +//#define MAGIC_KEY_LOCK CAPS +//#define MAGIC_KEY_EEPROM E +//#define MAGIC_KEY_NKRO N +//#define MAGIC_KEY_SLEEP_LED Z + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +#endif diff --git a/keyboards/cu75/cu75.c b/keyboards/cu75/cu75.c new file mode 100644 index 00000000..6dc28984 --- /dev/null +++ b/keyboards/cu75/cu75.c @@ -0,0 +1,179 @@ +#include +#include +#include +#include "cu75.h" +#include "keymap.h" +#include "debug.h" +#include "../lfkeyboards/issi.h" +#include "../lfkeyboards/TWIlib.h" +#include "../lfkeyboards/lighting.h" + +#ifdef AUDIO_ENABLE +float test_sound[][2] = SONG(STARTUP_SOUND); +#include