aboutsummaryrefslogtreecommitdiff
path: root/keyboards/dekunukem/duckypad/keymaps/default/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/dekunukem/duckypad/keymaps/default/keymap.c')
-rw-r--r--keyboards/dekunukem/duckypad/keymaps/default/keymap.c159
1 files changed, 159 insertions, 0 deletions
diff --git a/keyboards/dekunukem/duckypad/keymaps/default/keymap.c b/keyboards/dekunukem/duckypad/keymaps/default/keymap.c
new file mode 100644
index 000000000..3b30c42ff
--- /dev/null
+++ b/keyboards/dekunukem/duckypad/keymaps/default/keymap.c
@@ -0,0 +1,159 @@
1/*
2
3Default Keymap for dekuNukem/duckyPad QMK firmware
4
5Copyright (C) 2020 Max Bridgland
6
7This program is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#include QMK_KEYBOARD_H
22
23#include "stdio.h"
24#include <unistd.h>
25#include <string.h>
26
27#define LOGO_SIZE 384
28
29bool rgbToggled = false;
30
31enum layer_codes {
32 RGB_LAYER = SAFE_RANGE
33};
34
35enum my_keycodes {
36 Z0 = SAFE_RANGE, Z1, Z2,
37 Z3, Z4, Z5,
38 Z6, Z7, Z8,
39 Z9, Z10, Z11,
40 Z12, Z13, Z14
41};
42
43#define _DEFAULT 0
44#define _RGB 1
45
46
47const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
48 /*
49 ,=========================================.
50 | Numpad 1 | Numpad 2 | Numpad 3 |
51 |=========================================|
52 | Numpad 4 | Numpad 5 | Numpad 6 |
53 |=========================================|
54 | Numpad 7 | Numpad 8 | Numpad 9 |
55 |=========================================|
56 | Numpad . | Numpad 0 | Numpad = |
57 |=========================================| ,---------------------.
58 | Numpad - | Numpad + | Numpad * | | RGB Menu | Blank |
59 `=========================================' `--------------------'
60 */
61 [_DEFAULT] = LAYOUT(
62 KC_P1, KC_P2, KC_P3,
63 KC_P4, KC_P5, KC_P6,
64 KC_P7, KC_P8, KC_P9,
65 KC_PDOT, KC_P0, KC_PENT,
66 KC_PMNS, KC_PPLS, KC_EQL,
67 RGB_LAYER, KC_NO
68 ),
69 /*
70 ,=========================================.
71 | Plain RGB | Breathe RGB | Rainbow RGB |
72 |=========================================|
73 | Swirl RGB | Speed Down | Speed Up |
74 |=========================================|
75 | Effect Up | Sat. Down | Sat. Up |
76 |=========================================|
77 | Effect Down | Hue Down | Hue Up |
78 |=========================================| ,----------------------.
79 | Toggle RGB | Brt. Down | Brt. Up | | Norm Menu | Blank |
80 `=========================================' `---------------------'
81 */
82 [_RGB] = LAYOUT(
83 RGB_MODE_PLAIN, RGB_MODE_BREATHE, RGB_MODE_RAINBOW,
84 RGB_MODE_SWIRL, RGB_SPD, RGB_SPI,
85 RGB_MOD, RGB_SAD, RGB_SAI,
86 RGB_RMOD, RGB_HUD, RGB_HUI,
87 RGB_TOG, RGB_VAD, RGB_VAI,
88 RGB_LAYER, KC_NO
89 )
90};
91
92static void render_logo(void) {
93 static const char PROGMEM ducky_logo[LOGO_SIZE] = {
94 0, 0, 0, 0,128,128,128,128,128, 0, 0,252,252,252, 0, 0, 0,128,128,128, 0, 0, 0, 0, 0,128,128,128, 0, 0, 0, 0, 0,128,128,128,128,128, 0, 0, 0, 0, 0,252,252,252, 0, 0, 0, 0, 0,128,128,128,128,128,128, 0, 0, 0, 0, 0, 0,128,128,128,128, 0,248,248,248, 56, 56, 56, 56, 56, 56,120,240,224,192, 0, 0,128,128,128,128,128,128, 0, 0, 0, 0, 0, 0, 0, 0,128,128,128,128,128, 0, 0,252,252,252, 0, 0, 0, 0, 0,232, 24, 24,232, 0, 24, 48, 48, 24, 0,232, 24, 24,232, 0, 0,
95 0,248,254,255,143, 7, 3, 3, 3, 7,142,255,255,255, 0, 0, 0,255,255,255, 0, 0, 0, 0, 0,255,255,255, 0,248,254,255,143, 7, 3, 3, 3, 3,143, 7, 2, 0, 0,255,255,255,240,120,252,254,231,131, 1, 0, 1, 7, 63,254,240,192, 0,224,252,127, 31, 3, 0, 0,255,255,255,112,112,112,112,112,112, 56, 63, 31, 15,193,231,243,115, 51, 51, 51, 55,255,255,252, 0, 0,248,254,255,143, 7, 3, 3, 3, 7,142,255,255,255, 0, 0, 0, 0, 0, 21,127,127,252,252,252,253,253,252,252,252,255,255,255, 0, 0,
96 0, 0, 3, 7, 15, 15, 14, 14, 14, 7, 3, 15, 15, 15, 0, 0, 0, 3, 7, 15, 15, 14, 14, 6, 3, 15, 15, 15, 0, 0, 3, 7, 7, 15, 14, 14, 14, 14, 7, 7, 2, 0, 0, 15, 15, 15, 0, 0, 0, 1, 3, 15, 15, 12,136,224,224,224,247,127,127, 31, 3, 0, 0, 0, 0, 0, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 7, 15, 14, 14, 14, 6, 3, 15, 15, 15, 0, 0, 0, 3, 7, 15, 15, 14, 14, 14, 7, 3, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 7, 11, 3, 11, 7, 11, 7, 7, 31, 0, 0
97 };
98 oled_write_raw_P(ducky_logo, LOGO_SIZE);
99}
100
101char* make_menu_text(void){
102 char *s = malloc((30 * 6) * sizeof(*s));
103 int width = 3;
104 sprintf(s, "%-*s %-*s %-*s\n%-*s %-*s %-*s\n%-*s %-*s %-*s\n%-*s %-*s %-*s\n%-*s %-*s %-*s",
105 width, MT_0_0, width, MT_0_1, width, MT_0_2,
106 width, MT_0_3, width, MT_0_4, width, MT_0_5,
107 width, MT_0_6, width, MT_0_7, width, MT_0_8,
108 width, MT_0_9, width, MT_0_10, width,MT_0_11,
109 width, MT_0_12, width, MT_0_13, width, MT_0_14
110 );
111 return s;
112};
113
114char* make_rgb_text(void){
115 char *s = malloc((30 * 6) * sizeof(*s));
116 int width = 3;
117 sprintf(
118 s, "%-*s %-*s %-*s\n%-*s %-*s %-*s\n%-*s %-*s %-*s\n%-*s %-*s %-*s\n%-*s %-*s %-*s",
119 width, MT_1_0, width, MT_1_1, width, MT_1_2,
120 width, MT_1_3, width, MT_1_4, width, MT_1_5,
121 width, MT_1_6, width, MT_1_7, width, MT_1_8,
122 width, MT_1_9, width, MT_1_10, width,MT_1_11,
123 width, MT_1_12, width, MT_1_13, width, MT_1_14
124 );
125 return s;
126};
127
128void oled_task_user(void) {
129 render_logo();
130 oled_set_cursor(0,3);
131 if (rgbToggled) {
132 char *s = make_rgb_text();
133 oled_write_ln_P(s, false);
134 free(s);
135 } else {
136 char *s = make_menu_text();
137 oled_write_ln_P(s, false);
138 free(s);
139 }
140}
141
142bool process_record_user(uint16_t keycode, keyrecord_t *record) {
143 switch (keycode) {
144 case RGB_LAYER:
145 if (record->event.pressed) {
146 if (rgbToggled) {
147 rgbToggled = false;
148 layer_clear();
149 } else {
150 rgbToggled = true;
151 layer_on(_RGB);
152 }
153 }
154 return false;
155 default:
156 return true;
157 }
158 return false;
159}