1
0
Fork 0

Keymap: Updated files to work with Planck Rev. 6 (#4552)

* Update to work with Planck Rev. 6

Still something that needs to be worked with under keymap.c

Qwerty layer tap-toggle function seems to be a little laggy? Not instantaneous

* Changes

Deleted some unneeded lines

* deleting unneeded lines
This commit is contained in:
Ivan Choi 2018-12-05 18:20:39 -05:00 committed by Drashna Jaelre
parent 04de0533b8
commit fd0f78254d
3 changed files with 124 additions and 182 deletions

View file

@ -1,7 +1,14 @@
#ifndef CONFIG_USER_H #pragma once
#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
/* /*
* MIDI options * MIDI options
@ -27,4 +34,18 @@
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2 //#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif // Most tactile encoders have detents every 4 stages
#define ENCODER_RESOLUTION 4
#define MOUSEKEY_INTERVAL 16
#define MOUSEKEY_DELAY 0
#define MOUSEKEY_TIME_TO_MAX 60
#define MOUSEKEY_MAX_SPEED 7
#define MOUSEKEY_WHEEL_DELAY 0
#define TAPPING_TERM 80
#define TAPPING_TOGGLE 2

View file

@ -9,42 +9,35 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* cd /c/qmk_firmware * cd /c/qmk_firmware-master... make planck/rev6:navi
* make planck/rev4:navi
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma message "You may need to add LAYOUT_planck_grid to your keymap layers - see default for an example" #include QMK_KEYBOARD_H
#include "planck.h"
#include "action_layer.h"
#ifdef AUDIO_ENABLE
#include "audio.h"
#include "song_list.h"
#endif
extern keymap_config_t keymap_config; extern keymap_config_t keymap_config;
enum planck_layers { enum planck_layers {
_QWERTY, _QWERTY,
_COLEMAK,
_PLOVER,
_LOWER, _LOWER,
_RAISE, _RAISE,
_ADJUST, _FUNCTION,
_FUNCTION _ADJUST
}; };
enum planck_keycodes { enum planck_keycodes {
QWERTY = SAFE_RANGE, QWERTY = SAFE_RANGE,
COLEMAK,
PLOVER,
LOWER, LOWER,
RAISE, RAISE,
EXT_PLV,
FUNCTION FUNCTION
}; };
#define LOWER MO(_LOWER)
#define RAISE MO(_RAISE)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty /* Qwerty
@ -59,51 +52,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
* CtlSE = Control+shift+esc/ * CtlSE = Control+shift+esc/
* CtlE = Control when held, esc when tapped * CtlE = Control when held, esc when tapped
*/ * FN takes two taps to have it stay as FN
[_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},
{LCTL_T(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 },
{FUNCTION, C_S_T(KC_ESC), KC_LGUI, KC_LALT, 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 |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | CtlE | A | R | S | T | D | H | N | E | I | O | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | FN |CtlSE | GUI | Alt |Lower | Space | Raise| Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/ */
[_COLEMAK] = { [_QWERTY] = LAYOUT_planck_grid(
{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_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL,
{LCTL_T(KC_ESC), KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, LCTL_T(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_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, 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_ENT,
{FUNCTION, C_S_T(KC_ESC), KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} TT(_FUNCTION), LCTL(LALT(KC_DEL)), KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_BSPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, 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}
},
/* Lower /* Lower
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
@ -116,12 +72,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | | | | | | |Pg DN | Pg UP| | * | | | | | | | | |Pg DN | Pg UP| |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_LOWER] = { [_LOWER] = LAYOUT_planck_grid(
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL}, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_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_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
{KC_LSHIFT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_END, KC_HOME, _______}, KC_LSHIFT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_END, KC_HOME, _______,
{_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGDN , KC_PGUP, _______} _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGDN , KC_PGUP, _______
}, ),
/* Raise /* Raise
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
@ -129,89 +85,54 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+-------------+------+------+------+------+------|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* |Shift | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | End | Home | | * |Shift | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | End | Home | |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | |Pg DN |Pg UP | | * | | | | | | | | |Pg DN |Pg UP | |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_RAISE] = { [_RAISE] = LAYOUT_planck_grid(
{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_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_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, 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_LSHIFT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_END, KC_HOME, _______}, KC_LSHIFT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_END, KC_HOME, _______,
{_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGDN , KC_PGUP, _______} _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGDN , KC_PGUP, _______
}, ),
/* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------.
* | | Reset| | | | | | | | | | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | |MU_MOD|Aud on|Audoff| | |Qwerty|Colemk|Plover| | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* |Caps |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | Caps |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_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, _______, _______, QWERTY, COLEMAK, PLOVER,_______, _______},
{KC_CAPS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, KC_CAPS},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
},
/* Function /* Function
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | Esc | | Prev | Play | Next | | | | 7 | 8 | 9 | Bksp | * | Vol- | Mute | Vol+ | | | | | # | 7 | 8 | 9 | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | Vol- | Mute | Vol+ | | | + | 4 | 5 | 6 | - | * | Prev | Play | Next | | | | | + | 4 | 5 | 6 | - |
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | CALC | | | | | | | $ | 1 | 2 | 3 | Enter| * | CALC | MWU | M1 |MouseU| M2 | | | $ | 1 | 2 | 3 | Enter|
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | | |Prntsc| | | | * | 0 | . |Numlck| / | * | | MWD |MouseL|MouseD|MouseR| | * | 0 | . |Numlck| / |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_FUNCTION] = { [_FUNCTION] = LAYOUT_planck_grid(
{KC_ESC , _______, KC_MPRV, KC_MPLY, KC_MNXT, _______,_______,_______, KC_KP_7, KC_KP_8, KC_KP_9,KC_BSPC}, KC_VOLD, KC_MUTE, KC_VOLU, KC_MPRV, KC_MPLY, KC_MNXT, KC_TRNS, KC_HASH, KC_KP_7, KC_KP_8, KC_KP_9, KC_BSPC,
{_______, _______, KC_VOLD, KC_MUTE, KC_VOLU, _______, _______, KC_PPLS, KC_KP_4, KC_KP_5, KC_KP_6, KC_PMNS}, KC_MPRV, KC_MPLY, KC_MNXT, AU_ON, AU_OFF, MU_ON, MU_OFF, KC_PPLS, KC_KP_4, KC_KP_5, KC_KP_6, KC_PMNS,
{KC_CALC, _______, _______, _______, _______, _______, _______, KC_DLR, KC_KP_1, KC_KP_2, KC_KP_3, KC_ENT}, KC_CALC, KC_WH_U, KC_BTN1, KC_MS_U, KC_BTN2, KC_TRNS, KC_TRNS, KC_DLR, KC_KP_1, KC_KP_2, KC_KP_3, KC_ENTER,
{_______, _______, KC_PSCR, _______, _______ , _______, _______, KC_PAST, KC_KP_0, KC_KP_DOT,KC_NUMLOCK, KC_PSLS} KC_TRNS, KC_WH_D, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, KC_TRNS, KC_PAST, KC_KP_0, KC_KP_DOT,KC_NUMLOCK, KC_PSLS
} )
}; };
#ifdef AUDIO_ENABLE uint32_t layer_state_set_user(uint32_t state) {
float tone_startup[][2] = SONG(ZELDA_PUZZLE); return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
float tone_qwerty[][2] = SONG(ZELDA_TREASURE); }
float plover_song[][2] = SONG(PLOVER_SOUND);
float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
float tone_colemak[][2] = SONG(VIOLIN_SOUND);
float tone_music_on[][2] = SONG(ONE_UP_SOUND);
float tone_music_off[][2] = SONG(ROCK_A_BYE_BABY);
#endif /* AUDIO_ENABLE */
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) { switch (keycode) {
case QWERTY: case QWERTY:
if (record->event.pressed) { if (record->event.pressed) {
print("mode just switched to qwerty and this is a huge string\n"); print("mode just switched to qwerty and this is a huge string\n");
set_single_persistent_default_layer(_QWERTY); set_single_persistent_default_layer(_QWERTY);
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_qwerty);
#endif
} }
return false; return false;
break; break;
case COLEMAK: case LOWER:
if (record->event.pressed) {
set_single_persistent_default_layer(_COLEMAK);
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_colemak);
#endif
}
return false;
break;
case LOWER:
if (record->event.pressed) { if (record->event.pressed) {
layer_on(_LOWER); layer_on(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST); update_tri_layer(_LOWER, _RAISE, _ADJUST);
@ -238,62 +159,59 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_FUNCTION); layer_off(_FUNCTION);
} }
return false; return false;
break; 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; return true;
} }
void matrix_init_user(void) { bool muse_mode = false;
#ifdef AUDIO_ENABLE uint8_t last_muse_note = 0;
startup_user(); uint16_t muse_counter = 0;
#endif uint8_t muse_offset = 70;
uint16_t muse_tempo = 50;
void encoder_update(bool clockwise) {
if (muse_mode) {
if (IS_LAYER_ON(_RAISE)) {
if (clockwise) {
muse_offset++;
} else {
muse_offset--;
}
} else {
if (clockwise) {
muse_tempo+=1;
} else {
muse_tempo-=1;
}
}
} else {
if (clockwise) {
#ifdef MOUSEKEY_ENABLE
register_code(KC_MS_WH_DOWN);
unregister_code(KC_MS_WH_DOWN);
#else
register_code(KC_PGDN);
unregister_code(KC_PGDN);
#endif
} else {
#ifdef MOUSEKEY_ENABLE
register_code(KC_MS_WH_UP);
unregister_code(KC_MS_WH_UP);
#else
register_code(KC_PGUP);
unregister_code(KC_PGUP);
#endif
}
}
} }
#ifdef AUDIO_ENABLE bool music_mask_user(uint16_t keycode) {
switch (keycode) {
void startup_user() case RAISE:
{ case LOWER:
_delay_ms(20); // gets rid of tick return false;
PLAY_SONG(tone_startup); default:
return true;
}
} }
void music_on_user(void)
{
PLAY_SONG(tone_music_on);
}
void music_off_user(void)
{
PLAY_SONG(tone_music_off);
}
#endif

View file

@ -1 +1,4 @@
AUDIO_ENABLE = yes AUDIO_ENABLE = yes
MOUSEKEY_ENABLE = yes
DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave