aboutsummaryrefslogtreecommitdiff
path: root/keyboards/minimacro5/keymaps/devdev/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/minimacro5/keymaps/devdev/keymap.c')
-rw-r--r--keyboards/minimacro5/keymaps/devdev/keymap.c126
1 files changed, 126 insertions, 0 deletions
diff --git a/keyboards/minimacro5/keymaps/devdev/keymap.c b/keyboards/minimacro5/keymaps/devdev/keymap.c
new file mode 100644
index 000000000..dc5a9b0de
--- /dev/null
+++ b/keyboards/minimacro5/keymaps/devdev/keymap.c
@@ -0,0 +1,126 @@
1/* Copyright 2020 Dane Evans
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// MINI MACRO 5
17
18#include QMK_KEYBOARD_H
19
20enum layers {
21 _MAIN,
22 _MEDIA,
23 _DISCORD,
24 _PHOTOSHOP
25};
26
27// Tap Dance declarations
28enum tap_dances{
29 TD_TO_DISCORD,
30 TD_TO_PHOTOSHOP,
31 TD_TO_MEDIA,
32 TD_TO_MAIN,
33 TD_RESET_SLIDER
34
35};
36
37
38void encoder_update_user(uint8_t index, bool clockwise) {
39 if (index == 0) { /* First encoder*/
40 switch(biton32(layer_state)){
41 case _MAIN:
42 if (clockwise) {
43 tap_code(KC_VOLU);
44 } else {
45 tap_code(KC_VOLD);
46 }
47 break;
48 case _MEDIA:
49 if (clockwise) {
50 tap_code(KC_VOLU);
51 } else {
52 tap_code(KC_VOLD);
53 }
54 break;
55 case _DISCORD:
56 if (clockwise) {
57 tap_code(KC_VOLU);
58 } else {
59 tap_code(KC_VOLD);
60 }
61 break;
62 case _PHOTOSHOP:
63 if (clockwise) {
64 tap_code(KC_UP);
65 } else {
66 tap_code(KC_DOWN);
67 }
68 break;
69 default:
70 if (clockwise) {
71 tap_code(KC_VOLU);
72 } else {
73 tap_code(KC_VOLD);
74 }
75 break;
76 }
77 }
78}
79
80//
81const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //buttion closest to usb is first
82 [_MAIN] = LAYOUT_ortho_1x5(
83 TD(TD_TO_DISCORD), TO(_DISCORD), KC_C, RGB_TOG, TD(TD_TO_PHOTOSHOP)
84 ),
85 [_MEDIA] = LAYOUT_ortho_1x5(
86 TD(TD_TO_MAIN), KC_MEDIA_PREV_TRACK, KC_MEDIA_NEXT_TRACK, KC_MEDIA_PLAY_PAUSE, KC_MEDIA_STOP
87 ),
88 [_DISCORD] = LAYOUT_ortho_1x5(
89 TD(TD_TO_MAIN), TD(TD_TO_MEDIA), KC_Q, KC_R, MEH(KC_UP)
90 )
91 ,
92 [_PHOTOSHOP] = LAYOUT_ortho_1x5(
93 TD(TD_RESET_SLIDER) , C(KC_Z), C(KC_Y), KC_P, KC_G
94 )
95};
96
97layer_state_t layer_state_set_user(layer_state_t state) {
98
99 if (layer_state_cmp(state, _MAIN)) // this one not working
100 rgblight_sethsv_at(HSV_GREEN, 0);
101 if (layer_state_cmp(state, _MEDIA))
102 rgblight_sethsv_at(HSV_RED, 0);
103 if (layer_state_cmp(state, _DISCORD))
104 rgblight_sethsv_at(HSV_BLUE, 0);
105 if (layer_state_cmp(state, _PHOTOSHOP))
106 rgblight_sethsv_at(HSV_PURPLE, 0);
107 return state;
108}
109
110void keyboard_post_init_user(void) {
111 //rgblight_mode(1);
112 rgblight_sethsv_at(HSV_GREEN, 0);
113}
114
115// Tap Dance definitions
116qk_tap_dance_action_t tap_dance_actions[] = {
117 // Tap once for Escape, twice for Caps Lock
118 [TD_TO_DISCORD] = ACTION_TAP_DANCE_LAYER_MOVE(KC_MUTE, _DISCORD),
119 [TD_TO_PHOTOSHOP] = ACTION_TAP_DANCE_LAYER_MOVE(KC_E, _PHOTOSHOP),
120 [TD_TO_MEDIA] = ACTION_TAP_DANCE_LAYER_MOVE(KC_E, _MEDIA),
121 [TD_TO_MAIN] = ACTION_TAP_DANCE_LAYER_MOVE(KC_MUTE, _MAIN),
122 [TD_RESET_SLIDER] = ACTION_TAP_DANCE_LAYER_MOVE(KC_0, _MAIN)
123};
124
125
126