diff options
Diffstat (limited to 'keyboards/manyboard/macro/keymaps/via/keymap.c')
| -rw-r--r-- | keyboards/manyboard/macro/keymaps/via/keymap.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/keyboards/manyboard/macro/keymaps/via/keymap.c b/keyboards/manyboard/macro/keymaps/via/keymap.c new file mode 100644 index 000000000..ce32d6d24 --- /dev/null +++ b/keyboards/manyboard/macro/keymaps/via/keymap.c | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | /* Copyright 2020 William Ehman | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #include QMK_KEYBOARD_H | ||
| 17 | |||
| 18 | |||
| 19 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 20 | [0] = LAYOUT_ortho_4x4( | ||
| 21 | KC_F1, KC_F2, KC_F3, KC_F4, | ||
| 22 | KC_F5, KC_F6, KC_F7, KC_F8, | ||
| 23 | KC_F9, KC_F10, KC_F11, KC_F12, | ||
| 24 | KC_F13, KC_F14, KC_F15, TO(1) | ||
| 25 | ), | ||
| 26 | [1] = LAYOUT_ortho_4x4( | ||
| 27 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
| 28 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
| 29 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
| 30 | KC_TRNS, KC_TRNS, KC_TRNS, TO(2) | ||
| 31 | ), | ||
| 32 | [2] = LAYOUT_ortho_4x4( | ||
| 33 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
| 34 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
| 35 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
| 36 | KC_TRNS, KC_TRNS, KC_TRNS, TO(0) | ||
| 37 | ), | ||
| 38 | }; | ||
| 39 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
| 40 | switch (get_highest_layer(state)) { | ||
| 41 | case 0: | ||
| 42 | sethsv(HSV_WHITE, (LED_TYPE *)&led[0]); | ||
| 43 | rgblight_set(); | ||
| 44 | break; | ||
| 45 | case 1: | ||
| 46 | sethsv(HSV_GREEN, (LED_TYPE *)&led[0]); | ||
| 47 | rgblight_set(); | ||
| 48 | break; | ||
| 49 | case 2: | ||
| 50 | sethsv(HSV_BLUE, (LED_TYPE *)&led[0]); | ||
| 51 | rgblight_set(); | ||
| 52 | break; | ||
| 53 | } | ||
| 54 | return state; | ||
| 55 | } | ||
| 56 | |||
| 57 | void encoder_update_user(uint8_t index, bool clockwise) { | ||
| 58 | /* With an if statement we can check which encoder was turned. */ | ||
| 59 | if (index == 0) { /* First encoder */ | ||
| 60 | /* And with another if statement we can check the direction. */ | ||
| 61 | if (clockwise) { | ||
| 62 | /* This is where the actual magic happens: this bit of code taps on the | ||
| 63 | Page Down key. You can do anything QMK allows you to do here. | ||
| 64 | You'll want to replace these lines with the things you want your | ||
| 65 | encoders to do. */ | ||
| 66 | tap_code(KC_AUDIO_VOL_UP); | ||
| 67 | } else { | ||
| 68 | /* And likewise for the other direction, this time Vol Down is pressed. */ | ||
| 69 | tap_code(KC_AUDIO_VOL_DOWN); | ||
| 70 | } | ||
| 71 | } | ||
| 72 | } | ||
