1 // This is the canonical layout file for the Quantum project. If you want to add another keyboard,
2 // this is the style you want to emulate.
5 #include "action_layer.h"
11 extern keymap_config_t keymap_config;
13 // Each layer gets a name for readability, which is then used in the keymap matrix below.
14 // The underscores don't mean anything - you can have a layer called STUFF or any other name.
15 // Layer names don't all need to be of the same length, obviously, and you can also skip them
16 // entirely and just use numbers.
25 enum planck_keycodes {
31 // Fillers to make layering more clear
32 #define _______ KC_TRNS
35 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
38 * ,-----------------------------------------------------------------------------------.
39 * | Esc | Q | W | E | R | T | Y | U | I | O | P | Bksp |
40 * |------+------+------+------+------+-------------+------+------+------+------+------|
41 * | Tab | A | S | D | F | G | H | J | K | L | ; |Enter |
42 * |------+------+------+------+------+------|------+------+------+------+------+------|
43 * | Shift| Z | X | C | V | B | N | M | , | . | / |Shift |
44 * |------+------+------+------+------+------+------+------+------+------+------+------|
45 * | DEL | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
46 * `-----------------------------------------------------------------------------------'
49 {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
50 {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT },
51 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
52 {KC_DEL, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
57 * ,-----------------------------------------------------------------------------------.
58 * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
59 * |------+------+------+------+------+-------------+------+------+------+------+------|
60 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | \ |
61 * |------+------+------+------+------+------|------+------+------+------+------+------|
62 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | |
63 * |------+------+------+------+------+------+------+------+------+------+------+------|
64 * | | | | | | | | Next | Vol- | Vol+ | Play |
65 * `-----------------------------------------------------------------------------------'
68 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
69 {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_BSLS},
70 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______},
71 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
75 * ,-----------------------------------------------------------------------------------.
76 * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
77 * |------+------+------+------+------+-------------+------+------+------+------+------|
78 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | ' |
79 * |------+------+------+------+------+------|------+------+------+------+------+------|
80 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | |
81 * |------+------+------+------+------+------+------+------+------+------+------+------|
82 * | | | | | | | | Next | Vol- | Vol+ | Play |
83 * `-----------------------------------------------------------------------------------'
86 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
87 {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_QUOT},
88 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______},
89 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
93 /* Adjust (Lower + Raise)
94 * ,-----------------------------------------------------------------------------------.
95 * | | Reset| | | | | | | | | | Del |
96 * |------+------+------+------+------+-------------+------+------+------+------+------|
97 * | | | |Aud on|Audoff|AGnorm|AGswap| NERD | | | | |
98 * |------+------+------+------+------+------|------+------+------+------+------+------|
99 * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | |
100 * |------+------+------+------+------+------+------+------+------+------+------+------|
101 * | | | | | | | | | | | |
102 * `-----------------------------------------------------------------------------------'
105 {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL },
106 {_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, NERD, _______, _______, _______, _______},
107 {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______},
108 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
116 float tone_startup[][2] = SONG(STARTUP_SOUND);
117 float tone_nerd[][2] = SONG(QWERTY_SOUND);
118 float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
120 float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
124 void persistent_default_layer_set(uint16_t default_layer) {
125 eeconfig_update_default_layer(default_layer);
126 default_layer_set(default_layer);
129 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
132 if (record->event.pressed) {
134 PLAY_NOTE_ARRAY(tone_nerd, false, 0);
136 persistent_default_layer_set(1UL<<_NERD);
141 if (record->event.pressed) {
143 update_tri_layer(_LOWER, _RAISE, _ADJUST);
146 update_tri_layer(_LOWER, _RAISE, _ADJUST);
151 if (record->event.pressed) {
153 update_tri_layer(_LOWER, _RAISE, _ADJUST);
156 update_tri_layer(_LOWER, _RAISE, _ADJUST);
164 void matrix_init_user(void) {
174 _delay_ms(20); // gets rid of tick
175 PLAY_NOTE_ARRAY(tone_startup, false, 0);
180 PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
185 void music_on_user(void)
190 void music_scale_user(void)
192 PLAY_NOTE_ARRAY(music_scale, false, 0);