From f7461748744c1e3a5bae3b7a54d5b0d8439606e6 Mon Sep 17 00:00:00 2001 From: Graham P Heath Date: Fri, 23 Feb 2018 12:15:34 -0600 Subject: Graham's Keymaps. (#2422) * add my config * fix backlight, clean up that code * group background code, restore static var * qwerty is supposed to be in the middle * wrap layer change backlight in ifdef * backlight levels and some more 'emojis'. * Restructure to make it possible to press cmd ent on the right side of the board with one hand. * Expose the period through the number layer. Add Hyper keys to mouse layer * reduce mouse speed * add a : -P key * Thumbs up and down, remove some keys that are duplicated via function keys, clean up * fix build issues * add various emoji * duplicate default Meira keymaps * Miera updates * add documented but unmapped emoji * Sound for the Meira, was stumped by a file size! Thanks drashna! * add docs * docs * revert lib changes... * clean up * clean up * remove make file * Fixes missing key --- keyboards/meira/keymaps/grahampheath/config.h | 35 ++ keyboards/meira/keymaps/grahampheath/keymap.c | 425 ++++++++++++++++++++++ keyboards/meira/keymaps/grahampheath/readme.md | 55 +++ keyboards/meira/keymaps/grahampheath/rules.mk | 3 + keyboards/planck/keymaps/grahampheath/config.h | 51 +++ keyboards/planck/keymaps/grahampheath/keymap.c | 450 ++++++++++++++++++++++++ keyboards/planck/keymaps/grahampheath/readme.md | 4 + keyboards/planck/keymaps/grahampheath/rules.mk | 9 + 8 files changed, 1032 insertions(+) create mode 100644 keyboards/meira/keymaps/grahampheath/config.h create mode 100644 keyboards/meira/keymaps/grahampheath/keymap.c create mode 100644 keyboards/meira/keymaps/grahampheath/readme.md create mode 100644 keyboards/meira/keymaps/grahampheath/rules.mk create mode 100644 keyboards/planck/keymaps/grahampheath/config.h create mode 100644 keyboards/planck/keymaps/grahampheath/keymap.c create mode 100644 keyboards/planck/keymaps/grahampheath/readme.md create mode 100644 keyboards/planck/keymaps/grahampheath/rules.mk (limited to 'keyboards') diff --git a/keyboards/meira/keymaps/grahampheath/config.h b/keyboards/meira/keymaps/grahampheath/config.h new file mode 100644 index 0000000000..fcc5e4f136 --- /dev/null +++ b/keyboards/meira/keymaps/grahampheath/config.h @@ -0,0 +1,35 @@ +/* Copyright 2017 Cole Markham, WoodKeys.click + * + * 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 +#define MUSIC_MASK (keycode != KC_NO) +#define C6_AUDIO +#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 + +#endif diff --git a/keyboards/meira/keymaps/grahampheath/keymap.c b/keyboards/meira/keymaps/grahampheath/keymap.c new file mode 100644 index 0000000000..6a4b9333c7 --- /dev/null +++ b/keyboards/meira/keymaps/grahampheath/keymap.c @@ -0,0 +1,425 @@ +/* Copyright 2017 Cole Markham + * + * 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 "meira.h" +#include "action_layer.h" +#include "action_code.h" + +#ifdef RGBLIGHT_ENABLE +//Following line allows macro to read current RGB settings +extern rgblight_config_t rgblight_config; +#endif + +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _EMOJI 5 +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + LOWER, + RAISE, + EMOJI, + ADJUST, + TOUNGE, + JOY, + FROWN, + HEART, + THMBUP, + THMBDN, + SHRUG, + WINK, + GRIN, + LLAP, + CRY, + SHIT, + FLIP, + FNGLEFT, + ABOVE, + FNGRIGHT, + CONFUSED +}; + +// define variables for reactive RGB +bool TOG_STATUS = false; +int RGB_current_mode; + +#define KC_X0 MT(MOD_LCTL, KC_ESC) // Hold for Left Ctrl, Tap for ESC +#define KC_X1 MT(MOD_RSFT, KC_ENT) // Hold for Right Shift, Tap for Enter +#define KC_X2 MT(MOD_RSFT, LGUI(KC_ENT)) // Send Command Enter +#define KC_X3 MT(KC_LGUI, KC_SPC) // Hold for Left GUI, Tap for Space +#define KC_EMOJ TT(_EMOJI) // Hold for Emoji Layer, or tap 5 times. +#define KC_QS LGUI(KC_SPC) // Send Command + Space (for QuickSilver). +#define KC_TABR LGUI(KC_RCBR) // Send Command + } (for tab changing). +#define KC_TABL LGUI(KC_LCBR) // Send Command + { (for tab changing). +#define HYPR_0 HYPR(KC_TILD) // Send Hyper + ~. +#define HYPR_1 HYPR(KC_EXLM) // Send Hyper + !. +#define HYPR_2 HYPR(KC_AT) // Send Hyper + @. + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Esc | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Tab | A | S | D | F | G | H | J | K | L | ; | ' | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Emoji |Adjust| Ctrl | Alt |Lower | Cmd |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_BSPC, \ + KC_X0, 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_X1, \ + KC_EMOJ, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_X3, 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 \ + ), + + /* Emoji Layer + * + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │HYPR0│ │ ;-) │ │ │ :-P │ │ │:'-( │FLIP │ │ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │HYPR1│ 👆 │SHRUG│ │ :-( │ │ <3 │ :-) │ │LLAP │ │ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │HYPR2│ │ │ | :-\ │ │ │ :-D │ SHIT│ │ │ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┴─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ │ │Brig-│ Sleep │Brig+│ 👈 │ 👎 | 👍 │ 👉 │ + * └─────┴─────┴─────┴─────┴─────┴───────────┴─────┴─────┴─────┴─────┴─────┘ + */ + [_EMOJI] = KEYMAP ( \ + HYPR_0, _______, WINK, _______, _______, TOUNGE, _______, _______, CRY, FLIP, _______, _______, \ + HYPR_1, ABOVE, SHRUG, _______, FROWN, _______, HEART, JOY, _______, LLAP, _______, _______, \ + HYPR_2, _______, _______, _______, CONFUSED, _______, _______, GRIN, SHIT, _______, _______, _______, \ + _______, _______, _______, _______, KC_SLCK, KC_SLEP, KC_SLEP, KC_PAUS, FNGLEFT, THMBDN, THMBUP, FNGRIGHT \ + ), + + + + /* Lower + * ,-----------------------------------------------------------------------------------. + * | | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ~ | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Tab- | Vol- | Vol+ | Tab+ | + * `-----------------------------------------------------------------------------------' + */ + [_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_LSFT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \ + _______, _______, _______, _______, _______, KC_QS, KC_QS, _______, KC_TABL, THMBDN, THMBUP, KC_TABR \ + ), + + /* Raise + * ,-----------------------------------------------------------------------------------. + * | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ` | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Home | PgUp | PgDn | 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_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ + KC_LSFT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, KC_X2, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END \ + ), + + /* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | Reset| | | | | | | | | | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ + [_ADJUST] = KEYMAP( \ + _______, RESET, _______, KC_MRWD, KC_MPLY, KC_MFFD, KC_PSCR, _______, _______, _______, _______, KC_DEL, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ) +}; + +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; +}; + +#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 plover_song[][2] = SONG(PLOVER_SOUND); + float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +#endif + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +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 + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_colemak, false, 0); + #endif + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_dvorak, false, 0); + #endif + } + 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: + // FIXME add RGB feedback + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + case BL_TOGG: +#ifdef ISSI_ENABLE + if (record->event.pressed) { + print("Enabling backlight\n"); + issi_init(); + } +#endif + return false; + break; + case BL_STEP: + if (record->event.pressed) { + print("Stepping backlight\n"); + + } + return false; + break; + case FLIP: + if (record->event.pressed) { + SEND_STRING("&fliptable;"); + } + return false; + break; + case CONFUSED: + if (record->event.pressed) { + SEND_STRING(":-\\"); + } + // register_codeturn false; + break; + case SHIT: + if (record->event.pressed) { + SEND_STRING("&shit; "); + } + return false; + break; + case CRY: + if (record->event.pressed) { + SEND_STRING(":'-( "); + } + return false; + break; + case LLAP: + if (record->event.pressed) { + SEND_STRING("&llap; "); + } + return false; + break; + case GRIN: + if (record->event.pressed) { + SEND_STRING(":-D "); + } + return false; + break; + case TOUNGE: + if (record->event.pressed) { + SEND_STRING(":-P "); + } + return false; + break; + case JOY: + if (record->event.pressed) { + SEND_STRING(":-) "); + } + return false; + break; + case FROWN: + if (record->event.pressed) { + SEND_STRING(":-( "); + } + return false; + break; + case HEART: + if (record->event.pressed) { + SEND_STRING("<3 "); + } + return false; + break; + case SHRUG: + if (record->event.pressed) { + SEND_STRING("&shrug; "); + } + return false; + break; + case THMBUP: + if (record->event.pressed) { + SEND_STRING("&thumbup; "); + } + return false; + break; + case THMBDN: + if (record->event.pressed) { + SEND_STRING("&thumbdown; "); + } + return false; + break; + case FNGLEFT: + if (record->event.pressed) { + SEND_STRING("&fingerleft; "); + } + return false; + break; + case FNGRIGHT: + if (record->event.pressed) { + SEND_STRING("&fingerright; "); + } + return false; + break; + case WINK: + if (record->event.pressed) { + SEND_STRING(";-) "); + } + return false; + break; + case ABOVE: + if (record->event.pressed) { + SEND_STRING("&above; "); + } + return false; + break; + + } + return true; +} + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/meira/keymaps/grahampheath/readme.md b/keyboards/meira/keymaps/grahampheath/readme.md new file mode 100644 index 0000000000..10459e3566 --- /dev/null +++ b/keyboards/meira/keymaps/grahampheath/readme.md @@ -0,0 +1,55 @@ +# Graham's Meira. + +Don't expect this to work for you unaltered! For the record, these are my notes, not a guide for you :-) + +## Known issues: +Anything over 28k will begin to overwrite the boot loader, which is a pain! + +Be sure to check file size with: +``` +avr-size meira_promicro_grahampheath.hex +``` + +## Sounds +I've added a [8ohm 0.5W speaker](http://a.co/6MIKZSy), its a bit large, but it fits in approximately the same space as the ProMicro. I soldered directly to PC6 and GND. + +As the Meira code stood, adding sound increased the hex beyond what the boot loader could handle, so I had to dial way back on features that I wasnt using, like backlighting and RGB support. I also removed function keys, though I think you could restore some of these features, you certainly can't restore all of them and still fit with a boot loader. + +## Build + +Built for the ProMicro with: +``` +make meira/promicro:grahampheath +``` + +Build and upload with, which is cool because it will sense your port. +``` +make meira/promicro:grahampheath:avrdude +``` + +Program a hex directly with: +``` +avrdude -p atmega32u4 -P /dev/tty.usbmodem14111 -c avr109 -v -e -D -U flash:w:meira_promicro_grahampheath.hex +``` + +If you use an AVRISP you will be program a hex without a boot loader: +``` +avrdude -p atmega32u4 -P /dev/tty.usbmodem14111 -c avrisp -v -e -U flash:w:meira_promicro_grahampheath.hex +``` + +## Bricked +Did you overwrite your boot loader? + +I did... + +I used an [Ardunio as an ISP](https://learn.sparkfun.com/tutorials/installing-an-arduino-bootloader), and was able to program various boot loaders. Ultimately it seemed like this was the right combo: + +[ProMicro pinout](https://cdn.sparkfun.com/assets/9/c/3/c/4/523a1765757b7f5c6e8b4567.png) + +[Wiring](https://forum.arduino.cc/index.php?PHPSESSID=467mm69btif69hdj5e3gil5465&action=dlattach;topic=363341.0;attach=145820): [via u/dmjlambert](https://forum.arduino.cc/index.php?topic=363341.0) + +ProMicro boot loader hex is called `Caterina-promicro16.hex` and is stored on [Sparkfun's GitHub](https://github.com/sparkfun/Arduino_Boards) + +``` +avrdude -c avrisp -p m32u4 -P /dev/tty.usbmodem14141 -v -e -U flash:w:Caterina-promicro16.hex -U efuse:w:0xcb:m -U hfuse:w:0xd8:m -U lfuse:w:0xff:m +``` diff --git a/keyboards/meira/keymaps/grahampheath/rules.mk b/keyboards/meira/keymaps/grahampheath/rules.mk new file mode 100644 index 0000000000..8288530c9e --- /dev/null +++ b/keyboards/meira/keymaps/grahampheath/rules.mk @@ -0,0 +1,3 @@ +AUDIO_ENABLE = yes # Audio output on port C6 +EXTRAFLAGS+=-flto # -4-7k +MOUSEKEY_ENABLE = no # Mouse keys(-47kb) diff --git a/keyboards/planck/keymaps/grahampheath/config.h b/keyboards/planck/keymaps/grahampheath/config.h new file mode 100644 index 0000000000..1c842420bb --- /dev/null +++ b/keyboards/planck/keymaps/grahampheath/config.h @@ -0,0 +1,51 @@ +#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 + +#define TAPPING_TERM 200 + +#undef BACKLIGHT_LEVELS +#define BACKLIGHT_LEVELS 4 + +#undef MOUSEKEY_WHEEL_MAX_SPEED +#define MOUSEKEY_WHEEL_MAX_SPEED 5 + diff --git a/keyboards/planck/keymaps/grahampheath/keymap.c b/keyboards/planck/keymaps/grahampheath/keymap.c new file mode 100644 index 0000000000..96d9000180 --- /dev/null +++ b/keyboards/planck/keymaps/grahampheath/keymap.c @@ -0,0 +1,450 @@ +/* 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" +#include "action_code.h" + +extern keymap_config_t keymap_config; + +enum planck_layers { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _EMOJI, + _PLOVER, + _ADJUST +}; + +enum planck_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + PLOVER, + LOWER, + RAISE, + BACKLIT, + EXT_PLV, + TOUNGE, + JOY, + FROWN, + HEART, + THMBUP, + THMBDN, + SHRUG, + WINK, + GRIN, + LLAP, + CRY, + SHIT, + FLIP, + FNGLEFT, + ABOVE, + FNGRIGHT, + CONFUSED +}; + + +#define KC_X0 MT(MOD_LCTL, KC_ESC) // Hold for Left Ctrl, Tap for ESC +#define KC_X1 MT(MOD_RSFT, KC_ENT) // Hold for Right Shift, Tap for Enter +#define KC_X2 MT(MOD_RSFT, LGUI(KC_ENT)) // Send Command Enter +#define KC_MOUS TT(_EMOJI) // Hold for Mouse Layer, or tap 5 times. +#define KC_QS LGUI(KC_SPC) // Send Command + Space (for QuickSilver). +#define KC_TABR LGUI(KC_RCBR) // Send Command + } (for tab changing). +#define KC_TABL LGUI(KC_LCBR) // Send Command + { (for tab changing). +#define HYPR_0 HYPR(KC_TILD) // Send Hyper + ~. +#define HYPR_1 HYPR(KC_EXLM) // Send Hyper + !. +#define HYPR_2 HYPR(KC_AT) // Send Hyper + @. + + +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 | , | . | / |Shift*| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | GUI | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + * - Right Shift: Tap for Enter, hold for shift. + * - Escape: Tap for Esc, hold for Ctrl. + */ +[_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_X0, 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_X1 }, + {KC_MOUS, 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 | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | 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} +}, + + +/* Emoji Layer + * + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │HYPR0│ │ ;-) │ │ │ :-P │ │ │:'-( │FLIP │ │ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │HYPR1│ 👆 │SHRUG│ │ :-( │ │ <3 │ :-) │ │LLAP │ │ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤ + * │HYPR2│ │ │ | :-\ │ │ │ :-D │ SHIT│ │ │ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┴─────┼─────┼─────┼─────┼─────┼─────┤ + * │ │ │ │ │Brig-│ Sleep │Brig+│ 👈 │ 👎 | 👍 │ 👉 │ + * └─────┴─────┴─────┴─────┴─────┴───────────┴─────┴─────┴─────┴─────┴─────┘ + */ +[_EMOJI] = { + {HYPR_0, _______, WINK, _______, _______, TOUNGE, _______, _______, CRY, FLIP, _______, _______}, + {HYPR_1, ABOVE, SHRUG, _______, FROWN, _______, HEART, JOY, _______, LLAP, _______, _______}, + {HYPR_2, _______, _______, _______, CONFUSED, _______, _______, GRIN, SHIT, _______, _______, _______}, + {_______, _______, _______, _______, KC_SLCK, KC_SLEP, KC_SLEP, KC_PAUS, FNGLEFT, THMBDN, THMBUP, FNGRIGHT} +}, + + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shft | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | |Tab-L | 👎 | 👍 |Tab-R | + * `-----------------------------------------------------------------------------------' + */ +[_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_LSFT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), _______, _______, _______}, + {_______, _______, _______, _______, _______, KC_QS, KC_QS, _______, KC_TABL, THMBDN, THMBUP, KC_TABR} +}, + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shft | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | Up |CTLENT| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | Left | Down | Right| + * `-----------------------------------------------------------------------------------' + */ +[_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_LSFT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, KC_UP, KC_X2}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT} +}, + +/* 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| | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Brite | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = { + {_______, RESET, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, 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, _______, _______, _______, _______, _______}, + {BACKLIT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +} + + +}; + +#ifdef AUDIO_ENABLE + float plover_song[][2] = SONG(PLOVER_SOUND); + float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +#endif + +#ifdef BACKLIGHT_ENABLE + bool has_layer_changed = true; + + void matrix_scan_user(void) { + uint8_t layer = biton32(layer_state); + static uint8_t old_layer = 0; + + if (old_layer != layer) { + has_layer_changed = true; + old_layer = layer; + } + + if (has_layer_changed) { + has_layer_changed = false; + + switch (layer) { + case _LOWER: + backlight_set(1); + break; + case _QWERTY: + backlight_set(2); + break; + case _RAISE: + backlight_set(3); + break; + case _ADJUST: + backlight_set(4); + break; + } + } + }; +#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 + } else { + unregister_code(KC_RSFT); + } + 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_off(_EMOJI); + 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; + case FLIP: + if (record->event.pressed) { + SEND_STRING("&fliptable;"); + } + return false; + break; + case CONFUSED: + if (record->event.pressed) { + SEND_STRING(":-\\"); + } + return false; + break; + case SHIT: + if (record->event.pressed) { + SEND_STRING("&shit; "); + } + return false; + break; + case CRY: + if (record->event.pressed) { + SEND_STRING(":'-( "); + } + return false; + break; + case LLAP: + if (record->event.pressed) { + SEND_STRING("&llap; "); + } + return false; + break; + case GRIN: + if (record->event.pressed) { + SEND_STRING(":-D "); + } + return false; + break; + case TOUNGE: + if (record->event.pressed) { + SEND_STRING(":-P "); + } + return false; + break; + case JOY: + if (record->event.pressed) { + SEND_STRING(":-) "); + } + return false; + break; + case FROWN: + if (record->event.pressed) { + SEND_STRING(":-( "); + } + return false; + break; + case HEART: + if (record->event.pressed) { + SEND_STRING("<3 "); + } + return false; + break; + case SHRUG: + if (record->event.pressed) { + SEND_STRING("&shrug; "); + } + return false; + break; + case THMBUP: + if (record->event.pressed) { + SEND_STRING("&thumbup; "); + } + return false; + break; + case THMBDN: + if (record->event.pressed) { + SEND_STRING("&thumbdown; "); + } + return false; + break; + case FNGLEFT: + if (record->event.pressed) { + SEND_STRING("&fingerleft; "); + } + return false; + break; + case FNGRIGHT: + if (record->event.pressed) { + SEND_STRING("&fingerright; "); + } + return false; + break; + case WINK: + if (record->event.pressed) { + SEND_STRING(";-) "); + } + return false; + break; + case ABOVE: + if (record->event.pressed) { + SEND_STRING("&above; "); + } + return false; + break; + } + return true; +} diff --git a/keyboards/planck/keymaps/grahampheath/readme.md b/keyboards/planck/keymaps/grahampheath/readme.md new file mode 100644 index 0000000000..ec8020f18c --- /dev/null +++ b/keyboards/planck/keymaps/grahampheath/readme.md @@ -0,0 +1,4 @@ +# Graham's Planck + +## Sounds +I've added a [8ohm 0.5W speaker](http://a.co/6MIKZSy), its a bit large, but it fits in approximately the same space as the ProMicro. I soldered to the pcb hole labeled PC6 on my Rev 3 Planck PCB, and GND on the near by chip. [Pic of an identical mod][https://i1.sndcdn.com/artworks-000128070066-myh0ls-t500x500.jpg] (not mine). diff --git a/keyboards/planck/keymaps/grahampheath/rules.mk b/keyboards/planck/keymaps/grahampheath/rules.mk new file mode 100644 index 0000000000..2ff606255e --- /dev/null +++ b/keyboards/planck/keymaps/grahampheath/rules.mk @@ -0,0 +1,9 @@ +ifndef QUANTUM_DIR + include ../../../../Makefile +endif +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +NKRO_ENABLE = yes # N-Key rollover. +# MOUSEKEY_ENABLE = yes # Mouse mode. +TAP_DANCE_ENABLE = no # Tap dance enabled. +UNICODEMAP_ENABLE = no # Unicode keymap (sucks on osx). +AUDIO_ENABLE = yes # Audio output on port C6 -- cgit v1.2.3