diff options
author | William Ehman <will@ehman.com> | 2021-07-02 21:53:13 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-02 20:53:13 -0700 |
commit | ad30218701782192b9125c32b85cdbcc203c0c85 (patch) | |
tree | 6fe212ac7440baeec179b046347e1f9b3254650b /keyboards/manyboard/macro/keymaps | |
parent | 04bc74d8f52370a01f1f67a5de8ae751e307e8c9 (diff) |
[Keyboard] manyboard macro (#11896)
Co-authored-by: Joel Challis <git@zvecr.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'keyboards/manyboard/macro/keymaps')
-rw-r--r-- | keyboards/manyboard/macro/keymaps/default/keymap.c | 73 | ||||
-rw-r--r-- | keyboards/manyboard/macro/keymaps/via/keymap.c | 72 | ||||
-rw-r--r-- | keyboards/manyboard/macro/keymaps/via/rules.mk | 1 |
3 files changed, 146 insertions, 0 deletions
diff --git a/keyboards/manyboard/macro/keymaps/default/keymap.c b/keyboards/manyboard/macro/keymaps/default/keymap.c new file mode 100644 index 0000000000..4feda50808 --- /dev/null +++ b/keyboards/manyboard/macro/keymaps/default/keymap.c @@ -0,0 +1,73 @@ +/* Copyright 2020 William Ehman + * + * 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 <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_ortho_4x4( + 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_F15, TO(1) + ), + [1] = LAYOUT_ortho_4x4( + 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(2) + ), + [2] = LAYOUT_ortho_4x4( + 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) + ), +}; + +layer_state_t layer_state_set_user(layer_state_t state) { + switch (get_highest_layer(state)) { + case 0: + sethsv(HSV_WHITE, (LED_TYPE *)&led[0]); + rgblight_set(); + break; + case 1: + sethsv(HSV_GREEN, (LED_TYPE *)&led[0]); + rgblight_set(); + break; + case 2: + sethsv(HSV_BLUE, (LED_TYPE *)&led[0]); + rgblight_set(); + break; + } + return state; +} + +void encoder_update_user(uint8_t index, bool clockwise) { + /* With an if statement we can check which encoder was turned. */ + if (index == 0) { /* First encoder */ + /* And with another if statement we can check the direction. */ + if (clockwise) { + /* This is where the actual magic happens: this bit of code taps on the + Page Down key. You can do anything QMK allows you to do here. + You'll want to replace these lines with the things you want your + encoders to do. */ + tap_code(KC_AUDIO_VOL_UP); + } else { + /* And likewise for the other direction, this time Vol Down is pressed. */ + tap_code(KC_AUDIO_VOL_DOWN); + } + } +} diff --git a/keyboards/manyboard/macro/keymaps/via/keymap.c b/keyboards/manyboard/macro/keymaps/via/keymap.c new file mode 100644 index 0000000000..ce32d6d242 --- /dev/null +++ b/keyboards/manyboard/macro/keymaps/via/keymap.c @@ -0,0 +1,72 @@ +/* Copyright 2020 William Ehman + * + * 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 <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_ortho_4x4( + 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_F15, TO(1) + ), + [1] = LAYOUT_ortho_4x4( + 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(2) + ), + [2] = LAYOUT_ortho_4x4( + 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) + ), +}; +layer_state_t layer_state_set_user(layer_state_t state) { + switch (get_highest_layer(state)) { + case 0: + sethsv(HSV_WHITE, (LED_TYPE *)&led[0]); + rgblight_set(); + break; + case 1: + sethsv(HSV_GREEN, (LED_TYPE *)&led[0]); + rgblight_set(); + break; + case 2: + sethsv(HSV_BLUE, (LED_TYPE *)&led[0]); + rgblight_set(); + break; + } + return state; +} + +void encoder_update_user(uint8_t index, bool clockwise) { + /* With an if statement we can check which encoder was turned. */ + if (index == 0) { /* First encoder */ + /* And with another if statement we can check the direction. */ + if (clockwise) { + /* This is where the actual magic happens: this bit of code taps on the + Page Down key. You can do anything QMK allows you to do here. + You'll want to replace these lines with the things you want your + encoders to do. */ + tap_code(KC_AUDIO_VOL_UP); + } else { + /* And likewise for the other direction, this time Vol Down is pressed. */ + tap_code(KC_AUDIO_VOL_DOWN); + } + } +} diff --git a/keyboards/manyboard/macro/keymaps/via/rules.mk b/keyboards/manyboard/macro/keymaps/via/rules.mk new file mode 100644 index 0000000000..036bd6d1c3 --- /dev/null +++ b/keyboards/manyboard/macro/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes
\ No newline at end of file |