aboutsummaryrefslogtreecommitdiff
path: root/keyboards/sendyyeah/pix/keymaps/default/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/sendyyeah/pix/keymaps/default/keymap.c')
-rw-r--r--keyboards/sendyyeah/pix/keymaps/default/keymap.c233
1 files changed, 233 insertions, 0 deletions
diff --git a/keyboards/sendyyeah/pix/keymaps/default/keymap.c b/keyboards/sendyyeah/pix/keymaps/default/keymap.c
new file mode 100644
index 000000000..ab227b9ac
--- /dev/null
+++ b/keyboards/sendyyeah/pix/keymaps/default/keymap.c
@@ -0,0 +1,233 @@
1 /* Copyright 2020 sendyyeah
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
17#include QMK_KEYBOARD_H
18
19#define LAYERNUM 2
20
21const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
22 [0] = LAYOUT(KC_MUTE, KC_MPLY, KC_MPRV, KC_MNXT, TO(1)),
23 [1] = LAYOUT(KC_TRNS, KC_MSTP, KC_MRWD, KC_MFFD, TO(0))
24};
25
26int get_icon_start_position(int key_position) {
27 if (key_position == 1) {
28 return 0;
29 } else {
30 return (key_position - 1) * 3;
31 }
32}
33
34void encoder_update_user(uint8_t index, bool clockwise) {
35 static const char PROGMEM UP_ICON[] = {0x1E,0};
36 static const char PROGMEM DOWN_ICON[] = {0x1F,0};
37 if (index == 0) {
38 if (layer_state_is(0)) {
39 if (clockwise) {
40 tap_code(KC_VOLU);
41 oled_set_cursor(get_icon_start_position(7), 3);
42 oled_write_P(PSTR(" "), false);
43 oled_set_cursor(get_icon_start_position(7), 2);
44 oled_write_P(UP_ICON, false);
45 } else {
46 tap_code(KC_VOLD);
47
48 oled_set_cursor(get_icon_start_position(7), 2);
49 oled_write_P(PSTR(" "), false);
50 oled_set_cursor(get_icon_start_position(7), 3);
51 oled_write_P(DOWN_ICON, false);
52 }
53 } else {
54 if (clockwise) {
55 tap_code(KC_BRIU);
56 oled_set_cursor(get_icon_start_position(7), 3);
57 oled_write_P(PSTR(" "), false);
58 oled_set_cursor(get_icon_start_position(7), 2);
59 oled_write_P(UP_ICON, false);
60 } else {
61 tap_code(KC_BRID);
62 oled_set_cursor(get_icon_start_position(7), 2);
63 oled_write_P(PSTR(" "), false);
64 oled_set_cursor(get_icon_start_position(7), 3);
65 oled_write_P(DOWN_ICON, false);
66 }
67 }
68 }
69}
70
71#ifdef OLED_DRIVER_ENABLE
72
73oled_rotation_t oled_init_user(oled_rotation_t rotation) {
74 return OLED_ROTATION_180;
75}
76
77void draw_mute_icon(int key_position, int row) {
78 static const char PROGMEM ICON_MUTE_0[] = {0x88, 0x89, 0};
79 static const char PROGMEM ICON_MUTE_1[] = {0xA8, 0xA9, 0};
80 oled_set_cursor(get_icon_start_position(key_position), row);
81 oled_write_P(ICON_MUTE_0, false);
82 oled_set_cursor(get_icon_start_position(key_position), row + 1);
83 oled_write_P(ICON_MUTE_1, false);
84}
85
86void draw_play_icon(int key_position, int row) {
87 static const char PROGMEM ICON_PLAY_0[] = {0x8A, 0x8B, 0};
88 static const char PROGMEM ICON_PLAY_1[] = {0xAA, 0xAB, 0};
89 oled_set_cursor(get_icon_start_position(key_position), row);
90 oled_write_P(ICON_PLAY_0, false);
91 oled_set_cursor(get_icon_start_position(key_position), row + 1);
92 oled_write_P(ICON_PLAY_1, false);
93}
94
95void draw_rewind_icon(int key_position, int row) {
96 static const char PROGMEM ICON_REWIND_0[] = {0x8C, 0x8D, 0};
97 static const char PROGMEM ICON_REWIND_1[] = {0xAC, 0xAD, 0};
98 oled_set_cursor(get_icon_start_position(key_position), row);
99 oled_write_P(ICON_REWIND_0, false);
100 oled_set_cursor(get_icon_start_position(key_position), row + 1);
101 oled_write_P(ICON_REWIND_1, false);
102}
103
104void draw_fast_forward_icon(int key_position, int row) {
105 static const char PROGMEM ICON_FAST_FORWARD_0[] = {0x8E, 0x8F, 0};
106 static const char PROGMEM ICON_FAST_FORWARD_1[] = {0xAE, 0xAF, 0};
107 oled_set_cursor(get_icon_start_position(key_position), row);
108 oled_write_P(ICON_FAST_FORWARD_0, false);
109 oled_set_cursor(get_icon_start_position(key_position), row + 1);
110 oled_write_P(ICON_FAST_FORWARD_1, false);
111}
112
113void draw_prev_icon(int key_position, int row) {
114 static const char PROGMEM ICON_PREV_0[] = {0x90, 0x91, 0};
115 static const char PROGMEM ICON_PREV_1[] = {0xB0, 0xB1, 0};
116 oled_set_cursor(get_icon_start_position(key_position), row);
117 oled_write_P(ICON_PREV_0, false);
118 oled_set_cursor(get_icon_start_position(key_position), row + 1);
119 oled_write_P(ICON_PREV_1, false);
120}
121
122void draw_next_icon(int key_position, int row) {
123 static const char PROGMEM ICON_NEXT_0[] = {0x92, 0x93, 0};
124 static const char PROGMEM ICON_NEXT_1[] = {0xB2, 0xB3, 0};
125 oled_set_cursor(get_icon_start_position(key_position), row);
126 oled_write_P(ICON_NEXT_0, false);
127 oled_set_cursor(get_icon_start_position(key_position), row + 1);
128 oled_write_P(ICON_NEXT_1, false);
129}
130
131void draw_stop_icon(int key_position, int row) {
132 static const char PROGMEM ICON_STOP_0[] = {0xA0, 0xA1, 0};
133 static const char PROGMEM ICON_STOP_1[] = {0xC0, 0xC1, 0};
134 oled_set_cursor(get_icon_start_position(key_position), row);
135 oled_write_P(ICON_STOP_0, false);
136 oled_set_cursor(get_icon_start_position(key_position), row + 1);
137 oled_write_P(ICON_STOP_1, false);
138}
139
140void draw_sound_icon(int key_position, int row) {
141 static const char PROGMEM ICON_SOUND_0[] = {0xA2, 0xA3, 0};
142 static const char PROGMEM ICON_SOUND_1[] = {0xC2, 0xC3, 0};
143 oled_set_cursor(get_icon_start_position(key_position), row);
144 oled_write_P(ICON_SOUND_0, false);
145 oled_set_cursor(get_icon_start_position(key_position), row + 1);
146 oled_write_P(ICON_SOUND_1, false);
147}
148
149void draw_raise_icon(int key_position, int row) {
150 static const char PROGMEM ICON_RAISE_0[] = {0xA4, 0xA5, 0};
151 static const char PROGMEM ICON_RAISE_1[] = {0xC4, 0xC5, 0};
152 oled_set_cursor(get_icon_start_position(key_position), row);
153 oled_write_P(ICON_RAISE_0, false);
154 oled_set_cursor(get_icon_start_position(key_position), row + 1);
155 oled_write_P(ICON_RAISE_1, false);
156}
157
158void draw_lower_icon(int key_position, int row) {
159 static const char PROGMEM ICON_LOWER_0[] = {0xA6, 0xA7, 0};
160 static const char PROGMEM ICON_LOWER_1[] = {0xC6, 0xC7, 0};
161 oled_set_cursor(get_icon_start_position(key_position), row);
162 oled_write_P(ICON_LOWER_0, false);
163 oled_set_cursor(get_icon_start_position(key_position), row + 1);
164 oled_write_P(ICON_LOWER_1, false);
165}
166
167void draw_brightness_icon(int key_position, int row) {
168 static const char PROGMEM ICON_BRIGHTNESS_0[] = {0xB9, 0xBA, 0};
169 static const char PROGMEM ICON_BRIGHTNESS_1[] = {0xD9, 0xDA, 0};
170 oled_set_cursor(get_icon_start_position(key_position), row);
171 oled_write_P(ICON_BRIGHTNESS_0, false);
172 oled_set_cursor(get_icon_start_position(key_position), row + 1);
173 oled_write_P(ICON_BRIGHTNESS_1, false);
174}
175
176void oled_task_user(void) {
177 // Host Keyboard Layer Status
178 static const char PROGMEM ICON_LAYER[] = {0x80, 0x81, 0x82, 0x83, 0};
179 static const char PROGMEM ICON_ENCODER[] = {0x84, 0x85, 0x86, 0x87, 0};
180 // static const char PROGMEM ICON_MUTE[] = {0x88, 0x89,0xA9, 0xAA};
181
182 oled_write_P(ICON_LAYER, false);
183
184 switch (get_highest_layer(layer_state)) {
185 case 0:
186 oled_write_P(PSTR("1ST "), false);
187 break;
188 case 1:
189 oled_write_P(PSTR("2ND "), false);
190 break;
191 default:
192 // Or use the write_ln shortcut over adding '\n' to the end of your string
193 oled_write_P(PSTR("UNDF"), false);
194 }
195
196 oled_write_P(PSTR(" "), false);
197
198 oled_write_P(ICON_ENCODER, false);
199 switch(get_highest_layer(layer_state)) {
200 case 0:
201 oled_write_P(PSTR("VOL "), false);
202 break;
203 case 1:
204 oled_write_P(PSTR("BRGT"), false);
205 break;
206 default:
207 // Or use the write_ln shortcut over adding '\n' to the end of your string
208 oled_write_P(PSTR("UNDF"), false);
209 }
210
211 switch(get_highest_layer(layer_state)) {
212 default:
213 case 0:
214 draw_mute_icon(1, 2);
215 draw_play_icon(2, 2);
216 draw_prev_icon(3, 2);
217 draw_next_icon(4, 2);
218 draw_raise_icon(5, 2);
219 draw_sound_icon(6, 2);
220 break;
221 case 1:
222 draw_mute_icon(1, 2);
223 draw_stop_icon(2, 2);
224 draw_rewind_icon(3, 2);
225 draw_fast_forward_icon(4, 2);
226 draw_lower_icon(5, 2);
227 draw_brightness_icon(6, 2);
228 break;
229 }
230
231}
232
233#endif