diff options
Diffstat (limited to 'keyboards/duck')
96 files changed, 5332 insertions, 0 deletions
diff --git a/keyboards/duck/duck_led/duck_led.c b/keyboards/duck/duck_led/duck_led.c new file mode 100644 index 000000000..2fa920e4b --- /dev/null +++ b/keyboards/duck/duck_led/duck_led.c | |||
@@ -0,0 +1,7 @@ | |||
1 | #include <avr/io.h> | ||
2 | #include "duck_led.h" | ||
3 | #include "quantum.h" | ||
4 | |||
5 | void show(void) { | ||
6 | wait_us((RES / 1000UL) + 1); | ||
7 | } | ||
diff --git a/keyboards/duck/duck_led/duck_led.h b/keyboards/duck/duck_led/duck_led.h new file mode 100644 index 000000000..2546366d0 --- /dev/null +++ b/keyboards/duck/duck_led/duck_led.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #define RES 6000 | ||
4 | |||
5 | #define NS_PER_SEC (1000000000L) | ||
6 | #define CYCLES_PER_SEC (F_CPU) | ||
7 | #define NS_PER_CYCLE (NS_PER_SEC / CYCLES_PER_SEC) | ||
8 | #define NS_TO_CYCLES(n) ((n) / NS_PER_CYCLE) | ||
9 | |||
10 | enum Device { | ||
11 | Device_PCBRGB, | ||
12 | Device_STATUSLED | ||
13 | }; | ||
14 | |||
15 | void show(void); | ||
16 | |||
diff --git a/keyboards/duck/eagle_viper/v2/config.h b/keyboards/duck/eagle_viper/v2/config.h new file mode 100644 index 000000000..4153f2963 --- /dev/null +++ b/keyboards/duck/eagle_viper/v2/config.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | Copyright 2017 MechMerlin <[email protected]> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #pragma once | ||
19 | |||
20 | #include "config_common.h" | ||
21 | |||
22 | /* USB Device descriptor parameter */ | ||
23 | #define VENDOR_ID 0x444B // Duck ("DK") | ||
24 | #define PRODUCT_ID 0x4556 // Eagle/Viper ("EV") | ||
25 | #define DEVICE_VER 0x0002 | ||
26 | #define MANUFACTURER Duck | ||
27 | #define PRODUCT Eagle/Viper V2 | ||
28 | |||
29 | /* key matrix size */ | ||
30 | #define MATRIX_ROWS 5 | ||
31 | #define MATRIX_COLS 15 | ||
32 | |||
33 | #define DIODE_DIRECTION COL2ROW | ||
34 | |||
35 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
36 | #define DEBOUNCE 5 | ||
37 | |||
38 | /* number of backlight levels */ | ||
39 | #define BACKLIGHT_LEVELS 3 | ||
40 | |||
41 | #define RGBLIGHT_ANIMATIONS | ||
42 | #define RGB_DI_PIN D6 | ||
43 | #define RGBLED_NUM 17 | ||
44 | |||
45 | /* Set to top left most key */ | ||
46 | #define BOOTMAGIC_LITE_ROW 4 | ||
47 | #define BOOTMAGIC_LITE_COLUMN 10 | ||
48 | |||
49 | #define TAPPING_TERM 200 | ||
diff --git a/keyboards/duck/eagle_viper/v2/indicator_leds.c b/keyboards/duck/eagle_viper/v2/indicator_leds.c new file mode 100644 index 000000000..fc90ed3fb --- /dev/null +++ b/keyboards/duck/eagle_viper/v2/indicator_leds.c | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | Copyright 2017 MechMerlin <[email protected]> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | #include <avr/interrupt.h> | ||
18 | #include <avr/io.h> | ||
19 | #include <stdbool.h> | ||
20 | #include <util/delay.h> | ||
21 | #include "indicator_leds.h" | ||
22 | #include "duck_led/duck_led.h" | ||
23 | |||
24 | #define LED_T1H 600 | ||
25 | #define LED_T1L 650 | ||
26 | #define LED_T0H 250 | ||
27 | #define LED_T0L 1000 | ||
28 | |||
29 | void send_bit_d4(bool bitVal) { | ||
30 | if(bitVal) { | ||
31 | asm volatile ( | ||
32 | "sbi %[port], %[bit] \n\t" | ||
33 | ".rept %[onCycles] \n\t" | ||
34 | "nop \n\t" | ||
35 | ".endr \n\t" | ||
36 | "cbi %[port], %[bit] \n\t" | ||
37 | ".rept %[offCycles] \n\t" | ||
38 | "nop \n\t" | ||
39 | ".endr \n\t" | ||
40 | :: | ||
41 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
42 | [bit] "I" (4), | ||
43 | [onCycles] "I" (NS_TO_CYCLES(LED_T1H) - 2), | ||
44 | [offCycles] "I" (NS_TO_CYCLES(LED_T1L) - 2)); | ||
45 | } else { | ||
46 | asm volatile ( | ||
47 | "sbi %[port], %[bit] \n\t" | ||
48 | ".rept %[onCycles] \n\t" | ||
49 | "nop \n\t" | ||
50 | ".endr \n\t" | ||
51 | "cbi %[port], %[bit] \n\t" | ||
52 | ".rept %[offCycles] \n\t" | ||
53 | "nop \n\t" | ||
54 | ".endr \n\t" | ||
55 | :: | ||
56 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
57 | [bit] "I" (4), | ||
58 | [onCycles] "I" (NS_TO_CYCLES(LED_T0H) - 2), | ||
59 | [offCycles] "I" (NS_TO_CYCLES(LED_T0L) - 2)); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | void send_value(uint8_t byte, enum Device device) { | ||
64 | for(uint8_t b = 0; b < 8; b++) { | ||
65 | if(device == Device_STATUSLED) { | ||
66 | send_bit_d4(byte & 0b10000000); | ||
67 | byte <<= 1; | ||
68 | } | ||
69 | } | ||
70 | } | ||
71 | |||
72 | // Send the LED indicators to the WS2811S chips | ||
73 | void indicator_leds_set(bool leds[8]) { | ||
74 | uint8_t led_cnt; | ||
75 | |||
76 | cli(); | ||
77 | for(led_cnt = 0; led_cnt < 8; led_cnt++) | ||
78 | send_value(leds[led_cnt] ? 255 : 0, Device_STATUSLED); | ||
79 | sei(); | ||
80 | show(); | ||
81 | } | ||
82 | |||
diff --git a/keyboards/duck/eagle_viper/v2/indicator_leds.h b/keyboards/duck/eagle_viper/v2/indicator_leds.h new file mode 100644 index 000000000..fe66eef6b --- /dev/null +++ b/keyboards/duck/eagle_viper/v2/indicator_leds.h | |||
@@ -0,0 +1 @@ | |||
void indicator_leds_set(bool leds[8]); | |||
diff --git a/keyboards/duck/eagle_viper/v2/info.json b/keyboards/duck/eagle_viper/v2/info.json new file mode 100644 index 000000000..57d6af4fa --- /dev/null +++ b/keyboards/duck/eagle_viper/v2/info.json | |||
@@ -0,0 +1,362 @@ | |||
1 | { | ||
2 | "keyboard_name": "Eagle/Viper V2", | ||
3 | "layout_aliases": { | ||
4 | "LAYOUT_eagle": "LAYOUT_60_ansi", | ||
5 | "LAYOUT_viper": "LAYOUT_60_hhkb", | ||
6 | "LAYOUT_eagle_splits": "LAYOUT_60_ansi_split_bs_lshift_rshift" | ||
7 | }, | ||
8 | "layouts": { | ||
9 | "LAYOUT_all": { | ||
10 | "layout": [ | ||
11 | {"label":"Esc", "x":0, "y":0}, | ||
12 | {"label":"!", "x":1, "y":0}, | ||
13 | {"label":"@", "x":2, "y":0}, | ||
14 | {"label":"#", "x":3, "y":0}, | ||
15 | {"label":"$", "x":4, "y":0}, | ||
16 | {"label":"%", "x":5, "y":0}, | ||
17 | {"label":"^", "x":6, "y":0}, | ||
18 | {"label":"&", "x":7, "y":0}, | ||
19 | {"label":"*", "x":8, "y":0}, | ||
20 | {"label":"(", "x":9, "y":0}, | ||
21 | {"label":")", "x":10, "y":0}, | ||
22 | {"label":"_", "x":11, "y":0}, | ||
23 | {"label":"+", "x":12, "y":0}, | ||
24 | {"label":"|", "x":13, "y":0}, | ||
25 | {"label":"~", "x":14, "y":0}, | ||
26 | |||
27 | {"label":"Tab", "x":0, "y":1, "w":1.5}, | ||
28 | {"label":"Q", "x":1.5, "y":1}, | ||
29 | {"label":"W", "x":2.5, "y":1}, | ||
30 | {"label":"E", "x":3.5, "y":1}, | ||
31 | {"label":"R", "x":4.5, "y":1}, | ||
32 | {"label":"T", "x":5.5, "y":1}, | ||
33 | {"label":"Y", "x":6.5, "y":1}, | ||
34 | {"label":"U", "x":7.5, "y":1}, | ||
35 | {"label":"I", "x":8.5, "y":1}, | ||
36 | {"label":"O", "x":9.5, "y":1}, | ||
37 | {"label":"P", "x":10.5, "y":1}, | ||
38 | {"label":"{", "x":11.5, "y":1}, | ||
39 | {"label":"}", "x":12.5, "y":1}, | ||
40 | {"label":"Backspace", "x":13.5, "y":1, "w":1.5}, | ||
41 | |||
42 | {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, | ||
43 | {"label":"A", "x":1.75, "y":2}, | ||
44 | {"label":"S", "x":2.75, "y":2}, | ||
45 | {"label":"D", "x":3.75, "y":2}, | ||
46 | {"label":"F", "x":4.75, "y":2}, | ||
47 | {"label":"G", "x":5.75, "y":2}, | ||
48 | {"label":"H", "x":6.75, "y":2}, | ||
49 | {"label":"J", "x":7.75, "y":2}, | ||
50 | {"label":"K", "x":8.75, "y":2}, | ||
51 | {"label":"L", "x":9.75, "y":2}, | ||
52 | {"label":":", "x":10.75, "y":2}, | ||
53 | {"label":"\"", "x":11.75, "y":2}, | ||
54 | {"label":"ISO#", "x":12.75, "y":2}, | ||
55 | {"label":"Enter", "x":13.75, "y":2, "w":1.25}, | ||
56 | |||
57 | {"label":"Shift", "x":0, "y":3, "w":1.25}, | ||
58 | {"label":"ISO\\", "x":1.25, "y":3}, | ||
59 | {"label":"Z", "x":2.25, "y":3}, | ||
60 | {"label":"X", "x":3.25, "y":3}, | ||
61 | {"label":"C", "x":4.25, "y":3}, | ||
62 | {"label":"V", "x":5.25, "y":3}, | ||
63 | {"label":"B", "x":6.25, "y":3}, | ||
64 | {"label":"N", "x":7.25, "y":3}, | ||
65 | {"label":"M", "x":8.25, "y":3}, | ||
66 | {"label":"<", "x":9.25, "y":3}, | ||
67 | {"label":">", "x":10.25, "y":3}, | ||
68 | {"label":"?", "x":11.25, "y":3}, | ||
69 | {"label":"Shift", "x":12.25, "y":3, "w":1.75}, | ||
70 | {"label":"Fn", "x":14, "y":3}, | ||
71 | |||
72 | {"label":"Ctrl", "x":0, "y":4, "w":1.25}, | ||
73 | {"label":"GUI", "x":1.25, "y":4, "w":1.25}, | ||
74 | {"label":"Alt", "x":2.5, "y":4, "w":1.25}, | ||
75 | {"x":3.75, "y":4, "w":6.25}, | ||
76 | {"label":"Alt", "x":10, "y":4, "w":1.25}, | ||
77 | {"label":"GUI", "x":11.25, "y":4, "w":1.25}, | ||
78 | {"label":"Menu", "x":12.5, "y":4, "w":1.25}, | ||
79 | {"label":"Ctrl", "x":13.75, "y":4, "w":1.25} | ||
80 | ] | ||
81 | }, | ||
82 | "LAYOUT_60_ansi": { | ||
83 | "layout": [ | ||
84 | {"label":"~", "x":0, "y":0}, | ||
85 | {"label":"!", "x":1, "y":0}, | ||
86 | {"label":"@", "x":2, "y":0}, | ||
87 | {"label":"#", "x":3, "y":0}, | ||
88 | {"label":"$", "x":4, "y":0}, | ||
89 | {"label":"%", "x":5, "y":0}, | ||
90 | {"label":"^", "x":6, "y":0}, | ||
91 | {"label":"&", "x":7, "y":0}, | ||
92 | {"label":"*", "x":8, "y":0}, | ||
93 | {"label":"(", "x":9, "y":0}, | ||
94 | {"label":")", "x":10, "y":0}, | ||
95 | {"label":"_", "x":11, "y":0}, | ||
96 | {"label":"+", "x":12, "y":0}, | ||
97 | {"label":"Backspace", "x":13, "y":0, "w":2}, | ||
98 | |||
99 | {"label":"Tab", "x":0, "y":1, "w":1.5}, | ||
100 | {"label":"Q", "x":1.5, "y":1}, | ||
101 | {"label":"W", "x":2.5, "y":1}, | ||
102 | {"label":"E", "x":3.5, "y":1}, | ||
103 | {"label":"R", "x":4.5, "y":1}, | ||
104 | {"label":"T", "x":5.5, "y":1}, | ||
105 | {"label":"Y", "x":6.5, "y":1}, | ||
106 | {"label":"U", "x":7.5, "y":1}, | ||
107 | {"label":"I", "x":8.5, "y":1}, | ||
108 | {"label":"O", "x":9.5, "y":1}, | ||
109 | {"label":"P", "x":10.5, "y":1}, | ||
110 | {"label":"{", "x":11.5, "y":1}, | ||
111 | {"label":"}", "x":12.5, "y":1}, | ||
112 | {"label":"|", "x":13.5, "y":1, "w":1.5}, | ||
113 | |||
114 | {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, | ||
115 | {"label":"A", "x":1.75, "y":2}, | ||
116 | {"label":"S", "x":2.75, "y":2}, | ||
117 | {"label":"D", "x":3.75, "y":2}, | ||
118 | {"label":"F", "x":4.75, "y":2}, | ||
119 | {"label":"G", "x":5.75, "y":2}, | ||
120 | {"label":"H", "x":6.75, "y":2}, | ||
121 | {"label":"J", "x":7.75, "y":2}, | ||
122 | {"label":"K", "x":8.75, "y":2}, | ||
123 | {"label":"L", "x":9.75, "y":2}, | ||
124 | {"label":":", "x":10.75, "y":2}, | ||
125 | {"label":"\"", "x":11.75, "y":2}, | ||
126 | {"label":"Enter", "x":12.75, "y":2, "w":2.25}, | ||
127 | |||
128 | {"label":"Shift", "x":0, "y":3, "w":2.25}, | ||
129 | {"label":"Z", "x":2.25, "y":3}, | ||
130 | {"label":"X", "x":3.25, "y":3}, | ||
131 | {"label":"C", "x":4.25, "y":3}, | ||
132 | {"label":"V", "x":5.25, "y":3}, | ||
133 | {"label":"B", "x":6.25, "y":3}, | ||
134 | {"label":"N", "x":7.25, "y":3}, | ||
135 | {"label":"M", "x":8.25, "y":3}, | ||
136 | {"label":"<", "x":9.25, "y":3}, | ||
137 | {"label":">", "x":10.25, "y":3}, | ||
138 | {"label":"?", "x":11.25, "y":3}, | ||
139 | {"label":"Shift", "x":12.25, "y":3, "w":2.75}, | ||
140 | |||
141 | {"label":"Ctrl", "x":0, "y":4, "w":1.25}, | ||
142 | {"label":"GUI", "x":1.25, "y":4, "w":1.25}, | ||
143 | {"label":"Alt", "x":2.5, "y":4, "w":1.25}, | ||
144 | {"x":3.75, "y":4, "w":6.25}, | ||
145 | {"label":"Alt", "x":10, "y":4, "w":1.25}, | ||
146 | {"label":"GUI", "x":11.25, "y":4, "w":1.25}, | ||
147 | {"label":"Menu", "x":12.5, "y":4, "w":1.25}, | ||
148 | {"label":"Ctrl", "x":13.75, "y":4, "w":1.25} | ||
149 | ] | ||
150 | }, | ||
151 | "LAYOUT_60_ansi_split_bs_rshift": { | ||
152 | "layout": [ | ||
153 | {"label":"~", "x":0, "y":0}, | ||
154 | {"label":"!", "x":1, "y":0}, | ||
155 | {"label":"@", "x":2, "y":0}, | ||
156 | {"label":"#", "x":3, "y":0}, | ||
157 | {"label":"$", "x":4, "y":0}, | ||
158 | {"label":"%", "x":5, "y":0}, | ||
159 | {"label":"^", "x":6, "y":0}, | ||
160 | {"label":"&", "x":7, "y":0}, | ||
161 | {"label":"*", "x":8, "y":0}, | ||
162 | {"label":"(", "x":9, "y":0}, | ||
163 | {"label":")", "x":10, "y":0}, | ||
164 | {"label":"_", "x":11, "y":0}, | ||
165 | {"label":"+", "x":12, "y":0}, | ||
166 | {"x":13, "y":0}, | ||
167 | {"x":14, "y":0}, | ||
168 | |||
169 | {"label":"Tab", "x":0, "y":1, "w":1.5}, | ||
170 | {"label":"Q", "x":1.5, "y":1}, | ||
171 | {"label":"W", "x":2.5, "y":1}, | ||
172 | {"label":"E", "x":3.5, "y":1}, | ||
173 | {"label":"R", "x":4.5, "y":1}, | ||
174 | {"label":"T", "x":5.5, "y":1}, | ||
175 | {"label":"Y", "x":6.5, "y":1}, | ||
176 | {"label":"U", "x":7.5, "y":1}, | ||
177 | {"label":"I", "x":8.5, "y":1}, | ||
178 | {"label":"O", "x":9.5, "y":1}, | ||
179 | {"label":"P", "x":10.5, "y":1}, | ||
180 | {"label":"{", "x":11.5, "y":1}, | ||
181 | {"label":"}", "x":12.5, "y":1}, | ||
182 | {"label":"|", "x":13.5, "y":1, "w":1.5}, | ||
183 | |||
184 | {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, | ||
185 | {"label":"A", "x":1.75, "y":2}, | ||
186 | {"label":"S", "x":2.75, "y":2}, | ||
187 | {"label":"D", "x":3.75, "y":2}, | ||
188 | {"label":"F", "x":4.75, "y":2}, | ||
189 | {"label":"G", "x":5.75, "y":2}, | ||
190 | {"label":"H", "x":6.75, "y":2}, | ||
191 | {"label":"J", "x":7.75, "y":2}, | ||
192 | {"label":"K", "x":8.75, "y":2}, | ||
193 | {"label":"L", "x":9.75, "y":2}, | ||
194 | {"label":":", "x":10.75, "y":2}, | ||
195 | {"label":"\"", "x":11.75, "y":2}, | ||
196 | {"label":"Enter", "x":12.75, "y":2, "w":2.25}, | ||
197 | |||
198 | {"label":"Shift", "x":0, "y":3, "w":2.25}, | ||
199 | {"label":"Z", "x":2.25, "y":3}, | ||
200 | {"label":"X", "x":3.25, "y":3}, | ||
201 | {"label":"C", "x":4.25, "y":3}, | ||
202 | {"label":"V", "x":5.25, "y":3}, | ||
203 | {"label":"B", "x":6.25, "y":3}, | ||
204 | {"label":"N", "x":7.25, "y":3}, | ||
205 | {"label":"M", "x":8.25, "y":3}, | ||
206 | {"label":"<", "x":9.25, "y":3}, | ||
207 | {"label":">", "x":10.25, "y":3}, | ||
208 | {"label":"?", "x":11.25, "y":3}, | ||
209 | {"label":"Shift", "x":12.25, "y":3, "w":1.75}, | ||
210 | {"x":14, "y":3}, | ||
211 | |||
212 | {"label":"Ctrl", "x":0, "y":4, "w":1.25}, | ||
213 | {"label":"GUI", "x":1.25, "y":4, "w":1.25}, | ||
214 | {"label":"Alt", "x":2.5, "y":4, "w":1.25}, | ||
215 | {"x":3.75, "y":4, "w":6.25}, | ||
216 | {"label":"Alt", "x":10, "y":4, "w":1.25}, | ||
217 | {"label":"GUI", "x":11.25, "y":4, "w":1.25}, | ||
218 | {"label":"Menu", "x":12.5, "y":4, "w":1.25}, | ||
219 | {"label":"Ctrl", "x":13.75, "y":4, "w":1.25} | ||
220 | ] | ||
221 | }, | ||
222 | "LAYOUT_60_ansi_split_bs_lshift_rshift": { | ||
223 | "layout": [ | ||
224 | {"label":"~", "x":0, "y":0}, | ||
225 | {"label":"!", "x":1, "y":0}, | ||
226 | {"label":"@", "x":2, "y":0}, | ||
227 | {"label":"#", "x":3, "y":0}, | ||
228 | {"label":"$", "x":4, "y":0}, | ||
229 | {"label":"%", "x":5, "y":0}, | ||
230 | {"label":"^", "x":6, "y":0}, | ||
231 | {"label":"&", "x":7, "y":0}, | ||
232 | {"label":"*", "x":8, "y":0}, | ||
233 | {"label":"(", "x":9, "y":0}, | ||
234 | {"label":")", "x":10, "y":0}, | ||
235 | {"label":"_", "x":11, "y":0}, | ||
236 | {"label":"+", "x":12, "y":0}, | ||
237 | {"x":13, "y":0}, | ||
238 | {"x":14, "y":0}, | ||
239 | |||
240 | {"label":"Tab", "x":0, "y":1, "w":1.5}, | ||
241 | {"label":"Q", "x":1.5, "y":1}, | ||
242 | {"label":"W", "x":2.5, "y":1}, | ||
243 | {"label":"E", "x":3.5, "y":1}, | ||
244 | {"label":"R", "x":4.5, "y":1}, | ||
245 | {"label":"T", "x":5.5, "y":1}, | ||
246 | {"label":"Y", "x":6.5, "y":1}, | ||
247 | {"label":"U", "x":7.5, "y":1}, | ||
248 | {"label":"I", "x":8.5, "y":1}, | ||
249 | {"label":"O", "x":9.5, "y":1}, | ||
250 | {"label":"P", "x":10.5, "y":1}, | ||
251 | {"label":"{", "x":11.5, "y":1}, | ||
252 | {"label":"}", "x":12.5, "y":1}, | ||
253 | {"label":"|", "x":13.5, "y":1, "w":1.5}, | ||
254 | |||
255 | {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, | ||
256 | {"label":"A", "x":1.75, "y":2}, | ||
257 | {"label":"S", "x":2.75, "y":2}, | ||
258 | {"label":"D", "x":3.75, "y":2}, | ||
259 | {"label":"F", "x":4.75, "y":2}, | ||
260 | {"label":"G", "x":5.75, "y":2}, | ||
261 | {"label":"H", "x":6.75, "y":2}, | ||
262 | {"label":"J", "x":7.75, "y":2}, | ||
263 | {"label":"K", "x":8.75, "y":2}, | ||
264 | {"label":"L", "x":9.75, "y":2}, | ||
265 | {"label":":", "x":10.75, "y":2}, | ||
266 | {"label":"\"", "x":11.75, "y":2}, | ||
267 | {"label":"Enter", "x":12.75, "y":2, "w":2.25}, | ||
268 | |||
269 | {"label":"Shift", "x":0, "y":3, "w":1.25}, | ||
270 | {"x":1.25, "y":3}, | ||
271 | {"label":"Z", "x":2.25, "y":3}, | ||
272 | {"label":"X", "x":3.25, "y":3}, | ||
273 | {"label":"C", "x":4.25, "y":3}, | ||
274 | {"label":"V", "x":5.25, "y":3}, | ||
275 | {"label":"B", "x":6.25, "y":3}, | ||
276 | {"label":"N", "x":7.25, "y":3}, | ||
277 | {"label":"M", "x":8.25, "y":3}, | ||
278 | {"label":"<", "x":9.25, "y":3}, | ||
279 | {"label":">", "x":10.25, "y":3}, | ||
280 | {"label":"?", "x":11.25, "y":3}, | ||
281 | {"label":"Shift", "x":12.25, "y":3, "w":1.75}, | ||
282 | {"x":14, "y":3}, | ||
283 | |||
284 | {"label":"Ctrl", "x":0, "y":4, "w":1.25}, | ||
285 | {"label":"GUI", "x":1.25, "y":4, "w":1.25}, | ||
286 | {"label":"Alt", "x":2.5, "y":4, "w":1.25}, | ||
287 | {"x":3.75, "y":4, "w":6.25}, | ||
288 | {"label":"Alt", "x":10, "y":4, "w":1.25}, | ||
289 | {"label":"GUI", "x":11.25, "y":4, "w":1.25}, | ||
290 | {"label":"Menu", "x":12.5, "y":4, "w":1.25}, | ||
291 | {"label":"Ctrl", "x":13.75, "y":4, "w":1.25} | ||
292 | ] | ||
293 | }, | ||
294 | "LAYOUT_60_hhkb": { | ||
295 | "layout": [ | ||
296 | {"label":"~", "x":0, "y":0}, | ||
297 | {"label":"!", "x":1, "y":0}, | ||
298 | {"label":"@", "x":2, "y":0}, | ||
299 | {"label":"#", "x":3, "y":0}, | ||
300 | {"label":"$", "x":4, "y":0}, | ||
301 | {"label":"%", "x":5, "y":0}, | ||
302 | {"label":"^", "x":6, "y":0}, | ||
303 | {"label":"&", "x":7, "y":0}, | ||
304 | {"label":"*", "x":8, "y":0}, | ||
305 | {"label":"(", "x":9, "y":0}, | ||
306 | {"label":")", "x":10, "y":0}, | ||
307 | {"label":"_", "x":11, "y":0}, | ||
308 | {"label":"+", "x":12, "y":0}, | ||
309 | {"x":13, "y":0}, | ||
310 | {"x":14, "y":0}, | ||
311 | |||
312 | {"label":"Tab", "x":0, "y":1, "w":1.5}, | ||
313 | {"label":"Q", "x":1.5, "y":1}, | ||
314 | {"label":"W", "x":2.5, "y":1}, | ||
315 | {"label":"E", "x":3.5, "y":1}, | ||
316 | {"label":"R", "x":4.5, "y":1}, | ||
317 | {"label":"T", "x":5.5, "y":1}, | ||
318 | {"label":"Y", "x":6.5, "y":1}, | ||
319 | {"label":"U", "x":7.5, "y":1}, | ||
320 | {"label":"I", "x":8.5, "y":1}, | ||
321 | {"label":"O", "x":9.5, "y":1}, | ||
322 | {"label":"P", "x":10.5, "y":1}, | ||
323 | {"label":"{", "x":11.5, "y":1}, | ||
324 | {"label":"}", "x":12.5, "y":1}, | ||
325 | {"label":"|", "x":13.5, "y":1, "w":1.5}, | ||
326 | |||
327 | {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, | ||
328 | {"label":"A", "x":1.75, "y":2}, | ||
329 | {"label":"S", "x":2.75, "y":2}, | ||
330 | {"label":"D", "x":3.75, "y":2}, | ||
331 | {"label":"F", "x":4.75, "y":2}, | ||
332 | {"label":"G", "x":5.75, "y":2}, | ||
333 | {"label":"H", "x":6.75, "y":2}, | ||
334 | {"label":"J", "x":7.75, "y":2}, | ||
335 | {"label":"K", "x":8.75, "y":2}, | ||
336 | {"label":"L", "x":9.75, "y":2}, | ||
337 | {"label":":", "x":10.75, "y":2}, | ||
338 | {"label":"\"", "x":11.75, "y":2}, | ||
339 | {"label":"Enter", "x":12.75, "y":2, "w":2.25}, | ||
340 | |||
341 | {"label":"Shift", "x":0, "y":3, "w":2.25}, | ||
342 | {"label":"Z", "x":2.25, "y":3}, | ||
343 | {"label":"X", "x":3.25, "y":3}, | ||
344 | {"label":"C", "x":4.25, "y":3}, | ||
345 | {"label":"V", "x":5.25, "y":3}, | ||
346 | {"label":"B", "x":6.25, "y":3}, | ||
347 | {"label":"N", "x":7.25, "y":3}, | ||
348 | {"label":"M", "x":8.25, "y":3}, | ||
349 | {"label":"<", "x":9.25, "y":3}, | ||
350 | {"label":">", "x":10.25, "y":3}, | ||
351 | {"label":"?", "x":11.25, "y":3}, | ||
352 | {"label":"Shift", "x":12.25, "y":3, "w":1.75}, | ||
353 | {"x":14, "y":3}, | ||
354 | {"label":"GUI", "x":1.5, "y":4}, | ||
355 | {"label":"Alt", "x":2.5, "y":4, "w":1.5}, | ||
356 | {"x":4, "y":4, "w":7}, | ||
357 | {"label":"Alt", "x":11, "y":4, "w":1.5}, | ||
358 | {"label":"GUI", "x":12.5, "y":4} | ||
359 | ] | ||
360 | } | ||
361 | } | ||
362 | } | ||
diff --git a/keyboards/duck/eagle_viper/v2/keymaps/default/keymap.c b/keyboards/duck/eagle_viper/v2/keymaps/default/keymap.c new file mode 100644 index 000000000..cfcc59fec --- /dev/null +++ b/keyboards/duck/eagle_viper/v2/keymaps/default/keymap.c | |||
@@ -0,0 +1,35 @@ | |||
1 | /* Copyright 2017 MechMerlin <[email protected]> | ||
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 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
19 | /* layer 0: qwerty */ | ||
20 | [0] = LAYOUT_all( | ||
21 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, XXXXXXX, KC_BSPC, | ||
22 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, | ||
23 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXXX, KC_ENT, | ||
24 | KC_LSFT, XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, XXXXXXX, | ||
25 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_RALT, KC_RGUI, KC_RCTL | ||
26 | ), | ||
27 | |||
28 | [1] = LAYOUT_all( | ||
29 | _______, RGB_TOG, RGB_MOD, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
30 | _______, _______, _______, _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
31 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
32 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
33 | _______, _______, _______, _______, _______, _______, _______, _______ | ||
34 | ), | ||
35 | }; | ||
diff --git a/keyboards/duck/eagle_viper/v2/keymaps/default/readme.md b/keyboards/duck/eagle_viper/v2/keymaps/default/readme.md new file mode 100644 index 000000000..834ff7cd3 --- /dev/null +++ b/keyboards/duck/eagle_viper/v2/keymaps/default/readme.md | |||
@@ -0,0 +1,10 @@ | |||
1 | # Default Eagle Layout | ||
2 | |||
3 | This is the default implement layout for Duck Eagle V2. | ||
4 | |||
5 |  | ||
6 | |||
7 | |||
8 | ## Features | ||
9 | |||
10 | * Default QWERTY layer | ||
diff --git a/keyboards/duck/eagle_viper/v2/keymaps/profanum429/keymap.c b/keyboards/duck/eagle_viper/v2/keymaps/profanum429/keymap.c new file mode 100644 index 000000000..6c6cfbd2f --- /dev/null +++ b/keyboards/duck/eagle_viper/v2/keymaps/profanum429/keymap.c | |||
@@ -0,0 +1,35 @@ | |||
1 | /* Copyright 2017 MechMerlin <[email protected]> | ||
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 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
19 | /* layer 0: qwerty */ | ||
20 | [0] = LAYOUT_viper( \ | ||
21 | KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, \ | ||
22 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, \ | ||
23 | KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ | ||
24 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1), \ | ||
25 | KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI \ | ||
26 | ), | ||
27 | |||
28 | [1] = LAYOUT_viper( \ | ||
29 | _______, 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_INS, KC_DEL, \ | ||
30 | KC_CAPS, RGB_TOG, RGB_MOD, RGB_VAI, RESET, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______, KC_BSPC, \ | ||
31 | _______, KC_VOLU, KC_VOLD, KC_MUTE, _______, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_ENT, \ | ||
32 | _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, \ | ||
33 | _______, _______, _______, _______, _______ \ | ||
34 | ), | ||
35 | }; | ||
diff --git a/keyboards/duck/eagle_viper/v2/keymaps/profanum429/readme.md b/keyboards/duck/eagle_viper/v2/keymaps/profanum429/readme.md new file mode 100644 index 000000000..0f993559e --- /dev/null +++ b/keyboards/duck/eagle_viper/v2/keymaps/profanum429/readme.md | |||
@@ -0,0 +1,5 @@ | |||
1 | # Profanum429 Duck Viper V2 Layout | ||
2 | TODO | ||
3 | |||
4 | ## Features | ||
5 | TODO | ||
diff --git a/keyboards/duck/eagle_viper/v2/keymaps/via/keymap.c b/keyboards/duck/eagle_viper/v2/keymaps/via/keymap.c new file mode 100644 index 000000000..4851197af --- /dev/null +++ b/keyboards/duck/eagle_viper/v2/keymaps/via/keymap.c | |||
@@ -0,0 +1,51 @@ | |||
1 | /* Copyright 2020 MechMerlin <[email protected]> | ||
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 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
19 | /* layer 0: qwerty */ | ||
20 | [0] = LAYOUT_all( | ||
21 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, XXXXXXX, KC_BSPC, | ||
22 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, | ||
23 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXXX, KC_ENT, | ||
24 | KC_LSFT, XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, XXXXXXX, | ||
25 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_RALT, KC_RGUI, KC_RCTL | ||
26 | ), | ||
27 | |||
28 | [1] = LAYOUT_all( | ||
29 | _______, RGB_TOG, RGB_MOD, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
30 | _______, _______, _______, _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
31 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
32 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
33 | _______, _______, _______, _______, _______, _______, _______, _______ | ||
34 | ), | ||
35 | |||
36 | [2] = LAYOUT_all( | ||
37 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
38 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
39 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
40 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
41 | _______, _______, _______, _______, _______, _______, _______, _______ | ||
42 | ), | ||
43 | |||
44 | [3] = LAYOUT_all( | ||
45 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
46 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
47 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
48 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
49 | _______, _______, _______, _______, _______, _______, _______, _______ | ||
50 | ) | ||
51 | }; | ||
diff --git a/keyboards/duck/eagle_viper/v2/keymaps/via/readme.md b/keyboards/duck/eagle_viper/v2/keymaps/via/readme.md new file mode 100644 index 000000000..834ff7cd3 --- /dev/null +++ b/keyboards/duck/eagle_viper/v2/keymaps/via/readme.md | |||
@@ -0,0 +1,10 @@ | |||
1 | # Default Eagle Layout | ||
2 | |||
3 | This is the default implement layout for Duck Eagle V2. | ||
4 | |||
5 |  | ||
6 | |||
7 | |||
8 | ## Features | ||
9 | |||
10 | * Default QWERTY layer | ||
diff --git a/keyboards/duck/eagle_viper/v2/keymaps/via/rules.mk b/keyboards/duck/eagle_viper/v2/keymaps/via/rules.mk new file mode 100644 index 000000000..36b7ba9cb --- /dev/null +++ b/keyboards/duck/eagle_viper/v2/keymaps/via/rules.mk | |||
@@ -0,0 +1,2 @@ | |||
1 | VIA_ENABLE = yes | ||
2 | LTO_ENABLE = yes | ||
diff --git a/keyboards/duck/eagle_viper/v2/matrix.c b/keyboards/duck/eagle_viper/v2/matrix.c new file mode 100644 index 000000000..0964493ac --- /dev/null +++ b/keyboards/duck/eagle_viper/v2/matrix.c | |||
@@ -0,0 +1,258 @@ | |||
1 | /* | ||
2 | Copyright 2017 MechMerlin <[email protected]> | ||
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 <util/delay.h> | ||
18 | #include <avr/io.h> | ||
19 | #include <stdio.h> | ||
20 | #include "matrix.h" | ||
21 | #include "util.h" | ||
22 | #include "print.h" | ||
23 | #include "debug.h" | ||
24 | |||
25 | static uint8_t debouncing = DEBOUNCE; | ||
26 | |||
27 | /* matrix state(1:on, 0:off) */ | ||
28 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
29 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
30 | |||
31 | static uint8_t read_rows(uint8_t col); | ||
32 | static void init_rows(void); | ||
33 | static void unselect_cols(void); | ||
34 | static void select_col(uint8_t col); | ||
35 | |||
36 | |||
37 | __attribute__ ((weak)) | ||
38 | void matrix_init_kb(void) { | ||
39 | matrix_init_user(); | ||
40 | } | ||
41 | |||
42 | __attribute__ ((weak)) | ||
43 | void matrix_scan_kb(void) { | ||
44 | matrix_scan_user(); | ||
45 | } | ||
46 | |||
47 | __attribute__ ((weak)) | ||
48 | void matrix_init_user(void) { | ||
49 | } | ||
50 | |||
51 | __attribute__ ((weak)) | ||
52 | void matrix_scan_user(void) { | ||
53 | } | ||
54 | |||
55 | void backlight_init_ports(void) | ||
56 | { | ||
57 | DDRD |= 0b11010000; | ||
58 | PORTD &= ~0b01010000; | ||
59 | PORTD |= 0b10000000; | ||
60 | DDRB |= 0b00011111; | ||
61 | PORTB &= ~0b00001110; | ||
62 | PORTB |= 0b00010001; | ||
63 | DDRE |= 0b01000000; | ||
64 | PORTE &= ~0b01000000; | ||
65 | } | ||
66 | |||
67 | void matrix_init(void) { | ||
68 | backlight_init_ports(); | ||
69 | unselect_cols(); | ||
70 | init_rows(); | ||
71 | |||
72 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | ||
73 | matrix[i] = 0; | ||
74 | matrix_debouncing[i] = 0; | ||
75 | } | ||
76 | |||
77 | matrix_init_quantum(); | ||
78 | } | ||
79 | |||
80 | uint8_t matrix_scan(void) { | ||
81 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { | ||
82 | select_col(col); | ||
83 | _delay_us(3); | ||
84 | |||
85 | uint8_t rows = read_rows(col); | ||
86 | |||
87 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
88 | bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col); | ||
89 | bool curr_bit = rows & (1<<row); | ||
90 | if (prev_bit != curr_bit) { | ||
91 | matrix_debouncing[row] ^= ((matrix_row_t)1<<col); | ||
92 | if (debouncing) { | ||
93 | dprint("bounce!: "); dprintf("%02X", debouncing); dprintln(); | ||
94 | } | ||
95 | debouncing = DEBOUNCE; | ||
96 | } | ||
97 | } | ||
98 | unselect_cols(); | ||
99 | } | ||
100 | |||
101 | if (debouncing) { | ||
102 | if (--debouncing) { | ||
103 | _delay_ms(1); | ||
104 | } else { | ||
105 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
106 | matrix[i] = matrix_debouncing[i]; | ||
107 | } | ||
108 | } | ||
109 | } | ||
110 | |||
111 | matrix_scan_quantum(); | ||
112 | return 1; | ||
113 | } | ||
114 | |||
115 | inline matrix_row_t matrix_get_row(uint8_t row) { | ||
116 | return matrix[row]; | ||
117 | } | ||
118 | |||
119 | void matrix_print(void) { | ||
120 | print("\nr/c 0123456789ABCDEF\n"); | ||
121 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
122 | xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row))); | ||
123 | } | ||
124 | } | ||
125 | |||
126 | /* Row pin configuration - diode connected | ||
127 | * row: 0 1 2 3 4 | ||
128 | * pin: PD0 PD1 PD2 PD3 PD5 | ||
129 | * | ||
130 | * Caps Lock uses its own pin PE2 on the column pin, row pin is grounded | ||
131 | */ | ||
132 | static void init_rows(void) { | ||
133 | DDRD &= ~0b00101111; | ||
134 | PORTD &= ~0b00101111; | ||
135 | |||
136 | DDRE &= ~0b00000100; | ||
137 | PORTE |= 0b00000100; | ||
138 | } | ||
139 | |||
140 | static uint8_t read_rows(uint8_t col) { | ||
141 | |||
142 | return (PIND&(1<<0) ? (1<<0) : 0) | | ||
143 | (PIND&(1<<1) ? (1<<1) : 0) | | ||
144 | (PIND&(1<<2) ? (1<<2) : 0) | | ||
145 | (PIND&(1<<3) ? (1<<3) : 0) | | ||
146 | (PIND&(1<<5) ? (1<<4) : 0) | | ||
147 | (col==0 ? ((PINE&(1<<2) ? 0 : (1<<2))) : 0); | ||
148 | |||
149 | } | ||
150 | |||
151 | uint8_t read_fwkey(void) | ||
152 | { | ||
153 | return PINE&(1<<2) ? 0 : (1<<2); | ||
154 | } | ||
155 | |||
156 | /* Columns 0 - 15 | ||
157 | * | ||
158 | * atmega32u4 decoder pin | ||
159 | * PC6 U1 E3 | ||
160 | * PB6 U2 E3 | ||
161 | * PF0 U1, U2 A0 | ||
162 | * PF1 U1, U2 A1 | ||
163 | * PC7 U1, U2 A2 | ||
164 | * | ||
165 | * These columns uses two 74HC237D 3 to 8 bit demultiplexers. | ||
166 | * col / pin: PC6 PB6 PF0 PF1 PC7 Decoder Pin | ||
167 | * 0: 1 0 0 0 0 U1 Y0 | ||
168 | * 1: 1 0 1 0 0 U1 Y1 | ||
169 | * 2: 1 0 0 1 0 U1 Y2 | ||
170 | * 3: 1 0 1 1 0 U1 Y3 | ||
171 | * 4: 1 0 0 0 1 U1 Y4 | ||
172 | * 5: 1 0 1 0 1 U1 Y5 | ||
173 | * 6: 1 0 0 1 1 U1 Y6 | ||
174 | * 7: 1 0 1 1 1 U1 Y7 | ||
175 | * 8: 0 1 0 0 0 U2 Y0 | ||
176 | * 9: 0 1 1 0 0 U2 Y1 | ||
177 | * 10: 0 1 0 1 0 U2 Y2 | ||
178 | * 11: 0 1 1 1 0 U2 Y3 | ||
179 | * 12: 0 1 0 0 1 U2 Y4 | ||
180 | * 13: 0 1 1 0 1 U2 Y5 | ||
181 | * 14: 0 1 0 1 1 U2 Y6 | ||
182 | * | ||
183 | */ | ||
184 | static void unselect_cols(void) { | ||
185 | DDRB |= 0b01000000; | ||
186 | PORTB &= ~0b01000000; | ||
187 | |||
188 | DDRC |= 0b11000000; | ||
189 | PORTC &= ~0b11000000; | ||
190 | |||
191 | DDRF |= 0b00000011; | ||
192 | PORTF &= ~0b00000011; | ||
193 | } | ||
194 | |||
195 | static void select_col(uint8_t col) { | ||
196 | |||
197 | switch (col) { | ||
198 | case 0: | ||
199 | PORTC |= 0b01000000; | ||
200 | break; | ||
201 | case 1: | ||
202 | PORTC |= 0b01000000; | ||
203 | PORTF |= 0b00000001; | ||
204 | break; | ||
205 | case 2: | ||
206 | PORTC |= 0b01000000; | ||
207 | PORTF |= 0b00000010; | ||
208 | break; | ||
209 | case 3: | ||
210 | PORTC |= 0b01000000; | ||
211 | PORTF |= 0b00000011; | ||
212 | break; | ||
213 | case 4: | ||
214 | PORTC |= 0b11000000; | ||
215 | break; | ||
216 | case 5: | ||
217 | PORTC |= 0b11000000; | ||
218 | PORTF |= 0b00000001; | ||
219 | break; | ||
220 | case 6: | ||
221 | PORTC |= 0b11000000; | ||
222 | PORTF |= 0b00000010; | ||
223 | break; | ||
224 | case 7: | ||
225 | PORTC |= 0b11000000; | ||
226 | PORTF |= 0b00000011; | ||
227 | break; | ||
228 | case 8: | ||
229 | PORTB |= 0b01000000; | ||
230 | break; | ||
231 | case 9: | ||
232 | PORTB |= 0b01000000; | ||
233 | PORTF |= 0b00000001; | ||
234 | break; | ||
235 | case 10: | ||
236 | PORTB |= 0b01000000; | ||
237 | PORTF |= 0b00000010; | ||
238 | break; | ||
239 | case 11: | ||
240 | PORTB |= 0b01000000; | ||
241 | PORTF |= 0b00000011; | ||
242 | break; | ||
243 | case 12: | ||
244 | PORTB |= 0b01000000; | ||
245 | PORTC |= 0b10000000; | ||
246 | break; | ||
247 | case 13: | ||
248 | PORTB |= 0b01000000; | ||
249 | PORTF |= 0b00000001; | ||
250 | PORTC |= 0b10000000; | ||
251 | break; | ||
252 | case 14: | ||
253 | PORTB |= 0b01000000; | ||
254 | PORTF |= 0b00000010; | ||
255 | PORTC |= 0b10000000; | ||
256 | break; | ||
257 | } | ||
258 | } | ||
diff --git a/keyboards/duck/eagle_viper/v2/readme.md b/keyboards/duck/eagle_viper/v2/readme.md new file mode 100644 index 000000000..0e9685e13 --- /dev/null +++ b/keyboards/duck/eagle_viper/v2/readme.md | |||
@@ -0,0 +1,31 @@ | |||
1 | # Duck Eagle/Viper V2 | ||
2 | |||
3 | Non-official firmware for custom Korean keyboard with 60% key layout made by Duck. Group buy was run November 2016 via [geekhack](https://geekhack.org/index.php?topic=86087.0) with 100 keyboards total. Newest version is the [Eagle/Viper V2](http://duck0113.tistory.com/127). | ||
4 | |||
5 | * Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin) | ||
6 | * Hardware Supported: Duck Eagle/Viper PCB Ver 2.0, Atmega32u4 | ||
7 | * Hardware Availability: Wait until GB of the next revision | ||
8 | |||
9 | Make example for this keyboard (after setting up your build environment): | ||
10 | |||
11 | make duck/eagle_viper/v2:default | ||
12 | |||
13 | **Reset Key:** To put the Eagle/Viper V2 into reset, hold caps lock key (`K2A`) while plugging in. | ||
14 | |||
15 | See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). | ||
16 | |||
17 | ## Hardware Notes | ||
18 | |||
19 | The Duck Eagle/Viper V2 PCB consists of: | ||
20 | |||
21 | ### Microchips | ||
22 | 2 74HC237D 3-to-8 line decoders | ||
23 | 1 Atmega32u4 microcontroller | ||
24 | 2 WS2811 LED controller | ||
25 | |||
26 | ## Notes | ||
27 | Thanks to Ralf Schmitt for previous implementations in his [TMK fork](https://github.com/xauser/tmk_keyboard/tree/xauser/) and few helping words. | ||
28 | |||
29 | Based heavily on Rasmus Schults [Duck Lightsaver QMK Port](https://github.com/qmk/qmk_firmware/tree/master/keyboards/lightsaver) | ||
30 | |||
31 | Special thanks to profanum429 for debugging help and contributions to support the Viper and LED indicators. | ||
diff --git a/keyboards/duck/eagle_viper/v2/rules.mk b/keyboards/duck/eagle_viper/v2/rules.mk new file mode 100644 index 000000000..102d987cb --- /dev/null +++ b/keyboards/duck/eagle_viper/v2/rules.mk | |||
@@ -0,0 +1,24 @@ | |||
1 | # MCU name | ||
2 | MCU = atmega32u4 | ||
3 | |||
4 | # Bootloader selection | ||
5 | BOOTLOADER = atmel-dfu | ||
6 | |||
7 | # Build Options | ||
8 | # change yes to no to disable | ||
9 | # | ||
10 | BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite | ||
11 | MOUSEKEY_ENABLE = no # Mouse keys | ||
12 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
13 | CONSOLE_ENABLE = no # Console for debug | ||
14 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
15 | NKRO_ENABLE = yes # Enable N-Key Rollover | ||
16 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | ||
17 | BACKLIGHT_DRIVER = custom | ||
18 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow | ||
19 | AUDIO_ENABLE = no # Audio output | ||
20 | |||
21 | LAYOUTS = 60_ansi 60_hhkb 60_ansi_split_bs_rshift | ||
22 | |||
23 | CUSTOM_MATRIX = yes | ||
24 | SRC += indicator_leds.c matrix.c duck_led/duck_led.c | ||
diff --git a/keyboards/duck/eagle_viper/v2/v2.c b/keyboards/duck/eagle_viper/v2/v2.c new file mode 100644 index 000000000..d3e1368de --- /dev/null +++ b/keyboards/duck/eagle_viper/v2/v2.c | |||
@@ -0,0 +1,61 @@ | |||
1 | /* Copyright 2017 MechMerlin <[email protected]> | ||
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 "v2.h" | ||
17 | #include "indicator_leds.h" | ||
18 | |||
19 | enum BACKLIGHT_AREAS { | ||
20 | BACKLIGHT_ALPHAS = 0b00000010, | ||
21 | BACKLIGHT_MODNUM = 0b00001000 | ||
22 | }; | ||
23 | |||
24 | void backlight_set(uint8_t level) { | ||
25 | switch(level) { | ||
26 | case 0: | ||
27 | PORTB |= BACKLIGHT_ALPHAS; | ||
28 | PORTB |= BACKLIGHT_MODNUM; | ||
29 | break; | ||
30 | case 1: | ||
31 | PORTB &= ~BACKLIGHT_ALPHAS; | ||
32 | PORTB |= BACKLIGHT_MODNUM; | ||
33 | break; | ||
34 | case 2: | ||
35 | PORTB |= BACKLIGHT_ALPHAS; | ||
36 | PORTB &= ~BACKLIGHT_MODNUM; | ||
37 | break; | ||
38 | case 3: | ||
39 | PORTB &= ~BACKLIGHT_ALPHAS; | ||
40 | PORTB &= ~BACKLIGHT_MODNUM; | ||
41 | break; | ||
42 | } | ||
43 | } | ||
44 | |||
45 | // Port from backlight_update_state | ||
46 | void led_set_kb(uint8_t usb_led) { | ||
47 | bool status[8] = { | ||
48 | host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK), /* LED 3 */ | ||
49 | host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK), /* LED 2 */ | ||
50 | host_keyboard_leds() & (1<<USB_LED_NUM_LOCK), /* LED 1 */ | ||
51 | |||
52 | layer_state & (1<<2), /* LED 6 */ | ||
53 | layer_state & (1<<1), /* LED 5 */ | ||
54 | layer_state & (1<<0) ? 0: 1, /* LED 4 */ | ||
55 | |||
56 | layer_state & (1<<5), /* LED 8 */ | ||
57 | layer_state & (1<<4) /* LED 7 */ | ||
58 | }; | ||
59 | |||
60 | indicator_leds_set(status); | ||
61 | } | ||
diff --git a/keyboards/duck/eagle_viper/v2/v2.h b/keyboards/duck/eagle_viper/v2/v2.h new file mode 100644 index 000000000..78b6fe5ea --- /dev/null +++ b/keyboards/duck/eagle_viper/v2/v2.h | |||
@@ -0,0 +1,90 @@ | |||
1 | /* Copyright 2017 MechMerlin <[email protected]> | ||
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 | #pragma once | ||
17 | |||
18 | #include "quantum.h" | ||
19 | |||
20 | #define ___ KC_NO | ||
21 | |||
22 | #define LAYOUT_all( \ | ||
23 | K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, \ | ||
24 | K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, \ | ||
25 | K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2O, \ | ||
26 | K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, K1O, \ | ||
27 | K0A, K0B, K0C, K0I, K0K, K0M, K0N, K0O \ | ||
28 | ) { \ | ||
29 | { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O }, \ | ||
30 | { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, ___, K3O }, \ | ||
31 | { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, ___, K2O }, \ | ||
32 | { K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, ___, K1M, K1N, K1O }, \ | ||
33 | { K0A, K0B, K0C, ___, ___, ___, ___, ___, K0I, ___, K0K, ___, K0M, K0N, K0O } \ | ||
34 | } | ||
35 | |||
36 | #define LAYOUT_60_ansi( \ | ||
37 | K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4O, \ | ||
38 | K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, \ | ||
39 | K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2O, \ | ||
40 | K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, \ | ||
41 | K0A, K0B, K0C, K0I, K0K, K0M, K0N, K0O \ | ||
42 | ) { \ | ||
43 | { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, ___, K4O }, \ | ||
44 | { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, ___, K3O }, \ | ||
45 | { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, ___, ___, K2O }, \ | ||
46 | { K1A, ___, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, ___, K1M, K1N, ___ }, \ | ||
47 | { K0A, K0B, K0C, ___, ___, ___, ___, ___, K0I, ___, K0K, ___, K0M, K0N, K0O } \ | ||
48 | } | ||
49 | |||
50 | #define LAYOUT_60_ansi_split_bs_rshift( \ | ||
51 | K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, \ | ||
52 | K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, \ | ||
53 | K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2O, \ | ||
54 | K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, K1O, \ | ||
55 | K0A, K0B, K0C, K0I, K0K, K0M, K0N, K0O \ | ||
56 | ) { \ | ||
57 | { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O }, \ | ||
58 | { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, ___, K3O }, \ | ||
59 | { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, ___, ___, K2O }, \ | ||
60 | { K1A, ___, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, ___, K1M, K1N, K1O }, \ | ||
61 | { K0A, K0B, K0C, ___, ___, ___, ___, ___, K0I, ___, K0K, ___, K0M, K0N, K0O } \ | ||
62 | } | ||
63 | |||
64 | #define LAYOUT_60_ansi_split_bs_lshift_rshift( \ | ||
65 | K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, \ | ||
66 | K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, \ | ||
67 | K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2O, \ | ||
68 | K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, K1O, \ | ||
69 | K0A, K0B, K0C, K0I, K0K, K0M, K0N, K0O \ | ||
70 | ) { \ | ||
71 | { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O }, \ | ||
72 | { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, ___, K3O }, \ | ||
73 | { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, ___, ___, K2O }, \ | ||
74 | { K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, ___, K1M, K1N, K1O }, \ | ||
75 | { K0A, K0B, K0C, ___, ___, ___, ___, ___, K0I, ___, K0K, ___, K0M, K0N, K0O } \ | ||
76 | } | ||
77 | |||
78 | #define LAYOUT_60_hhkb( \ | ||
79 | K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, \ | ||
80 | K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, \ | ||
81 | K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2O, \ | ||
82 | K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, K1O, \ | ||
83 | K0B, K0C, K0I, K0M, K0N \ | ||
84 | ) { \ | ||
85 | { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O }, \ | ||
86 | { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, ___, K3O }, \ | ||
87 | { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, ___, ___, K2O }, \ | ||
88 | { K1A, ___, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, ___, K1M, K1N, K1O }, \ | ||
89 | { ___, K0B, K0C, ___, ___, ___, ___, ___, K0I, ___, ___, ___, K0M, K0N, ___ } \ | ||
90 | } | ||
diff --git a/keyboards/duck/jetfire/config.h b/keyboards/duck/jetfire/config.h new file mode 100644 index 000000000..3b6c7d89f --- /dev/null +++ b/keyboards/duck/jetfire/config.h | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | Copyright 2018 MechMerlin | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #pragma once | ||
19 | |||
20 | #include "config_common.h" | ||
21 | |||
22 | /* USB Device descriptor parameter */ | ||
23 | #define VENDOR_ID 0x444B // Duck ("DK") | ||
24 | #define PRODUCT_ID 0x4A46 // Jetfire ("JF") | ||
25 | #define DEVICE_VER 0x0001 | ||
26 | #define MANUFACTURER Duck | ||
27 | #define PRODUCT Jetfire | ||
28 | |||
29 | /* key matrix size */ | ||
30 | #define MATRIX_ROWS 6 | ||
31 | #define MATRIX_COLS 20 | ||
32 | |||
33 | /* COL2ROW, ROW2COL*/ | ||
34 | #define DIODE_DIRECTION COL2ROW | ||
35 | |||
36 | #define BACKLIGHT_LEVELS 1 | ||
37 | |||
38 | #define RGB_DI_PIN D6 | ||
39 | // #ifdef RGB_DI_PIN | ||
40 | #define RGBLIGHT_ANIMATIONS | ||
41 | #define RGBLED_NUM 23 | ||
42 | // #define RGBLIGHT_HUE_STEP 8 | ||
43 | // #define RGBLIGHT_SAT_STEP 8 | ||
44 | // #define RGBLIGHT_VAL_STEP 8 | ||
45 | // #endif | ||
46 | |||
47 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
48 | #define DEBOUNCE 5 | ||
49 | |||
50 | /* Set to top left most key */ | ||
51 | #define BOOTMAGIC_LITE_ROW 5 | ||
52 | #define BOOTMAGIC_LITE_COLUMN 10 | ||
53 | |||
54 | /* If defined, GRAVE_ESC will always act as ESC when CTRL is held. | ||
55 | * This is userful for the Windows task manager shortcut (ctrl+shift+esc). | ||
56 | */ | ||
57 | // #define GRAVE_ESC_CTRL_OVERRIDE | ||
58 | |||
59 | /* | ||
60 | * Force NKRO | ||
61 | * | ||
62 | * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved | ||
63 | * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the | ||
64 | * makefile for this to work.) | ||
65 | * | ||
66 | * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) | ||
67 | * until the next keyboard reset. | ||
68 | * | ||
69 | * NKRO may prevent your keystrokes from being detected in the BIOS, but it is | ||
70 | * fully operational during normal computer usage. | ||
71 | * | ||
72 | * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) | ||
73 | * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by | ||
74 | * bootmagic, NKRO mode will always be enabled until it is toggled again during a | ||
75 | * power-up. | ||
76 | * | ||
77 | */ | ||
78 | //#define FORCE_NKRO | ||
79 | |||
80 | /* | ||
81 | * Feature disable options | ||
82 | * These options are also useful to firmware size reduction. | ||
83 | */ | ||
84 | |||
85 | /* disable debug print */ | ||
86 | //#define NO_DEBUG | ||
87 | |||
88 | /* disable print */ | ||
89 | //#define NO_PRINT | ||
90 | |||
91 | /* disable action features */ | ||
92 | //#define NO_ACTION_LAYER | ||
93 | //#define NO_ACTION_TAPPING | ||
94 | //#define NO_ACTION_ONESHOT | ||
95 | //#define NO_ACTION_MACRO | ||
96 | //#define NO_ACTION_FUNCTION | ||
diff --git a/keyboards/duck/jetfire/indicator_leds.c b/keyboards/duck/jetfire/indicator_leds.c new file mode 100644 index 000000000..7dbdb1ff7 --- /dev/null +++ b/keyboards/duck/jetfire/indicator_leds.c | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | Copyright 2016 Ralf Schmitt <[email protected]> | ||
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 | This program is distributed in the hope that it will be useful, | ||
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | GNU General Public License for more details. | ||
11 | You should have received a copy of the GNU General Public License | ||
12 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
13 | */ | ||
14 | |||
15 | #include <avr/interrupt.h> | ||
16 | #include <avr/io.h> | ||
17 | #include <stdbool.h> | ||
18 | #include <util/delay.h> | ||
19 | #include <stdint.h> | ||
20 | #include "indicator_leds.h" | ||
21 | #include "quantum.h" | ||
22 | |||
23 | #define LED_T1H 900 | ||
24 | #define LED_T1L 600 | ||
25 | #define LED_T0H 400 | ||
26 | #define LED_T0L 900 | ||
27 | |||
28 | void send_bit_d4(bool bitVal) | ||
29 | { | ||
30 | if(bitVal) { | ||
31 | asm volatile ( | ||
32 | "sbi %[port], %[bit] \n\t" | ||
33 | ".rept %[onCycles] \n\t" | ||
34 | "nop \n\t" | ||
35 | ".endr \n\t" | ||
36 | "cbi %[port], %[bit] \n\t" | ||
37 | ".rept %[offCycles] \n\t" | ||
38 | "nop \n\t" | ||
39 | ".endr \n\t" | ||
40 | :: | ||
41 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
42 | [bit] "I" (4), | ||
43 | [onCycles] "I" (NS_TO_CYCLES(LED_T1H) - 2), | ||
44 | [offCycles] "I" (NS_TO_CYCLES(LED_T1L) - 2)); | ||
45 | } else { | ||
46 | asm volatile ( | ||
47 | "sbi %[port], %[bit] \n\t" | ||
48 | ".rept %[onCycles] \n\t" | ||
49 | "nop \n\t" | ||
50 | ".endr \n\t" | ||
51 | "cbi %[port], %[bit] \n\t" | ||
52 | ".rept %[offCycles] \n\t" | ||
53 | "nop \n\t" | ||
54 | ".endr \n\t" | ||
55 | :: | ||
56 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
57 | [bit] "I" (4), | ||
58 | [onCycles] "I" (NS_TO_CYCLES(LED_T0H) - 2), | ||
59 | [offCycles] "I" (NS_TO_CYCLES(LED_T0L) - 2)); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | void send_bit_d6(bool bitVal) | ||
64 | { | ||
65 | if(bitVal) { | ||
66 | asm volatile ( | ||
67 | "sbi %[port], %[bit] \n\t" | ||
68 | ".rept %[onCycles] \n\t" | ||
69 | "nop \n\t" | ||
70 | ".endr \n\t" | ||
71 | "cbi %[port], %[bit] \n\t" | ||
72 | ".rept %[offCycles] \n\t" | ||
73 | "nop \n\t" | ||
74 | ".endr \n\t" | ||
75 | :: | ||
76 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
77 | [bit] "I" (6), | ||
78 | [onCycles] "I" (NS_TO_CYCLES(LED_T1H) - 2), | ||
79 | [offCycles] "I" (NS_TO_CYCLES(LED_T1L) - 2)); | ||
80 | } else { | ||
81 | asm volatile ( | ||
82 | "sbi %[port], %[bit] \n\t" | ||
83 | ".rept %[onCycles] \n\t" | ||
84 | "nop \n\t" | ||
85 | ".endr \n\t" | ||
86 | "cbi %[port], %[bit] \n\t" | ||
87 | ".rept %[offCycles] \n\t" | ||
88 | "nop \n\t" | ||
89 | ".endr \n\t" | ||
90 | :: | ||
91 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
92 | [bit] "I" (6), | ||
93 | [onCycles] "I" (NS_TO_CYCLES(LED_T0H) - 2), | ||
94 | [offCycles] "I" (NS_TO_CYCLES(LED_T0L) - 2)); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | void send_value(uint8_t byte, enum Device device) | ||
99 | { | ||
100 | for(uint8_t b = 0; b < 8; b++) { | ||
101 | if(device == Device_STATUSLED) { | ||
102 | send_bit_d4(byte & 0b10000000); | ||
103 | } | ||
104 | if(device == Device_PCBRGB) { | ||
105 | send_bit_d6(byte & 0b10000000); | ||
106 | } | ||
107 | byte <<= 1; | ||
108 | } | ||
109 | } | ||
110 | |||
111 | void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device) | ||
112 | { | ||
113 | send_value(r, device); | ||
114 | send_value(g, device); | ||
115 | send_value(b, device); | ||
116 | } | ||
diff --git a/keyboards/duck/jetfire/indicator_leds.h b/keyboards/duck/jetfire/indicator_leds.h new file mode 100644 index 000000000..695e1db6d --- /dev/null +++ b/keyboards/duck/jetfire/indicator_leds.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #include "duck_led/duck_led.h" | ||
4 | |||
5 | void backlight_init_ports(void); | ||
6 | void backlight_set_state(bool cfg[7]); | ||
7 | void backlight_update_state(void); | ||
8 | void backlight_toggle_rgb(bool enabled); | ||
9 | void backlight_set_rgb(uint8_t cfg[17][3]); | ||
10 | void backlight_set(uint8_t level); | ||
11 | void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device); | ||
diff --git a/keyboards/duck/jetfire/info.json b/keyboards/duck/jetfire/info.json new file mode 100644 index 000000000..9325fffb7 --- /dev/null +++ b/keyboards/duck/jetfire/info.json | |||
@@ -0,0 +1,14 @@ | |||
1 | { | ||
2 | "keyboard_name": "Jetfire", | ||
3 | "url": "", | ||
4 | "maintainer": "qmk", | ||
5 | "layouts": { | ||
6 | "LAYOUT_all": { | ||
7 | "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":2, "y":0}, {"label":"F2", "x":3, "y":0}, {"label":"F3", "x":4, "y":0}, {"label":"F4", "x":5, "y":0}, {"label":"F5", "x":6.5, "y":0}, {"label":"F6", "x":7.5, "y":0}, {"label":"F7", "x":8.5, "y":0}, {"label":"F8", "x":9.5, "y":0}, {"label":"F9", "x":11, "y":0}, {"label":"F10", "x":12, "y":0}, {"label":"F11", "x":13, "y":0}, {"label":"F12", "x":14, "y":0}, {"x":15.25, "y":0}, {"label":"PrtSc", "x":16.5, "y":0}, {"label":"Scroll Lock", "x":17.5, "y":0}, {"label":"Pause", "x":18.5, "y":0}, {"x":19.5, "y":0}, {"label":"~", "x":0, "y":1.25}, {"label":"!", "x":1, "y":1.25}, {"label":"@", "x":2, "y":1.25}, {"label":"#", "x":3, "y":1.25}, {"label":"$", "x":4, "y":1.25}, {"label":"%", "x":5, "y":1.25}, {"label":"^", "x":6, "y":1.25}, {"label":"&", "x":7, "y":1.25}, {"label":"*", "x":8, "y":1.25}, {"label":"(", "x":9, "y":1.25}, {"label":")", "x":10, "y":1.25}, {"label":"_", "x":11, "y":1.25}, {"label":"+", "x":12, "y":1.25}, {"label":"Back Space", "x":13, "y":1.25}, {"x":14, "y":1.25}, {"label":"Insert", "x":15.25, "y":1.25}, {"label":"Num Lock", "x":16.5, "y":1.25}, {"label":"/", "x":17.5, "y":1.25}, {"label":"*", "x":18.5, "y":1.25}, {"label":"-", "x":19.5, "y":1.25}, {"label":"Tab", "x":0, "y":2.25, "w":1.5}, {"label":"Q", "x":1.5, "y":2.25}, {"label":"W", "x":2.5, "y":2.25}, {"label":"E", "x":3.5, "y":2.25}, {"label":"R", "x":4.5, "y":2.25}, {"label":"T", "x":5.5, "y":2.25}, {"label":"Y", "x":6.5, "y":2.25}, {"label":"U", "x":7.5, "y":2.25}, {"label":"I", "x":8.5, "y":2.25}, {"label":"O", "x":9.5, "y":2.25}, {"label":"P", "x":10.5, "y":2.25}, {"label":"{", "x":11.5, "y":2.25}, {"label":"}", "x":12.5, "y":2.25}, {"label":"|", "x":13.5, "y":2.25, "w":1.5}, {"label":"Delete", "x":15.25, "y":2.25}, {"label":"7", "x":16.5, "y":2.25}, {"label":"8", "x":17.5, "y":2.25}, {"label":"9", "x":18.5, "y":2.25}, {"label":"+", "x":19.5, "y":2.25}, {"label":"Caps Lock", "x":0, "y":3.25, "w":1.75}, {"label":"A", "x":1.75, "y":3.25}, {"label":"S", "x":2.75, "y":3.25}, {"label":"D", "x":3.75, "y":3.25}, {"label":"F", "x":4.75, "y":3.25}, {"label":"G", "x":5.75, "y":3.25}, {"label":"H", "x":6.75, "y":3.25}, {"label":"J", "x":7.75, "y":3.25}, {"label":"K", "x":8.75, "y":3.25}, {"label":"L", "x":9.75, "y":3.25}, {"label":":", "x":10.75, "y":3.25}, {"label":"\"", "x":11.75, "y":3.25}, {"label":"Enter", "x":12.75, "y":3.25, "w":2.25}, {"label":"4", "x":16.5, "y":3.25}, {"label":"5", "x":17.5, "y":3.25}, {"label":"6", "x":18.5, "y":3.25}, {"x":19.5, "y":3.25}, {"label":"Shift", "x":0, "y":4.25, "w":1.25}, {"label":"ISO \\", "x":1.25, "y":4.25}, {"label":"Z", "x":2.25, "y":4.25}, {"label":"X", "x":3.25, "y":4.25}, {"label":"C", "x":4.25, "y":4.25}, {"label":"V", "x":5.25, "y":4.25}, {"label":"B", "x":6.25, "y":4.25}, {"label":"N", "x":7.25, "y":4.25}, {"label":"M", "x":8.25, "y":4.25}, {"label":"<", "x":9.25, "y":4.25}, {"label":">", "x":10.25, "y":4.25}, {"label":"?", "x":11.25, "y":4.25}, {"label":"Shift", "x":12.25, "y":4.25, "w":1.75}, {"x":14, "y":4.25}, {"label":"\u2191", "x":15.25, "y":4.5}, {"label":"1", "x":16.5, "y":4.25}, {"label":"2", "x":17.5, "y":4.25}, {"label":"3", "x":18.5, "y":4.25}, {"label":"Enter", "x":19.5, "y":4.25}, {"label":"Ctrl", "x":0, "y":5.25, "w":1.5}, {"label":"Win", "x":1.5, "y":5.25}, {"label":"Alt", "x":2.5, "y":5.25, "w":1.5}, {"x":4, "y":5.25, "w":6.25}, {"label":"Alt", "x":10.25, "y":5.25, "w":1.25}, {"x":11.5, "y":5.25, "w":1.25}, {"label":"Ctrl", "x":12.75, "y":5.25, "w":1.25}, {"label":"\u2190", "x":14.25, "y":5.5}, {"label":"\u2193", "x":15.25, "y":5.5}, {"label":"\u2192", "x":16.25, "y":5.5}, {"label":"0", "x":17.5, "y":5.25}, {"label":".", "x":18.5, "y":5.25}, {"x":19.5, "y":5.25}] | ||
8 | }, | ||
9 | |||
10 | "LAYOUT": { | ||
11 | "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":2, "y":0}, {"label":"F2", "x":3, "y":0}, {"label":"F3", "x":4, "y":0}, {"label":"F4", "x":5, "y":0}, {"label":"F5", "x":6.5, "y":0}, {"label":"F6", "x":7.5, "y":0}, {"label":"F7", "x":8.5, "y":0}, {"label":"F8", "x":9.5, "y":0}, {"label":"F9", "x":11, "y":0}, {"label":"F10", "x":12, "y":0}, {"label":"F11", "x":13, "y":0}, {"label":"F12", "x":14, "y":0}, {"x":15.25, "y":0}, {"label":"PrtSc", "x":16.5, "y":0}, {"label":"Scroll Lock", "x":17.5, "y":0}, {"label":"Pause", "x":18.5, "y":0}, {"x":19.5, "y":0}, {"label":"~", "x":0, "y":1.25}, {"label":"!", "x":1, "y":1.25}, {"label":"@", "x":2, "y":1.25}, {"label":"#", "x":3, "y":1.25}, {"label":"$", "x":4, "y":1.25}, {"label":"%", "x":5, "y":1.25}, {"label":"^", "x":6, "y":1.25}, {"label":"&", "x":7, "y":1.25}, {"label":"*", "x":8, "y":1.25}, {"label":"(", "x":9, "y":1.25}, {"label":")", "x":10, "y":1.25}, {"label":"_", "x":11, "y":1.25}, {"label":"+", "x":12, "y":1.25}, {"label":"Backspace", "x":13, "y":1.25, "w":2}, {"label":"Insert", "x":15.25, "y":1.25}, {"label":"Num Lock", "x":16.5, "y":1.25}, {"label":"/", "x":17.5, "y":1.25}, {"label":"*", "x":18.5, "y":1.25}, {"label":"-", "x":19.5, "y":1.25}, {"label":"Tab", "x":0, "y":2.25, "w":1.5}, {"label":"Q", "x":1.5, "y":2.25}, {"label":"W", "x":2.5, "y":2.25}, {"label":"E", "x":3.5, "y":2.25}, {"label":"R", "x":4.5, "y":2.25}, {"label":"T", "x":5.5, "y":2.25}, {"label":"Y", "x":6.5, "y":2.25}, {"label":"U", "x":7.5, "y":2.25}, {"label":"I", "x":8.5, "y":2.25}, {"label":"O", "x":9.5, "y":2.25}, {"label":"P", "x":10.5, "y":2.25}, {"label":"{", "x":11.5, "y":2.25}, {"label":"}", "x":12.5, "y":2.25}, {"label":"|", "x":13.5, "y":2.25, "w":1.5}, {"label":"Delete", "x":15.25, "y":2.25}, {"label":"7", "x":16.5, "y":2.25}, {"label":"8", "x":17.5, "y":2.25}, {"label":"9", "x":18.5, "y":2.25}, {"label":"+", "x":19.5, "y":2.25, "h":2}, {"label":"Caps Lock", "x":0, "y":3.25, "w":1.75}, {"label":"A", "x":1.75, "y":3.25}, {"label":"S", "x":2.75, "y":3.25}, {"label":"D", "x":3.75, "y":3.25}, {"label":"F", "x":4.75, "y":3.25}, {"label":"G", "x":5.75, "y":3.25}, {"label":"H", "x":6.75, "y":3.25}, {"label":"J", "x":7.75, "y":3.25}, {"label":"K", "x":8.75, "y":3.25}, {"label":"L", "x":9.75, "y":3.25}, {"label":":", "x":10.75, "y":3.25}, {"label":"\"", "x":11.75, "y":3.25}, {"label":"Enter", "x":12.75, "y":3.25, "w":2.25}, {"label":"4", "x":16.5, "y":3.25}, {"label":"5", "x":17.5, "y":3.25}, {"label":"6", "x":18.5, "y":3.25}, {"label":"Shift", "x":0, "y":4.25, "w":2.25}, {"label":"Z", "x":2.25, "y":4.25}, {"label":"X", "x":3.25, "y":4.25}, {"label":"C", "x":4.25, "y":4.25}, {"label":"V", "x":5.25, "y":4.25}, {"label":"B", "x":6.25, "y":4.25}, {"label":"N", "x":7.25, "y":4.25}, {"label":"M", "x":8.25, "y":4.25}, {"label":"<", "x":9.25, "y":4.25}, {"label":">", "x":10.25, "y":4.25}, {"label":"?", "x":11.25, "y":4.25}, {"label":"Shift", "x":12.25, "y":4.25, "w":2.75}, {"label":"\u2191", "x":15.25, "y":4.5}, {"label":"1", "x":16.5, "y":4.25}, {"label":"2", "x":17.5, "y":4.25}, {"label":"3", "x":18.5, "y":4.25}, {"label":"Enter", "x":19.5, "y":4.25, "h":2}, {"label":"Ctrl", "x":0, "y":5.25, "w":1.5}, {"label":"Win", "x":1.5, "y":5.25}, {"label":"Alt", "x":2.5, "y":5.25, "w":1.5}, {"x":4, "y":5.25, "w":7}, {"label":"Alt", "x":11, "y":5.25, "w":1.5}, {"label":"Ctrl", "x":12.5, "y":5.25, "w":1.5}, {"label":"\u2190", "x":14.25, "y":5.5}, {"label":"\u2193", "x":15.25, "y":5.5}, {"label":"\u2192", "x":16.25, "y":5.5}, {"label":"0", "x":17.5, "y":5.25}, {"label":".", "x":18.5, "y":5.25}] | ||
12 | } | ||
13 | } | ||
14 | } | ||
diff --git a/keyboards/duck/jetfire/jetfire.c b/keyboards/duck/jetfire/jetfire.c new file mode 100644 index 000000000..9bb02ca22 --- /dev/null +++ b/keyboards/duck/jetfire/jetfire.c | |||
@@ -0,0 +1,161 @@ | |||
1 | /* Copyright 2018 MechMerlin | ||
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 "jetfire.h" | ||
17 | #include "indicator_leds.h" | ||
18 | |||
19 | enum BACKLIGHT_AREAS { | ||
20 | BACKLIGHT_ALPHA = 0b0000001, | ||
21 | BACKLIGHT_MOD = 0b0000010, | ||
22 | BACKLIGHT_FROW = 0b0000100, | ||
23 | BACKLIGHT_NUMBLOCK = 0b0001000, | ||
24 | BACKLIGHT_RGB = 0b0010000, | ||
25 | BACKLIGHT_SWITCH = 0b0001111 | ||
26 | }; | ||
27 | |||
28 | enum StateLed { | ||
29 | STATE_LED_SCROLL_LOCK, | ||
30 | STATE_LED_CAPS_LOCK, | ||
31 | STATE_LED_NUM_LOCK, | ||
32 | STATE_LED_LAYER_0, | ||
33 | STATE_LED_LAYER_1, | ||
34 | STATE_LED_LAYER_2, | ||
35 | STATE_LED_LAYER_3, | ||
36 | STATE_LED_LAYER_4 | ||
37 | }; | ||
38 | |||
39 | uint8_t backlight_rgb_r = 255; | ||
40 | uint8_t backlight_rgb_g = 0; | ||
41 | uint8_t backlight_rgb_b = 0; | ||
42 | uint8_t backlight_state_led = 1<<STATE_LED_LAYER_0; | ||
43 | |||
44 | |||
45 | void backlight_toggle_rgb(bool enabled) | ||
46 | { | ||
47 | if(enabled) { | ||
48 | uint8_t rgb[RGBLED_NUM][3] = { | ||
49 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
50 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
51 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
52 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
53 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
54 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
55 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
56 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
57 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
58 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
59 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
60 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
61 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
62 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
63 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
64 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
65 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
66 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
67 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
68 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
69 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
70 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
71 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b} | ||
72 | }; | ||
73 | backlight_set_rgb(rgb); | ||
74 | } else { | ||
75 | uint8_t rgb[RGBLED_NUM][3] = { | ||
76 | {0, 0, 0}, | ||
77 | {0, 0, 0}, | ||
78 | {0, 0, 0}, | ||
79 | {0, 0, 0}, | ||
80 | {0, 0, 0}, | ||
81 | {0, 0, 0}, | ||
82 | {0, 0, 0}, | ||
83 | {0, 0, 0}, | ||
84 | {0, 0, 0}, | ||
85 | {0, 0, 0}, | ||
86 | {0, 0, 0}, | ||
87 | {0, 0, 0}, | ||
88 | {0, 0, 0}, | ||
89 | {0, 0, 0}, | ||
90 | {0, 0, 0}, | ||
91 | {0, 0, 0}, | ||
92 | {0, 0, 0}, | ||
93 | {0, 0, 0}, | ||
94 | {0, 0, 0}, | ||
95 | {0, 0, 0}, | ||
96 | {0, 0, 0}, | ||
97 | {0, 0, 0}, | ||
98 | {0, 0, 0} | ||
99 | }; | ||
100 | backlight_set_rgb(rgb); | ||
101 | } | ||
102 | } | ||
103 | |||
104 | void backlight_set_rgb(uint8_t cfg[RGBLED_NUM][3]) | ||
105 | { | ||
106 | cli(); | ||
107 | for(uint8_t i = 0; i < RGBLED_NUM; ++i) { | ||
108 | send_color(cfg[i][0], cfg[i][1], cfg[i][2], Device_PCBRGB); | ||
109 | } | ||
110 | sei(); | ||
111 | show(); | ||
112 | } | ||
113 | |||
114 | |||
115 | void backlight_set(uint8_t level) | ||
116 | { | ||
117 | level & BACKLIGHT_ALPHA ? (PORTB |= 0b00000010) : (PORTB &= ~0b00000010); | ||
118 | level & BACKLIGHT_MOD ? (PORTB |= 0b00000100) : (PORTB &= ~0b00000100); | ||
119 | level & BACKLIGHT_FROW ? (PORTB |= 0b00001000) : (PORTB &= ~0b00001000); | ||
120 | level & BACKLIGHT_NUMBLOCK ? (PORTE |= 0b01000000) : (PORTE &= ~0b01000000); | ||
121 | backlight_toggle_rgb(level & BACKLIGHT_RGB); | ||
122 | } | ||
123 | |||
124 | void backlight_update_state() | ||
125 | { | ||
126 | cli(); | ||
127 | send_color(backlight_state_led & (1<<STATE_LED_SCROLL_LOCK) ? 255 : 0, | ||
128 | backlight_state_led & (1<<STATE_LED_CAPS_LOCK) ? 255 : 0, | ||
129 | backlight_state_led & (1<<STATE_LED_NUM_LOCK) ? 255 : 0, | ||
130 | Device_STATUSLED); | ||
131 | send_color(backlight_state_led & (1<<STATE_LED_LAYER_1) ? 255 : 0, | ||
132 | backlight_state_led & (1<<STATE_LED_LAYER_2) ? 255 : 0, | ||
133 | backlight_state_led & (1<<STATE_LED_LAYER_0) ? 255 : 0, | ||
134 | Device_STATUSLED); | ||
135 | send_color(backlight_state_led & (1<<STATE_LED_LAYER_4) ? 255 : 0, | ||
136 | backlight_state_led & (1<<STATE_LED_LAYER_3) ? 255 : 0, | ||
137 | 0, | ||
138 | Device_STATUSLED); | ||
139 | sei(); | ||
140 | show(); | ||
141 | } | ||
142 | |||
143 | void led_set_kb(uint8_t usb_led) | ||
144 | { | ||
145 | if(usb_led & (1<<USB_LED_CAPS_LOCK)) { | ||
146 | backlight_state_led |= 1<<STATE_LED_CAPS_LOCK; | ||
147 | } else { | ||
148 | backlight_state_led &= ~(1<<STATE_LED_CAPS_LOCK); | ||
149 | } | ||
150 | if(usb_led & (1<<USB_LED_SCROLL_LOCK)) { | ||
151 | backlight_state_led |= 1<<STATE_LED_SCROLL_LOCK; | ||
152 | } else { | ||
153 | backlight_state_led &= ~(1<<STATE_LED_SCROLL_LOCK); | ||
154 | } | ||
155 | if(usb_led & (1<<USB_LED_NUM_LOCK)) { | ||
156 | backlight_state_led |= 1<<STATE_LED_NUM_LOCK; | ||
157 | } else { | ||
158 | backlight_state_led &= ~(1<<STATE_LED_NUM_LOCK); | ||
159 | } | ||
160 | backlight_update_state(); | ||
161 | } | ||
diff --git a/keyboards/duck/jetfire/jetfire.h b/keyboards/duck/jetfire/jetfire.h new file mode 100644 index 000000000..3c4834bce --- /dev/null +++ b/keyboards/duck/jetfire/jetfire.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* Copyright 2018 MechMerlin | ||
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 | #pragma once | ||
17 | |||
18 | #include "quantum.h" | ||
19 | |||
20 | // This a shortcut to help you visually see your layout. | ||
21 | // The following is an example using the Planck MIT layout | ||
22 | // The first section contains all of the arguments representing the physical | ||
23 | // layout of the board and position of the keys | ||
24 | // The second converts the arguments into a two-dimensional array which | ||
25 | // represents the switch matrix. | ||
26 | |||
27 | #define LAYOUT_all( \ | ||
28 | K5A, K5C, K5D, K5E, K5F, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, K5T, \ | ||
29 | K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, K4R, K4S, K4T, \ | ||
30 | K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, K3P, K3Q, K3R, K3S, K3T, \ | ||
31 | K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2O, K2Q, K2R, K2S, K2T, \ | ||
32 | K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, K1O, K1P, K1Q, K1R, K1S, K1T, \ | ||
33 | K0A, K0B, K0C, K0I, K0L, K0M, K0N, K0O, K0P, K0Q, K0R, K0S, K0T \ | ||
34 | ) { \ | ||
35 | { K5A, KC_NO, K5C, K5D, K5E, K5F, KC_NO, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, K5T }, \ | ||
36 | { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, K4R, K4S, K4T }, \ | ||
37 | { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, KC_NO, K3O, K3P, K3Q, K3R, K3S, K3T }, \ | ||
38 | { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, KC_NO, KC_NO, K2O, KC_NO, K2Q, K2R, K2S, K2T }, \ | ||
39 | { K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, KC_NO, K1M, K1N, K1O, K1P, K1Q, K1R, K1S, K1T }, \ | ||
40 | { K0A, K0B, K0C, KC_NO,KC_NO,KC_NO,KC_NO,KC_NO, K0I, KC_NO,KC_NO, K0L, K0M, K0N, K0O, K0P, K0Q, K0R, K0S, K0T } \ | ||
41 | } | ||
42 | |||
43 | #define LAYOUT( \ | ||
44 | K5A, K5C, K5D, K5E, K5F, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, K5T, \ | ||
45 | K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4O, K4P, K4Q, K4R, K4S, K4T, \ | ||
46 | K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, K3P, K3Q, K3R, K3S, K3T, \ | ||
47 | K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2O, K2Q, K2R, K2S, \ | ||
48 | K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, K1P, K1Q, K1R, K1S, K1T, \ | ||
49 | K0A, K0B, K0C, K0I, K0M, K0N, K0O, K0P, K0Q, K0R, K0S \ | ||
50 | ) { \ | ||
51 | { K5A, KC_NO, K5C, K5D, K5E, K5F, KC_NO, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, K5T }, \ | ||
52 | { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, KC_NO, K4O, K4P, K4Q, K4R, K4S, K4T }, \ | ||
53 | { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, KC_NO, K3O, K3P, K3Q, K3R, K3S, K3T }, \ | ||
54 | { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, KC_NO, KC_NO, K2O, KC_NO, K2Q, K2R, K2S, KC_NO }, \ | ||
55 | { K1A, KC_NO, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, KC_NO, K1M, K1N, KC_NO, K1P, K1Q, K1R, K1S, K1T }, \ | ||
56 | { K0A, K0B, K0C, KC_NO,KC_NO,KC_NO,KC_NO,KC_NO, K0I, KC_NO,KC_NO,KC_NO, K0M, K0N, K0O, K0P, K0Q, K0R, K0S, KC_NO } \ | ||
57 | } | ||
58 | |||
diff --git a/keyboards/duck/jetfire/keymaps/default/keymap.c b/keyboards/duck/jetfire/keymaps/default/keymap.c new file mode 100644 index 000000000..05ffa7a93 --- /dev/null +++ b/keyboards/duck/jetfire/keymaps/default/keymap.c | |||
@@ -0,0 +1,27 @@ | |||
1 | /* Copyright 2018 MechMerlin | ||
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 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
19 | // layer 0: qwerty | ||
20 | [0] = LAYOUT( | ||
21 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, RGB_MOD, KC_PSCR, KC_SLCK, KC_PAUS, KC_PGUP, | ||
22 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, | ||
23 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_P7, KC_P8, KC_P9, KC_PPLS, | ||
24 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, | ||
25 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, | ||
26 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_COMM), | ||
27 | }; | ||
diff --git a/keyboards/duck/jetfire/keymaps/default/readme.md b/keyboards/duck/jetfire/keymaps/default/readme.md new file mode 100644 index 000000000..8b807694b --- /dev/null +++ b/keyboards/duck/jetfire/keymaps/default/readme.md | |||
@@ -0,0 +1 @@ | |||
# The default keymap for jetfire | |||
diff --git a/keyboards/duck/jetfire/matrix.c b/keyboards/duck/jetfire/matrix.c new file mode 100644 index 000000000..2dd94a72a --- /dev/null +++ b/keyboards/duck/jetfire/matrix.c | |||
@@ -0,0 +1,277 @@ | |||
1 | /* | ||
2 | Copyright 2016 Ralf Schmitt <[email protected]> | ||
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 | This program is distributed in the hope that it will be useful, | ||
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | GNU General Public License for more details. | ||
11 | You should have received a copy of the GNU General Public License | ||
12 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
13 | */ | ||
14 | |||
15 | #include <stdint.h> | ||
16 | #include <stdbool.h> | ||
17 | #include <avr/io.h> | ||
18 | #include <util/delay.h> | ||
19 | #include "print.h" | ||
20 | #include "debug.h" | ||
21 | #include "util.h" | ||
22 | #include "matrix.h" | ||
23 | |||
24 | static uint8_t debouncing = DEBOUNCE; | ||
25 | |||
26 | /* matrix state(1:on, 0:off) */ | ||
27 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
28 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
29 | |||
30 | static uint8_t read_rows(uint8_t col); | ||
31 | static void init_ports(void); | ||
32 | static void unselect_cols(void); | ||
33 | static void select_col(uint8_t col); | ||
34 | |||
35 | __attribute__ ((weak)) | ||
36 | void matrix_init_kb(void) { | ||
37 | matrix_init_user(); | ||
38 | } | ||
39 | |||
40 | __attribute__ ((weak)) | ||
41 | void matrix_scan_kb(void) { | ||
42 | matrix_scan_user(); | ||
43 | } | ||
44 | |||
45 | __attribute__ ((weak)) | ||
46 | void matrix_init_user(void) { | ||
47 | } | ||
48 | |||
49 | __attribute__ ((weak)) | ||
50 | void matrix_scan_user(void) { | ||
51 | } | ||
52 | |||
53 | inline | ||
54 | uint8_t matrix_rows(void) | ||
55 | { | ||
56 | return MATRIX_ROWS; | ||
57 | } | ||
58 | |||
59 | inline | ||
60 | uint8_t matrix_cols(void) | ||
61 | { | ||
62 | return MATRIX_COLS; | ||
63 | } | ||
64 | |||
65 | void backlight_init_ports(void) | ||
66 | { | ||
67 | DDRD |= 0b01010000; | ||
68 | PORTD &= 0b10101111; | ||
69 | DDRB |= 0b00001110; | ||
70 | PORTB &= 0b11110001; | ||
71 | DDRE |= 0b01000000; | ||
72 | PORTE &= 0b10111111; | ||
73 | } | ||
74 | |||
75 | void matrix_init(void) | ||
76 | { | ||
77 | backlight_init_ports(); | ||
78 | unselect_cols(); | ||
79 | init_ports(); | ||
80 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | ||
81 | matrix[i] = 0; | ||
82 | matrix_debouncing[i] = 0; | ||
83 | } | ||
84 | } | ||
85 | |||
86 | uint8_t matrix_scan(void) | ||
87 | { | ||
88 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { | ||
89 | select_col(col); | ||
90 | _delay_us(3); | ||
91 | uint8_t rows = read_rows(col); | ||
92 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
93 | bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col); | ||
94 | bool curr_bit = rows & (1<<row); | ||
95 | if (prev_bit != curr_bit) { | ||
96 | matrix_debouncing[row] ^= ((matrix_row_t)1<<col); | ||
97 | if (debouncing) { | ||
98 | dprint("bounce!: "); dprintf("%02X", debouncing); dprintln(); | ||
99 | } | ||
100 | debouncing = DEBOUNCE; | ||
101 | } | ||
102 | } | ||
103 | unselect_cols(); | ||
104 | } | ||
105 | |||
106 | if (debouncing) { | ||
107 | if (--debouncing) { | ||
108 | _delay_ms(1); | ||
109 | } else { | ||
110 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
111 | matrix[i] = matrix_debouncing[i]; | ||
112 | } | ||
113 | } | ||
114 | } | ||
115 | |||
116 | return 1; | ||
117 | } | ||
118 | |||
119 | bool matrix_is_modified(void) | ||
120 | { | ||
121 | if (debouncing) return false; | ||
122 | return true; | ||
123 | } | ||
124 | |||
125 | inline | ||
126 | bool matrix_is_on(uint8_t row, uint8_t col) | ||
127 | { | ||
128 | return (matrix[row] & ((matrix_row_t)1<<col)); | ||
129 | } | ||
130 | |||
131 | inline | ||
132 | matrix_row_t matrix_get_row(uint8_t row) | ||
133 | { | ||
134 | return matrix[row]; | ||
135 | } | ||
136 | |||
137 | void matrix_print(void) | ||
138 | { | ||
139 | print("\nr/c 0123456789ABCDEF\n"); | ||
140 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
141 | xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row))); | ||
142 | } | ||
143 | } | ||
144 | |||
145 | uint8_t matrix_key_count(void) | ||
146 | { | ||
147 | uint8_t count = 0; | ||
148 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
149 | count += bitpop32(matrix[i]); | ||
150 | } | ||
151 | return count; | ||
152 | } | ||
153 | |||
154 | static void init_ports(void) | ||
155 | { | ||
156 | // Rows are inputs (inputs are 0) | ||
157 | DDRD &= 0b11010000; | ||
158 | DDRB &= 0b01111111; | ||
159 | DDRE &= 0b11111011; | ||
160 | |||
161 | // Columns are outputs (outputs are high) | ||
162 | DDRF |= 0b00000011; | ||
163 | DDRC |= 0b11000000; | ||
164 | DDRB |= 0b01110001; | ||
165 | DDRD |= 0b10000000; | ||
166 | } | ||
167 | |||
168 | static uint8_t read_rows(uint8_t col) | ||
169 | { | ||
170 | if(col == 15) { | ||
171 | return (PINE&(1<<2) ? 0 : (1<<0)) | | ||
172 | (PIND&(1<<0) ? (1<<1) : 0) | | ||
173 | (PIND&(1<<1) ? (1<<2) : 0) | | ||
174 | (PIND&(1<<2) ? (1<<3) : 0) | | ||
175 | (PIND&(1<<3) ? (1<<4) : 0) | | ||
176 | (PIND&(1<<5) ? (1<<5) : 0); | ||
177 | |||
178 | } else { | ||
179 | return (PINB&(1<<7) ? (1<<0) : 0) | | ||
180 | (PIND&(1<<0) ? (1<<1) : 0) | | ||
181 | (PIND&(1<<1) ? (1<<2) : 0) | | ||
182 | (PIND&(1<<2) ? (1<<3) : 0) | | ||
183 | (PIND&(1<<3) ? (1<<4) : 0) | | ||
184 | (PIND&(1<<5) ? (1<<5) : 0); | ||
185 | |||
186 | } | ||
187 | } | ||
188 | |||
189 | static void unselect_cols(void) | ||
190 | { | ||
191 | PORTF &= 0b11111100; | ||
192 | PORTC &= 0b00111111; | ||
193 | PORTB &= 0b10001110; | ||
194 | PORTD &= 0b01111111; | ||
195 | } | ||
196 | |||
197 | static void select_col(uint8_t col) | ||
198 | { | ||
199 | switch (col) { | ||
200 | case 0: | ||
201 | PORTC |= 0b01000000; | ||
202 | break; | ||
203 | case 1: | ||
204 | PORTC |= 0b01000000; | ||
205 | PORTF |= 0b00000001; | ||
206 | break; | ||
207 | case 2: | ||
208 | PORTC |= 0b01000000; | ||
209 | PORTF |= 0b00000010; | ||
210 | break; | ||
211 | case 3: | ||
212 | PORTC |= 0b01000000; | ||
213 | PORTF |= 0b00000011; | ||
214 | break; | ||
215 | case 4: | ||
216 | PORTC |= 0b11000000; | ||
217 | break; | ||
218 | case 5: | ||
219 | PORTC |= 0b11000000; | ||
220 | PORTF |= 0b00000001; | ||
221 | break; | ||
222 | case 6: | ||
223 | PORTC |= 0b11000000; | ||
224 | PORTF |= 0b00000010; | ||
225 | break; | ||
226 | case 7: | ||
227 | PORTC |= 0b11000000; | ||
228 | PORTF |= 0b00000011; | ||
229 | break; | ||
230 | case 8: | ||
231 | PORTB |= 0b01000000; | ||
232 | break; | ||
233 | case 9: | ||
234 | PORTB |= 0b01000000; | ||
235 | PORTF |= 0b00000001; | ||
236 | break; | ||
237 | case 10: | ||
238 | PORTB |= 0b01000000; | ||
239 | PORTF |= 0b00000010; | ||
240 | break; | ||
241 | case 11: | ||
242 | PORTB |= 0b01000000; | ||
243 | PORTF |= 0b00000011; | ||
244 | break; | ||
245 | case 12: | ||
246 | PORTB |= 0b01000000; | ||
247 | PORTC |= 0b10000000; | ||
248 | break; | ||
249 | case 13: | ||
250 | PORTB |= 0b01000000; | ||
251 | PORTF |= 0b00000001; | ||
252 | PORTC |= 0b10000000; | ||
253 | break; | ||
254 | case 14: | ||
255 | PORTB |= 0b01000000; | ||
256 | PORTF |= 0b00000010; | ||
257 | PORTC |= 0b10000000; | ||
258 | break; | ||
259 | case 15: | ||
260 | PORTB |= 0b01000000; | ||
261 | PORTF |= 0b00000011; | ||
262 | PORTC |= 0b10000000; | ||
263 | break; | ||
264 | case 16: | ||
265 | PORTB |= 0b00100000; | ||
266 | break; | ||
267 | case 17: | ||
268 | PORTB |= 0b00010000; | ||
269 | break; | ||
270 | case 18: | ||
271 | PORTD |= 0b10000000; | ||
272 | break; | ||
273 | case 19: | ||
274 | PORTB |= 0b00000001; | ||
275 | break; | ||
276 | } | ||
277 | } \ No newline at end of file | ||
diff --git a/keyboards/duck/jetfire/readme.md b/keyboards/duck/jetfire/readme.md new file mode 100644 index 000000000..8de2f5ced --- /dev/null +++ b/keyboards/duck/jetfire/readme.md | |||
@@ -0,0 +1,18 @@ | |||
1 | # Jetfire | ||
2 | |||
3 |  | ||
4 | |||
5 | The Duck Jetfire is a hybrid full size and 1800 layout keyboard that went on | ||
6 | Group Buy in November 2017. | ||
7 | |||
8 | Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin) | ||
9 | Hardware Supported: Duck Jetfire PCB | ||
10 | Hardware Availability: [Geekhack GB](https://geekhack.org/index.php?topic=92708.0) | ||
11 | |||
12 | **Reset Key:** To put the Jetfire into reset, hold top most key above the 2 navigation keys (`K5P`) while plugging in. | ||
13 | |||
14 | Make example for this keyboard (after setting up your build environment): | ||
15 | |||
16 | make duck/jetfire:default | ||
17 | |||
18 | See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. | ||
diff --git a/keyboards/duck/jetfire/rules.mk b/keyboards/duck/jetfire/rules.mk new file mode 100644 index 000000000..30c22841a --- /dev/null +++ b/keyboards/duck/jetfire/rules.mk | |||
@@ -0,0 +1,23 @@ | |||
1 | # MCU name | ||
2 | MCU = atmega32u4 | ||
3 | |||
4 | # Bootloader selection | ||
5 | BOOTLOADER = atmel-dfu | ||
6 | |||
7 | # Build Options | ||
8 | # change yes to no to disable | ||
9 | # | ||
10 | BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite | ||
11 | MOUSEKEY_ENABLE = no # Mouse keys | ||
12 | EXTRAKEY_ENABLE = no # Audio control and System control | ||
13 | CONSOLE_ENABLE = yes # Console for debug | ||
14 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
15 | NKRO_ENABLE = no # Enable N-Key Rollover | ||
16 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | ||
17 | BACKLIGHT_DRIVER = custom | ||
18 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow | ||
19 | AUDIO_ENABLE = no # Audio output | ||
20 | |||
21 | CUSTOM_MATRIX = yes | ||
22 | SRC += indicator_leds.c \ | ||
23 | matrix.c duck_led/duck_led.c | ||
diff --git a/keyboards/duck/lightsaver/config.h b/keyboards/duck/lightsaver/config.h new file mode 100644 index 000000000..e2aa78d14 --- /dev/null +++ b/keyboards/duck/lightsaver/config.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | Copyright 2017 Rasmus Schults <[email protected]> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #pragma once | ||
19 | |||
20 | #include "config_common.h" | ||
21 | |||
22 | /* USB Device descriptor parameter */ | ||
23 | #define VENDOR_ID 0x444B // Duck ("DK") | ||
24 | #define PRODUCT_ID 0x4C53 // Lightsaver ("LS") | ||
25 | #define DEVICE_VER 0x0003 | ||
26 | #define MANUFACTURER Duck | ||
27 | #define PRODUCT Lightsaver V3 | ||
28 | |||
29 | /* key matrix size */ | ||
30 | #define MATRIX_ROWS 6 | ||
31 | #define MATRIX_COLS 19 | ||
32 | |||
33 | #define DIODE_DIRECTION COL2ROW | ||
34 | |||
35 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
36 | #define DEBOUNCE 5 | ||
37 | |||
38 | /* number of backlight levels */ | ||
39 | #define BACKLIGHT_LEVELS 1 | ||
40 | |||
41 | #define RGBLIGHT_ANIMATIONS | ||
42 | #define RGB_DI_PIN D6 | ||
43 | #define RGBLED_NUM 17 | ||
44 | |||
45 | /* Set to top left most key */ | ||
46 | #define BOOTMAGIC_LITE_ROW 5 | ||
47 | #define BOOTMAGIC_LITE_COLUMN 10 | ||
48 | |||
49 | #define TAPPING_TERM 200 | ||
diff --git a/keyboards/duck/lightsaver/indicator_leds.c b/keyboards/duck/lightsaver/indicator_leds.c new file mode 100644 index 000000000..5d2e1ad9f --- /dev/null +++ b/keyboards/duck/lightsaver/indicator_leds.c | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | Copyright 2016-2017 Ralf Schmitt <[email protected]> Rasmus Schults <[email protected]> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | #include <avr/interrupt.h> | ||
18 | #include <avr/io.h> | ||
19 | #include <stdbool.h> | ||
20 | #include <util/delay.h> | ||
21 | #include "duck_led/duck_led.h" | ||
22 | |||
23 | #define LED_T1H 900 | ||
24 | #define LED_T1L 600 | ||
25 | #define LED_T0H 400 | ||
26 | #define LED_T0L 900 | ||
27 | |||
28 | void send_bit_d4(bool bitVal) { | ||
29 | if(bitVal) { | ||
30 | asm volatile ( | ||
31 | "sbi %[port], %[bit] \n\t" | ||
32 | ".rept %[onCycles] \n\t" | ||
33 | "nop \n\t" | ||
34 | ".endr \n\t" | ||
35 | "cbi %[port], %[bit] \n\t" | ||
36 | ".rept %[offCycles] \n\t" | ||
37 | "nop \n\t" | ||
38 | ".endr \n\t" | ||
39 | :: | ||
40 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
41 | [bit] "I" (4), | ||
42 | [onCycles] "I" (NS_TO_CYCLES(LED_T1H) - 2), | ||
43 | [offCycles] "I" (NS_TO_CYCLES(LED_T1L) - 2)); | ||
44 | } else { | ||
45 | asm volatile ( | ||
46 | "sbi %[port], %[bit] \n\t" | ||
47 | ".rept %[onCycles] \n\t" | ||
48 | "nop \n\t" | ||
49 | ".endr \n\t" | ||
50 | "cbi %[port], %[bit] \n\t" | ||
51 | ".rept %[offCycles] \n\t" | ||
52 | "nop \n\t" | ||
53 | ".endr \n\t" | ||
54 | :: | ||
55 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
56 | [bit] "I" (4), | ||
57 | [onCycles] "I" (NS_TO_CYCLES(LED_T0H) - 2), | ||
58 | [offCycles] "I" (NS_TO_CYCLES(LED_T0L) - 2)); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | void send_value(uint8_t byte, enum Device device) { | ||
63 | for(uint8_t b = 0; b < 8; b++) { | ||
64 | if(device == Device_STATUSLED) { | ||
65 | send_bit_d4(byte & 0b10000000); | ||
66 | byte <<= 1; | ||
67 | } | ||
68 | } | ||
69 | } | ||
70 | |||
71 | void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device) { | ||
72 | send_value(r, device); | ||
73 | send_value(g, device); | ||
74 | send_value(b, device); | ||
75 | } | ||
76 | |||
77 | void indicator_leds_set(bool leds[8]) { | ||
78 | cli(); | ||
79 | send_color(leds[1] ? 255 : 0, leds[2] ? 255 : 0, leds[0] ? 255 : 0, Device_STATUSLED); | ||
80 | send_color(leds[4] ? 255 : 0, leds[5] ? 255 : 0, leds[3] ? 255 : 0, Device_STATUSLED); | ||
81 | send_color(leds[6] ? 255 : 0, leds[7] ? 255 : 0, 0, Device_STATUSLED); | ||
82 | sei(); | ||
83 | show(); | ||
84 | } | ||
diff --git a/keyboards/duck/lightsaver/indicator_leds.h b/keyboards/duck/lightsaver/indicator_leds.h new file mode 100644 index 000000000..fe66eef6b --- /dev/null +++ b/keyboards/duck/lightsaver/indicator_leds.h | |||
@@ -0,0 +1 @@ | |||
void indicator_leds_set(bool leds[8]); | |||
diff --git a/keyboards/duck/lightsaver/info.json b/keyboards/duck/lightsaver/info.json new file mode 100644 index 000000000..92ffbf1c9 --- /dev/null +++ b/keyboards/duck/lightsaver/info.json | |||
@@ -0,0 +1,10 @@ | |||
1 | { | ||
2 | "keyboard_name": "Duck Lightsaver V3", | ||
3 | "url": "", | ||
4 | "maintainer": "qmk", | ||
5 | "layouts": { | ||
6 | "LAYOUT": { | ||
7 | "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":1, "y":0}, {"label":"F2", "x":2, "y":0}, {"label":"F3", "x":3, "y":0}, {"label":"F4", "x":4, "y":0}, {"label":"F5", "x":5, "y":0}, {"label":"F6", "x":6, "y":0}, {"label":"F7", "x":7, "y":0}, {"label":"F8", "x":8, "y":0}, {"label":"F9", "x":9, "y":0}, {"label":"F10", "x":10, "y":0}, {"label":"F11", "x":11, "y":0}, {"label":"F12", "x":12, "y":0}, {"label":"PrtSc", "x":13, "y":0}, {"label":"Num<br>Lock", "x":14, "y":0}, {"label":"Insert", "x":15, "y":0}, {"label":"Home", "x":16, "y":0}, {"label":"PgUp", "x":17, "y":0}, {"label":"/", "x":18, "y":0}, {"label":"~", "x":0, "y":1}, {"label":"!", "x":1, "y":1}, {"label":"@", "x":2, "y":1}, {"label":"#", "x":3, "y":1}, {"label":"$", "x":4, "y":1}, {"label":"%", "x":5, "y":1}, {"label":"^", "x":6, "y":1}, {"label":"&", "x":7, "y":1}, {"label":"*", "x":8, "y":1}, {"label":"(", "x":9, "y":1}, {"label":")", "x":10, "y":1}, {"label":"_", "x":11, "y":1}, {"label":"+", "x":12, "y":1}, {"label":"Bkspc", "x":13, "y":1, "w":2}, {"label":"Delete", "x":15, "y":1}, {"label":"End", "x":16, "y":1}, {"label":"PgDn", "x":17, "y":1}, {"label":"*", "x":18, "y":1}, {"label":"Tab", "x":0, "y":2, "w":1.5}, {"label":"Q", "x":1.5, "y":2}, {"label":"W", "x":2.5, "y":2}, {"label":"E", "x":3.5, "y":2}, {"label":"R", "x":4.5, "y":2}, {"label":"T", "x":5.5, "y":2}, {"label":"Y", "x":6.5, "y":2}, {"label":"U", "x":7.5, "y":2}, {"label":"I", "x":8.5, "y":2}, {"label":"O", "x":9.5, "y":2}, {"label":"P", "x":10.5, "y":2}, {"label":"{", "x":11.5, "y":2}, {"label":"}", "x":12.5, "y":2}, {"label":"|", "x":13.5, "y":2, "w":1.5}, {"label":"7", "x":15, "y":2}, {"label":"8", "x":16, "y":2}, {"label":"9", "x":17, "y":2}, {"label":"-", "x":18, "y":2}, {"label":"CapsLock", "x":0, "y":3, "w":1.75}, {"label":"A", "x":1.75, "y":3}, {"label":"S", "x":2.75, "y":3}, {"label":"D", "x":3.75, "y":3}, {"label":"F", "x":4.75, "y":3}, {"label":"G", "x":5.75, "y":3}, {"label":"H", "x":6.75, "y":3}, {"label":"J", "x":7.75, "y":3}, {"label":"K", "x":8.75, "y":3}, {"label":"L", "x":9.75, "y":3}, {"label":":", "x":10.75, "y":3}, {"label":"\"", "x":11.75, "y":3}, {"label":"Enter", "x":12.75, "y":3, "w":2.25}, {"label":"4", "x":15, "y":3}, {"label":"5", "x":16, "y":3}, {"label":"6", "x":17, "y":3}, {"label":"+", "x":18, "y":3}, {"label":"Shift", "x":0, "y":4, "w":2.25}, {"label":"Z", "x":2.25, "y":4}, {"label":"X", "x":3.25, "y":4}, {"label":"C", "x":4.25, "y":4}, {"label":"V", "x":5.25, "y":4}, {"label":"B", "x":6.25, "y":4}, {"label":"N", "x":7.25, "y":4}, {"label":"M", "x":8.25, "y":4}, {"label":"<", "x":9.25, "y":4}, {"label":">", "x":10.25, "y":4}, {"label":"?", "x":11.25, "y":4}, {"label":"Shift", "x":12.25, "y":4, "w":1.75}, {"label":"\u2191", "x":14, "y":4}, {"label":"1", "x":15, "y":4}, {"label":"2", "x":16, "y":4}, {"label":"3", "x":17, "y":4}, {"label":"Enter", "x":18, "y":4, "h":2}, {"label":"Ctrl", "x":0, "y":5, "w":1.25}, {"label":"Win", "x":1.25, "y":5, "w":1.25}, {"label":"Alt", "x":2.5, "y":5, "w":1.25}, {"x":3.75, "y":5, "w":6.25}, {"label":"Alt", "x":10, "y":5, "w":1.5}, {"label":"Ctrl", "x":11.5, "y":5, "w":1.5}, {"label":"\u2190", "x":13, "y":5}, {"label":"\u2193", "x":14, "y":5}, {"label":"\u2192", "x":15, "y":5}, {"label":"0", "x":16, "y":5}, {"label":".", "x":17, "y":5}] | ||
8 | } | ||
9 | } | ||
10 | } | ||
diff --git a/keyboards/duck/lightsaver/keymaps/default/keymap.c b/keyboards/duck/lightsaver/keymaps/default/keymap.c new file mode 100644 index 000000000..c63d4dc3c --- /dev/null +++ b/keyboards/duck/lightsaver/keymaps/default/keymap.c | |||
@@ -0,0 +1,44 @@ | |||
1 | /* Copyright 2017 Rasmus Schults <[email protected]> | ||
2 | * | ||
3 | * | ||
4 | * This program is free software: you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation, either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | #include QMK_KEYBOARD_H | ||
18 | |||
19 | #define KC_F1GL TD(TD_F1_GAME) | ||
20 | #define KC_CLFN TD(TD_CAPS_FN) | ||
21 | |||
22 | enum custom_layers { | ||
23 | BASE, // Base QWERTY layer | ||
24 | FN = 5, // Function layer | ||
25 | }; | ||
26 | |||
27 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
28 | [BASE] = LAYOUT( | ||
29 | KC_ESC, 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_PSCR, KC_NLCK, KC_INS, KC_HOME, KC_PGUP, KC_PSLS, | ||
30 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_END, KC_PGDN, KC_PAST, | ||
31 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_PMNS, | ||
32 | MO(FN), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, | ||
33 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, | ||
34 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT), | ||
35 | |||
36 | [FN] = LAYOUT( | ||
37 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PAUS, KC_SLCK, RGB_TOG, RGB_MOD, _______, _______, | ||
38 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_CAPS, BL_TOGG, _______, _______, _______, | ||
39 | _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, _______, _______, _______, _______, _______, _______, _______, | ||
40 | _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, _______, _______, _______, _______, _______, | ||
41 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET, | ||
42 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), | ||
43 | |||
44 | }; | ||
diff --git a/keyboards/duck/lightsaver/keymaps/default/readme.md b/keyboards/duck/lightsaver/keymaps/default/readme.md new file mode 100644 index 000000000..06f9aac5a --- /dev/null +++ b/keyboards/duck/lightsaver/keymaps/default/readme.md | |||
@@ -0,0 +1,11 @@ | |||
1 |  | ||
2 | |||
3 | # Default Lightsaver Layout | ||
4 | |||
5 | This is the default implement layout for Duck Lightsaver V3. | ||
6 | |||
7 | |||
8 | ## Features | ||
9 | |||
10 | * Default QWERTY layer | ||
11 | * FN layer - Control RGB underglow and backlight. HJKL Vim style movement. | ||
diff --git a/keyboards/duck/lightsaver/keymaps/rasmus/config.h b/keyboards/duck/lightsaver/keymaps/rasmus/config.h new file mode 100644 index 000000000..f2b5d264e --- /dev/null +++ b/keyboards/duck/lightsaver/keymaps/rasmus/config.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | #include "../../config.h" | ||
5 | |||
6 | #define FORCE_NKRO | ||
7 | |||
8 | #endif | ||
diff --git a/keyboards/duck/lightsaver/keymaps/rasmus/keymap.c b/keyboards/duck/lightsaver/keymaps/rasmus/keymap.c new file mode 100644 index 000000000..70dc17bb1 --- /dev/null +++ b/keyboards/duck/lightsaver/keymaps/rasmus/keymap.c | |||
@@ -0,0 +1,102 @@ | |||
1 | /* Copyright 2017 Rasmus Schults <[email protected]> | ||
2 | * | ||
3 | * | ||
4 | * This program is free software: you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation, either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | #include QMK_KEYBOARD_H | ||
18 | |||
19 | #define KC_F1GL TD(TD_F1_GAME) | ||
20 | #define KC_CLFN TD(TD_CAPS_FN) | ||
21 | |||
22 | enum custom_layers { | ||
23 | BASE, // Base QWERTY layer | ||
24 | GAME, // Gaming layer | ||
25 | FN = 5, // Function layer | ||
26 | }; | ||
27 | |||
28 | //Tap Dance Declarations | ||
29 | enum { | ||
30 | TD_F1_BASE, | ||
31 | TD_F1_GAME, | ||
32 | TD_CAPS_FN | ||
33 | }; | ||
34 | |||
35 | //Tap Dance Definitions | ||
36 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
37 | [TD_F1_GAME] = ACTION_TAP_DANCE_DUAL_ROLE(KC_F1, GAME), | ||
38 | [TD_CAPS_FN] = ACTION_TAP_DANCE_DUAL_ROLE(KC_CAPS, 5) | ||
39 | }; | ||
40 | |||
41 | enum macro_id { | ||
42 | SHRG, | ||
43 | }; | ||
44 | |||
45 | #define TYPE_SHRUG MACRO( \ | ||
46 | D(LCTRL), D(LSHIFT), T(U), U(LCTRL), U(LSHIFT), \ | ||
47 | T(0), T(0), T(A), T(F), \ | ||
48 | D(LCTRL), D(LSHIFT), T(U), U(LCTRL), U(LSHIFT), \ | ||
49 | T(0), T(0), T(5), T(C), \ | ||
50 | D(LCTRL), D(LSHIFT), T(U), U(LCTRL), U(LSHIFT), \ | ||
51 | T(0), T(0), T(5), T(F), \ | ||
52 | D(LCTRL), D(LSHIFT), T(U), U(LCTRL), U(LSHIFT), \ | ||
53 | T(0), T(0), T(2), T(8), \ | ||
54 | D(LCTRL), D(LSHIFT), T(U), U(LCTRL), U(LSHIFT), \ | ||
55 | T(3), T(0), T(C), T(4), \ | ||
56 | D(LCTRL), D(LSHIFT), T(U), U(LCTRL), U(LSHIFT), \ | ||
57 | T(0), T(0), T(2), T(9), \ | ||
58 | D(LCTRL), D(LSHIFT), T(U), U(LCTRL), U(LSHIFT), \ | ||
59 | T(0), T(0), T(5), T(F), \ | ||
60 | D(LCTRL), D(LSHIFT), T(U), U(LCTRL), U(LSHIFT), \ | ||
61 | T(0), T(0), T(2), T(F), \ | ||
62 | D(LCTRL), D(LSHIFT), T(U), U(LCTRL), U(LSHIFT), \ | ||
63 | T(0), T(0), T(A), T(F), \ | ||
64 | T(SPACE), END \ | ||
65 | ) | ||
66 | |||
67 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
68 | [BASE] = LAYOUT(\ | ||
69 | KC_ESC, KC_F1GL, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NLCK, KC_INS, KC_HOME, KC_PGUP, KC_PSLS, \ | ||
70 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_END, KC_PGDN, KC_PAST, \ | ||
71 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_PMNS, \ | ||
72 | MO(FN), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, \ | ||
73 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, \ | ||
74 | KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT), \ | ||
75 | |||
76 | [GAME] = LAYOUT(\ | ||
77 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LOCK, _______, _______, _______, _______, _______, \ | ||
78 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
79 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
80 | KC_CLFN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
81 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
82 | _______, KC_LGUI, KC_LALT, _______, KC_RALT, _______, _______, _______, _______, _______, _______ ), \ | ||
83 | |||
84 | [FN] = LAYOUT(\ | ||
85 | _______, M(SHRG), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PAUS, KC_SLCK, RGB_TOG, RGB_MOD, _______, _______, \ | ||
86 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_TOGG, _______, _______, _______, \ | ||
87 | _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
88 | _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, _______, _______, _______, _______, _______, \ | ||
89 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET, \ | ||
90 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), \ | ||
91 | |||
92 | }; | ||
93 | |||
94 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { | ||
95 | switch(id) { | ||
96 | case SHRG: | ||
97 | return (record->event.pressed ? TYPE_SHRUG : MACRO_NONE ); | ||
98 | break; | ||
99 | } | ||
100 | |||
101 | return MACRO_NONE; | ||
102 | }; | ||
diff --git a/keyboards/duck/lightsaver/keymaps/rasmus/readme.md b/keyboards/duck/lightsaver/keymaps/rasmus/readme.md new file mode 100644 index 000000000..7670145f7 --- /dev/null +++ b/keyboards/duck/lightsaver/keymaps/rasmus/readme.md | |||
@@ -0,0 +1,12 @@ | |||
1 |  | ||
2 | |||
3 | # rasmusx's Lightsaver Layout | ||
4 | |||
5 | Custom keymap for Lightsaver. | ||
6 | |||
7 | |||
8 | ## Features | ||
9 | |||
10 | * Default layer has ALT/SUPER switched and FN key in Caps Lock place. | ||
11 | * FN layer - Control RGB underglow and backlight. HJKL Vim style movement. | ||
12 | * Game layer - ALT/SUPER in normal positions. FN behaviour: 1 tap Caps Lock, 2 taps FN | ||
diff --git a/keyboards/duck/lightsaver/keymaps/rasmus/rules.mk b/keyboards/duck/lightsaver/keymaps/rasmus/rules.mk new file mode 100644 index 000000000..3b11f9a9c --- /dev/null +++ b/keyboards/duck/lightsaver/keymaps/rasmus/rules.mk | |||
@@ -0,0 +1,2 @@ | |||
1 | KEY_LOCK_ENABLE = yes | ||
2 | TAP_DANCE_ENABLE = yes | ||
diff --git a/keyboards/duck/lightsaver/lightsaver.c b/keyboards/duck/lightsaver/lightsaver.c new file mode 100644 index 000000000..e0fe918e7 --- /dev/null +++ b/keyboards/duck/lightsaver/lightsaver.c | |||
@@ -0,0 +1,56 @@ | |||
1 | /* Copyright 2017 Rasmus Schults <[email protected]> | ||
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 "lightsaver.h" | ||
17 | #include "indicator_leds.h" | ||
18 | |||
19 | enum BACKLIGHT_AREAS { | ||
20 | BACKLIGHT_ALPHAS = 0b00000010, // Alpha keys | ||
21 | BACKLIGHT_FKEYS = 0b00000100, // Function row keys | ||
22 | BACKLIGHT_MODNUM = 0b00001000, // Modifiers and number row | ||
23 | BACKLIGHT_NUMPAD = 0b01000000 // Numpad area | ||
24 | }; | ||
25 | |||
26 | void backlight_set(uint8_t level) { | ||
27 | if (level > 0) { | ||
28 | // Turn on leds | ||
29 | PORTB &= ~BACKLIGHT_ALPHAS; | ||
30 | PORTB &= ~BACKLIGHT_FKEYS; | ||
31 | PORTB &= ~BACKLIGHT_MODNUM; | ||
32 | PORTE &= ~BACKLIGHT_NUMPAD; | ||
33 | } else { | ||
34 | // Turn off leds | ||
35 | PORTB |= BACKLIGHT_ALPHAS; | ||
36 | PORTB |= BACKLIGHT_FKEYS; | ||
37 | PORTB |= BACKLIGHT_MODNUM; | ||
38 | PORTE |= BACKLIGHT_NUMPAD; | ||
39 | } | ||
40 | } | ||
41 | |||
42 | void led_set_kb(uint8_t usb_led) { | ||
43 | bool leds[8] = { | ||
44 | usb_led & (1<<USB_LED_CAPS_LOCK), | ||
45 | usb_led & (1<<USB_LED_SCROLL_LOCK), | ||
46 | usb_led & (1<<USB_LED_NUM_LOCK), | ||
47 | layer_state & (1<<1), | ||
48 | layer_state & (1<<2), | ||
49 | layer_state & (1<<3), | ||
50 | layer_state & (1<<4), | ||
51 | layer_state & (1<<5) | ||
52 | }; | ||
53 | indicator_leds_set(leds); | ||
54 | |||
55 | led_set_user(usb_led); | ||
56 | } | ||
diff --git a/keyboards/duck/lightsaver/lightsaver.h b/keyboards/duck/lightsaver/lightsaver.h new file mode 100644 index 000000000..1e1185713 --- /dev/null +++ b/keyboards/duck/lightsaver/lightsaver.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* Copyright 2017 Rasmus Schults <[email protected]> | ||
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 | #pragma once | ||
17 | |||
18 | #include "quantum.h" | ||
19 | |||
20 | #define NO KC_NO | ||
21 | |||
22 | #define LAYOUT( \ | ||
23 | K5A, K5B, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, \ | ||
24 | K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4O, K4P, K4Q, K4R, K4S, \ | ||
25 | K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, K3P, K3Q, K3R, K3S, \ | ||
26 | K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2O, K2P, K2Q, K2R, K2S, \ | ||
27 | K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, K1O, K1P, K1Q, K1R, K1S, \ | ||
28 | K0A, K0B, K0C, K0I, K0K, K0M, K0N, K0O, K0P, K0Q, K0R \ | ||
29 | ) { \ | ||
30 | /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 */ \ | ||
31 | /* 0 */ { K5A, K5B, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, K5S, }, \ | ||
32 | /* 1 */ { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, NO, K4O, K4P, K4Q, K4R, K4S, }, \ | ||
33 | /* 2 */ { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, NO, K3O, K3P, K3Q, K3R, K3S, }, \ | ||
34 | /* 3 */ { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, NO, NO, K2O, K2P, K2Q, K2R, K2S, }, \ | ||
35 | /* 4 */ { K1A, NO, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, NO, K1M, K1N, K1O, K1P, K1Q, K1R, K1S, }, \ | ||
36 | /* 5 */ { K0A, K0B, K0C, NO, NO, NO, NO, NO, K0I, NO, K0K, NO, K0M, K0N, K0O, K0P, K0Q, K0R } \ | ||
37 | } | ||
38 | |||
diff --git a/keyboards/duck/lightsaver/matrix.c b/keyboards/duck/lightsaver/matrix.c new file mode 100644 index 000000000..066452724 --- /dev/null +++ b/keyboards/duck/lightsaver/matrix.c | |||
@@ -0,0 +1,278 @@ | |||
1 | /* | ||
2 | Copyright 2016-2017 Ralf Schmitt <[email protected]> Rasmus Schults <[email protected]> | ||
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 <util/delay.h> | ||
18 | #include <avr/io.h> | ||
19 | #include <stdio.h> | ||
20 | #include "matrix.h" | ||
21 | #include "util.h" | ||
22 | #include "print.h" | ||
23 | #include "debug.h" | ||
24 | |||
25 | static uint8_t debouncing = DEBOUNCE; | ||
26 | |||
27 | /* matrix state(1:on, 0:off) */ | ||
28 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
29 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
30 | |||
31 | static uint8_t read_rows(void); | ||
32 | static uint8_t read_fwkey(void); | ||
33 | static void init_rows(void); | ||
34 | static void unselect_cols(void); | ||
35 | static void select_col(uint8_t col); | ||
36 | |||
37 | |||
38 | __attribute__ ((weak)) | ||
39 | void matrix_init_kb(void) { | ||
40 | matrix_init_user(); | ||
41 | } | ||
42 | |||
43 | __attribute__ ((weak)) | ||
44 | void matrix_scan_kb(void) { | ||
45 | matrix_scan_user(); | ||
46 | } | ||
47 | |||
48 | __attribute__ ((weak)) | ||
49 | void matrix_init_user(void) { | ||
50 | } | ||
51 | |||
52 | __attribute__ ((weak)) | ||
53 | void matrix_scan_user(void) { | ||
54 | } | ||
55 | |||
56 | void matrix_init(void) { | ||
57 | DDRD |= 0b11010000; | ||
58 | PORTD &= ~0b01010000; | ||
59 | DDRB |= 0b00011111; | ||
60 | PORTB &= ~0b00001110; | ||
61 | PORTB |= 0b00010001; | ||
62 | DDRE |= 0b01000000; | ||
63 | PORTE &= ~0b01000000; | ||
64 | |||
65 | unselect_cols(); | ||
66 | init_rows(); | ||
67 | |||
68 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | ||
69 | matrix[i] = 0; | ||
70 | matrix_debouncing[i] = 0; | ||
71 | } | ||
72 | |||
73 | matrix_init_quantum(); | ||
74 | } | ||
75 | |||
76 | uint8_t matrix_scan(void) { | ||
77 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { | ||
78 | select_col(col); | ||
79 | _delay_us(3); | ||
80 | |||
81 | uint8_t rows = read_rows(); | ||
82 | if(col == 0) { | ||
83 | rows |= read_fwkey(); | ||
84 | } | ||
85 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
86 | bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col); | ||
87 | bool curr_bit = rows & (1<<row); | ||
88 | if (prev_bit != curr_bit) { | ||
89 | matrix_debouncing[row] ^= ((matrix_row_t)1<<col); | ||
90 | if (debouncing) { | ||
91 | dprint("bounce!: "); dprintf("%02X", debouncing); dprintln(); | ||
92 | } | ||
93 | debouncing = DEBOUNCE; | ||
94 | } | ||
95 | } | ||
96 | unselect_cols(); | ||
97 | } | ||
98 | |||
99 | if (debouncing) { | ||
100 | if (--debouncing) { | ||
101 | _delay_ms(1); | ||
102 | } else { | ||
103 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
104 | matrix[i] = matrix_debouncing[i]; | ||
105 | } | ||
106 | } | ||
107 | } | ||
108 | |||
109 | matrix_scan_quantum(); | ||
110 | return 1; | ||
111 | } | ||
112 | |||
113 | inline matrix_row_t matrix_get_row(uint8_t row) { | ||
114 | return matrix[row]; | ||
115 | } | ||
116 | |||
117 | void matrix_print(void) { | ||
118 | print("\nr/c 0123456789ABCDEF\n"); | ||
119 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
120 | xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row))); | ||
121 | } | ||
122 | } | ||
123 | |||
124 | /* Row pin configuration | ||
125 | * row: 0 1 2 3 4 5 | ||
126 | * pin: PB7 PD0 PD1 PD2 PD3 PD5 | ||
127 | * | ||
128 | * Esc uses its own pin PE2 | ||
129 | */ | ||
130 | static void init_rows(void) { | ||
131 | DDRB &= ~0b10000000; | ||
132 | PORTB &= ~0b10000000; | ||
133 | |||
134 | DDRD &= ~0b00101111; | ||
135 | PORTD &= ~0b00101111; | ||
136 | |||
137 | DDRE &= ~0b00000100; | ||
138 | PORTE |= 0b00000100; | ||
139 | } | ||
140 | |||
141 | static uint8_t read_rows() { | ||
142 | return (PINB&(1<<7) ? (1<<0) : 0) | | ||
143 | (PIND&(1<<0) ? (1<<1) : 0) | | ||
144 | (PIND&(1<<1) ? (1<<2) : 0) | | ||
145 | (PIND&(1<<2) ? (1<<3) : 0) | | ||
146 | (PIND&(1<<3) ? (1<<4) : 0) | | ||
147 | (PIND&(1<<5) ? (1<<5) : 0); | ||
148 | } | ||
149 | |||
150 | static uint8_t read_fwkey(void) | ||
151 | { | ||
152 | return PINE&(1<<2) ? 0 : (1<<0); | ||
153 | } | ||
154 | |||
155 | /* Columns 0 - 15 | ||
156 | * These columns uses two 74HC237D 3 to 8 bit demultiplexers. | ||
157 | * col / pin: PC6 PB6 PF0 PF1 PC7 | ||
158 | * 0: 1 0 0 0 0 | ||
159 | * 1: 1 0 1 0 0 | ||
160 | * 2: 1 0 0 1 0 | ||
161 | * 3: 1 0 1 1 0 | ||
162 | * 4: 1 0 0 0 1 | ||
163 | * 5: 1 0 1 0 1 | ||
164 | * 6: 1 0 0 1 1 | ||
165 | * 7: 1 0 1 1 1 | ||
166 | * 8: 0 1 0 0 0 | ||
167 | * 9: 0 1 1 0 0 | ||
168 | * 10: 0 1 0 1 0 | ||
169 | * 11: 0 1 1 1 0 | ||
170 | * 12: 0 1 0 0 1 | ||
171 | * 13: 0 1 1 0 1 | ||
172 | * 14: 0 1 0 1 1 | ||
173 | * 15: 0 1 1 1 1 | ||
174 | * | ||
175 | * col: 16 | ||
176 | * pin: PB5 | ||
177 | * | ||
178 | * col: 17 | ||
179 | * pin: PB4 | ||
180 | * | ||
181 | * col: 18 | ||
182 | * pin: PD7 | ||
183 | */ | ||
184 | static void unselect_cols(void) { | ||
185 | DDRB |= 0b01110000; | ||
186 | PORTB &= ~0b01110000; | ||
187 | |||
188 | DDRC |= (1<<6) | (1<<7); | ||
189 | PORTC &= ~((1<<6) | (1<<7)); | ||
190 | |||
191 | DDRF |= (1<<0) | (1<<1); | ||
192 | PORTF &= ~((1<<0) | (1<<1)); | ||
193 | |||
194 | DDRD |= (1<<7); | ||
195 | PORTD &= ~(1<<7); | ||
196 | } | ||
197 | |||
198 | static void select_col(uint8_t col) { | ||
199 | switch (col) { | ||
200 | case 0: | ||
201 | PORTC |= (1<<6); | ||
202 | break; | ||
203 | case 1: | ||
204 | PORTC |= (1<<6); | ||
205 | PORTF |= (1<<0); | ||
206 | break; | ||
207 | case 2: | ||
208 | PORTC |= (1<<6); | ||
209 | PORTF |= (1<<1); | ||
210 | break; | ||
211 | case 3: | ||
212 | PORTC |= (1<<6); | ||
213 | PORTF |= (1<<0) | (1<<1); | ||
214 | break; | ||
215 | case 4: | ||
216 | PORTC |= (1<<6); | ||
217 | PORTC |= (1<<7); | ||
218 | break; | ||
219 | case 5: | ||
220 | PORTC |= (1<<6); | ||
221 | PORTF |= (1<<0); | ||
222 | PORTC |= (1<<7); | ||
223 | break; | ||
224 | case 6: | ||
225 | PORTC |= (1<<6); | ||
226 | PORTF |= (1<<1); | ||
227 | PORTC |= (1<<7); | ||
228 | break; | ||
229 | case 7: | ||
230 | PORTC |= (1<<6); | ||
231 | PORTF |= (1<<0) | (1<<1); | ||
232 | PORTC |= (1<<7); | ||
233 | break; | ||
234 | case 8: | ||
235 | PORTB |= (1<<6); | ||
236 | break; | ||
237 | case 9: | ||
238 | PORTB |= (1<<6); | ||
239 | PORTF |= (1<<0); | ||
240 | break; | ||
241 | case 10: | ||
242 | PORTB |= (1<<6); | ||
243 | PORTF |= (1<<1); | ||
244 | break; | ||
245 | case 11: | ||
246 | PORTB |= (1<<6); | ||
247 | PORTF |= (1<<0) | (1<<1); | ||
248 | break; | ||
249 | case 12: | ||
250 | PORTB |= (1<<6); | ||
251 | PORTC |= (1<<7); | ||
252 | break; | ||
253 | case 13: | ||
254 | PORTB |= (1<<6); | ||
255 | PORTF |= (1<<0); | ||
256 | PORTC |= (1<<7); | ||
257 | break; | ||
258 | case 14: | ||
259 | PORTB |= (1<<6); | ||
260 | PORTF |= (1<<1); | ||
261 | PORTC |= (1<<7); | ||
262 | break; | ||
263 | case 15: | ||
264 | PORTB |= (1<<6); | ||
265 | PORTF |= (1<<0) | (1<<1); | ||
266 | PORTC |= (1<<7); | ||
267 | break; | ||
268 | case 16: | ||
269 | PORTB |= (1<<5); | ||
270 | break; | ||
271 | case 17: | ||
272 | PORTB |= (1<<4); | ||
273 | break; | ||
274 | case 18: | ||
275 | PORTD |= (1<<7); | ||
276 | break; | ||
277 | } | ||
278 | } | ||
diff --git a/keyboards/duck/lightsaver/readme.md b/keyboards/duck/lightsaver/readme.md new file mode 100644 index 000000000..a77a90111 --- /dev/null +++ b/keyboards/duck/lightsaver/readme.md | |||
@@ -0,0 +1,19 @@ | |||
1 | # Duck Lightsaver V3 | ||
2 | |||
3 |  | ||
4 | |||
5 | Non official firmware for custom Korean keyboard with 96 key layout made by Duck. | ||
6 | Group buy was run 2017 May via [geekhack](https://geekhack.org/index.php?topic=89546.0) and limited to 100 units. | ||
7 | |||
8 | Keyboard Maintainer: [Rasmus Schults](https://github.com/rasmusx) | ||
9 | Hardware Supported: Lightsaver PCB Ver 3.0, Atmega32u4 | ||
10 | Hardware Availability: [geekhack](https://geekhack.org/index.php?topic=89546.0) | ||
11 | |||
12 | Make example for this keyboard (after setting up your build environment): | ||
13 | |||
14 | make lightsaver:default | ||
15 | |||
16 | See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. | ||
17 | |||
18 | ## Notes | ||
19 | Thanks to Ralf Schmitt for previous implementations in his [TMK fork](https://github.com/xauser/tmk_keyboard/tree/xauser/) and few helping words. | ||
diff --git a/keyboards/duck/lightsaver/rules.mk b/keyboards/duck/lightsaver/rules.mk new file mode 100644 index 000000000..d9cbdb833 --- /dev/null +++ b/keyboards/duck/lightsaver/rules.mk | |||
@@ -0,0 +1,23 @@ | |||
1 | # MCU name | ||
2 | MCU = atmega32u4 | ||
3 | |||
4 | # Bootloader selection | ||
5 | BOOTLOADER = atmel-dfu | ||
6 | |||
7 | # Build Options | ||
8 | # change yes to no to disable | ||
9 | # | ||
10 | BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite | ||
11 | MOUSEKEY_ENABLE = no # Mouse keys | ||
12 | EXTRAKEY_ENABLE = no # Audio control and System control | ||
13 | CONSOLE_ENABLE = no # Console for debug | ||
14 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
15 | NKRO_ENABLE = yes # Enable N-Key Rollover | ||
16 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | ||
17 | BACKLIGHT_DRIVER = custom | ||
18 | AUDIO_ENABLE = no # Audio output | ||
19 | RGBLIGHT_ENABLE = yes | ||
20 | |||
21 | CUSTOM_MATRIX = yes | ||
22 | SRC += indicator_leds.c \ | ||
23 | matrix.c duck_led/duck_led.c | ||
diff --git a/keyboards/duck/octagon/.noci b/keyboards/duck/octagon/.noci new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/keyboards/duck/octagon/.noci | |||
diff --git a/keyboards/duck/octagon/keymaps/default/keymap.c b/keyboards/duck/octagon/keymaps/default/keymap.c new file mode 100644 index 000000000..27e7328e2 --- /dev/null +++ b/keyboards/duck/octagon/keymaps/default/keymap.c | |||
@@ -0,0 +1,37 @@ | |||
1 | /* Copyright 2018 MechMerlin <[email protected]> | ||
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 | #define _BL 0 // Base Layer | ||
19 | #define _FL 1 // Fn Layer | ||
20 | |||
21 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
22 | [_BL] = LAYOUT_75_ansi( | ||
23 | KC_ESC, 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_PSCR, KC_PAUS, KC_DEL, | ||
24 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, | ||
25 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, | ||
26 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, | ||
27 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, | ||
28 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(_FL), KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), | ||
29 | |||
30 | [_FL] = LAYOUT_75_ansi( | ||
31 | KC_TRNS, RGB_TOG, RGB_MOD, RGB_VAI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
32 | 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, | ||
33 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
34 | 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, | ||
35 | 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, | ||
36 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
37 | }; \ No newline at end of file | ||
diff --git a/keyboards/duck/octagon/keymaps/default/readme.md b/keyboards/duck/octagon/keymaps/default/readme.md new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/keyboards/duck/octagon/keymaps/default/readme.md | |||
diff --git a/keyboards/duck/octagon/keymaps/via/keymap.c b/keyboards/duck/octagon/keymaps/via/keymap.c new file mode 100644 index 000000000..b391d2f0a --- /dev/null +++ b/keyboards/duck/octagon/keymaps/via/keymap.c | |||
@@ -0,0 +1,50 @@ | |||
1 | /* Copyright 2018 MechMerlin <[email protected]> | ||
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 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
19 | [0] = LAYOUT_75_ansi( | ||
20 | KC_ESC, 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_PSCR, KC_PAUS, KC_DEL, | ||
21 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, | ||
22 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, | ||
23 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, | ||
24 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, | ||
25 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, LT(1,KC_APP), LT(2,KC_RCTL), KC_LEFT, KC_DOWN, KC_RGHT), | ||
26 | |||
27 | [1] = LAYOUT_75_ansi( | ||
28 | 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, KC_TRNS, | ||
29 | 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, | ||
30 | 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, | ||
31 | 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, | ||
32 | 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, | ||
33 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
34 | |||
35 | [2] = LAYOUT_75_ansi( | ||
36 | 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, KC_TRNS, | ||
37 | 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, | ||
38 | 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, | ||
39 | 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, | ||
40 | 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, | ||
41 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
42 | |||
43 | [3] = LAYOUT_75_ansi( | ||
44 | 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, KC_TRNS, | ||
45 | 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, | ||
46 | 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, | ||
47 | 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, | ||
48 | 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, | ||
49 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
50 | }; | ||
diff --git a/keyboards/duck/octagon/keymaps/via/rules.mk b/keyboards/duck/octagon/keymaps/via/rules.mk new file mode 100644 index 000000000..36b7ba9cb --- /dev/null +++ b/keyboards/duck/octagon/keymaps/via/rules.mk | |||
@@ -0,0 +1,2 @@ | |||
1 | VIA_ENABLE = yes | ||
2 | LTO_ENABLE = yes | ||
diff --git a/keyboards/duck/octagon/readme.md b/keyboards/duck/octagon/readme.md new file mode 100644 index 000000000..b91a76c70 --- /dev/null +++ b/keyboards/duck/octagon/readme.md | |||
@@ -0,0 +1,11 @@ | |||
1 | # Duck Octagon | ||
2 | |||
3 | Non official firmware for custom Korean keyboard with 75% key layout made by Duck. | ||
4 | |||
5 | See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. | ||
6 | |||
7 | Newest version is the [Octagon V2](http://duck0113.tistory.com/127) | ||
8 | |||
9 | Make example for this keyboard (after setting up your build environment): | ||
10 | |||
11 | make duck/octagon/v2:default | ||
diff --git a/keyboards/duck/octagon/rules.mk b/keyboards/duck/octagon/rules.mk new file mode 100644 index 000000000..46bd457bb --- /dev/null +++ b/keyboards/duck/octagon/rules.mk | |||
@@ -0,0 +1 @@ | |||
DEFAULT_FOLDER = duck/octagon/v2 \ No newline at end of file | |||
diff --git a/keyboards/duck/octagon/v1/.noci b/keyboards/duck/octagon/v1/.noci new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/keyboards/duck/octagon/v1/.noci | |||
diff --git a/keyboards/duck/octagon/v1/config.h b/keyboards/duck/octagon/v1/config.h new file mode 100644 index 000000000..7bf69a7b6 --- /dev/null +++ b/keyboards/duck/octagon/v1/config.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | Copyright 2017 MechMerlin <[email protected]> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #pragma once | ||
19 | |||
20 | #include "config_common.h" | ||
21 | |||
22 | /* USB Device descriptor parameter */ | ||
23 | #define VENDOR_ID 0x444B // Duck ("DK") | ||
24 | #define PRODUCT_ID 0x4F31 // Octagon V1 ("O1") | ||
25 | #define DEVICE_VER 0x0001 | ||
26 | #define MANUFACTURER Duck | ||
27 | #define PRODUCT Octagon V1 | ||
28 | |||
29 | /* key matrix size */ | ||
30 | #define MATRIX_ROWS 6 | ||
31 | #define MATRIX_COLS 16 | ||
32 | |||
33 | #define DIODE_DIRECTION COL2ROW | ||
34 | |||
35 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
36 | #define DEBOUNCE 5 | ||
37 | |||
38 | /* number of backlight levels */ | ||
39 | #define BACKLIGHT_LEVELS 1 | ||
40 | |||
41 | #define RGBLIGHT_ANIMATIONS | ||
42 | #define RGB_DI_PIN D6 | ||
43 | #define RGBLED_NUM 17 | ||
44 | |||
45 | /* Set to top left most key */ | ||
46 | #define BOOTMAGIC_LITE_ROW 5 | ||
47 | #define BOOTMAGIC_LITE_COLUMN 10 | ||
48 | |||
49 | #define TAPPING_TERM 200 | ||
diff --git a/keyboards/duck/octagon/v1/info.json b/keyboards/duck/octagon/v1/info.json new file mode 100644 index 000000000..1fae48975 --- /dev/null +++ b/keyboards/duck/octagon/v1/info.json | |||
@@ -0,0 +1,95 @@ | |||
1 | { | ||
2 | "keyboard_name": "Octagon V1", | ||
3 | "url": "", | ||
4 | "maintainer": "qmk", | ||
5 | "layouts": { | ||
6 | "LAYOUT_75_ansi": { | ||
7 | "layout": [ | ||
8 | {"label":"Esc", "x":0, "y":0}, | ||
9 | {"label":"F1", "x":1, "y":0}, | ||
10 | {"label":"F2", "x":2, "y":0}, | ||
11 | {"label":"F3", "x":3, "y":0}, | ||
12 | {"label":"F4", "x":4, "y":0}, | ||
13 | {"label":"F5", "x":5, "y":0}, | ||
14 | {"label":"F6", "x":6, "y":0}, | ||
15 | {"label":"F7", "x":7, "y":0}, | ||
16 | {"label":"F8", "x":8, "y":0}, | ||
17 | {"label":"F9", "x":9, "y":0}, | ||
18 | {"label":"F10", "x":10, "y":0}, | ||
19 | {"label":"F11", "x":11, "y":0}, | ||
20 | {"label":"F12", "x":12, "y":0}, | ||
21 | {"label":"PrtSc", "x":13, "y":0}, | ||
22 | {"label":"ScrLk", "x":14, "y":0}, | ||
23 | {"label":"Pause", "x":15, "y":0}, | ||
24 | {"label":"~", "x":0, "y":1}, | ||
25 | {"label":"!", "x":1, "y":1}, | ||
26 | {"label":"@", "x":2, "y":1}, | ||
27 | {"label":"#", "x":3, "y":1}, | ||
28 | {"label":"$", "x":4, "y":1}, | ||
29 | {"label":"%", "x":5, "y":1}, | ||
30 | {"label":"^", "x":6, "y":1}, | ||
31 | {"label":"&", "x":7, "y":1}, | ||
32 | {"label":"*", "x":8, "y":1}, | ||
33 | {"label":"(", "x":9, "y":1}, | ||
34 | {"label":")", "x":10, "y":1}, | ||
35 | {"label":"_", "x":11, "y":1}, | ||
36 | {"label":"+", "x":12, "y":1}, | ||
37 | {"label":"Backspace", "x":13, "y":1, "w":2}, | ||
38 | {"label":"Home", "x":15, "y":1}, | ||
39 | {"label":"Tab", "x":0, "y":2, "w":1.5}, | ||
40 | {"label":"Q", "x":1.5, "y":2}, | ||
41 | {"label":"W", "x":2.5, "y":2}, | ||
42 | {"label":"E", "x":3.5, "y":2}, | ||
43 | {"label":"R", "x":4.5, "y":2}, | ||
44 | {"label":"T", "x":5.5, "y":2}, | ||
45 | {"label":"Y", "x":6.5, "y":2}, | ||
46 | {"label":"U", "x":7.5, "y":2}, | ||
47 | {"label":"I", "x":8.5, "y":2}, | ||
48 | {"label":"O", "x":9.5, "y":2}, | ||
49 | {"label":"P", "x":10.5, "y":2}, | ||
50 | {"label":"{", "x":11.5, "y":2}, | ||
51 | {"label":"}", "x":12.5, "y":2}, | ||
52 | {"label":"|", "x":13.5, "y":2, "w":1.5}, | ||
53 | {"label":"Page Up", "x":15, "y":2}, | ||
54 | {"label":"Caps Lock", "x":0, "y":3, "w":1.75}, | ||
55 | {"label":"A", "x":1.75, "y":3}, | ||
56 | {"label":"S", "x":2.75, "y":3}, | ||
57 | {"label":"D", "x":3.75, "y":3}, | ||
58 | {"label":"F", "x":4.75, "y":3}, | ||
59 | {"label":"G", "x":5.75, "y":3}, | ||
60 | {"label":"H", "x":6.75, "y":3}, | ||
61 | {"label":"J", "x":7.75, "y":3}, | ||
62 | {"label":"K", "x":8.75, "y":3}, | ||
63 | {"label":"L", "x":9.75, "y":3}, | ||
64 | {"label":":", "x":10.75, "y":3}, | ||
65 | {"label":"\"", "x":11.75, "y":3}, | ||
66 | {"label":"Enter", "x":12.75, "y":3, "w":2.25}, | ||
67 | {"label":"Page Down", "x":15, "y":3}, | ||
68 | {"label":"Shift", "x":0, "y":4, "w":2.25}, | ||
69 | {"label":"Z", "x":2.25, "y":4}, | ||
70 | {"label":"X", "x":3.25, "y":4}, | ||
71 | {"label":"C", "x":4.25, "y":4}, | ||
72 | {"label":"V", "x":5.25, "y":4}, | ||
73 | {"label":"B", "x":6.25, "y":4}, | ||
74 | {"label":"N", "x":7.25, "y":4}, | ||
75 | {"label":"M", "x":8.25, "y":4}, | ||
76 | {"label":"<", "x":9.25, "y":4}, | ||
77 | {"label":">", "x":10.25, "y":4}, | ||
78 | {"label":"?", "x":11.25, "y":4}, | ||
79 | {"label":"Shift", "x":12.25, "y":4, "w":1.75}, | ||
80 | {"label":"\u2191", "x":14, "y":4}, | ||
81 | {"label":"End", "x":15, "y":4}, | ||
82 | {"label":"Ctrl", "x":0, "y":5, "w":1.25}, | ||
83 | {"label":"Win", "x":1.25, "y":5, "w":1.25}, | ||
84 | {"label":"Alt", "x":2.5, "y":5, "w":1.25}, | ||
85 | {"label":"Space", "x":3.75, "y":5, "w":6.25}, | ||
86 | {"label":"Alt", "x":10, "y":5}, | ||
87 | {"label":"Fn", "x":11, "y":5}, | ||
88 | {"label":"Ctrl", "x":12, "y":5}, | ||
89 | {"label":"\u2190", "x":13, "y":5}, | ||
90 | {"label":"\u2193", "x":14, "y":5}, | ||
91 | {"label":"\u2192", "x":15, "y":5} | ||
92 | ] | ||
93 | } | ||
94 | } | ||
95 | } | ||
diff --git a/keyboards/duck/octagon/v1/matrix.c b/keyboards/duck/octagon/v1/matrix.c new file mode 100644 index 000000000..a2bea865b --- /dev/null +++ b/keyboards/duck/octagon/v1/matrix.c | |||
@@ -0,0 +1,230 @@ | |||
1 | /* | ||
2 | Copyright 2017 MechMerlin <[email protected]> | ||
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 <util/delay.h> | ||
18 | #include <avr/io.h> | ||
19 | #include <stdio.h> | ||
20 | #include "matrix.h" | ||
21 | #include "util.h" | ||
22 | #include "print.h" | ||
23 | #include "debug.h" | ||
24 | |||
25 | static uint8_t debouncing = DEBOUNCE; | ||
26 | |||
27 | /* matrix state(1:on, 0:off) */ | ||
28 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
29 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
30 | |||
31 | static uint8_t read_rows(uint8_t col); | ||
32 | static void init_rows(void); | ||
33 | static void unselect_cols(void); | ||
34 | static void select_col(uint8_t col); | ||
35 | |||
36 | |||
37 | __attribute__ ((weak)) | ||
38 | void matrix_init_kb(void) { | ||
39 | matrix_init_user(); | ||
40 | } | ||
41 | |||
42 | __attribute__ ((weak)) | ||
43 | void matrix_scan_kb(void) { | ||
44 | matrix_scan_user(); | ||
45 | } | ||
46 | |||
47 | __attribute__ ((weak)) | ||
48 | void matrix_init_user(void) { | ||
49 | } | ||
50 | |||
51 | __attribute__ ((weak)) | ||
52 | void matrix_scan_user(void) { | ||
53 | } | ||
54 | |||
55 | void backlight_init_ports(void) | ||
56 | { | ||
57 | DDRB |= 0b00011111; // PB0 (caps), PB1 (alpha), PB2 (extra), PB3 (modnum), PB4 (caps) | ||
58 | DDRD |= 0b11010000; // PD4, (rgb blue), PD6 (rgb red), PD7 (rgb green) | ||
59 | DDRE |= 0b01000000; // PE6 (frow) | ||
60 | } | ||
61 | |||
62 | void matrix_init(void) { | ||
63 | backlight_init_ports(); | ||
64 | unselect_cols(); | ||
65 | init_rows(); | ||
66 | |||
67 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | ||
68 | matrix[i] = 0; | ||
69 | matrix_debouncing[i] = 0; | ||
70 | } | ||
71 | |||
72 | matrix_init_quantum(); | ||
73 | } | ||
74 | |||
75 | uint8_t matrix_scan(void) { | ||
76 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { | ||
77 | select_col(col); | ||
78 | _delay_us(3); | ||
79 | |||
80 | uint8_t rows = read_rows(col); | ||
81 | |||
82 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
83 | bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col); | ||
84 | bool curr_bit = rows & (1<<row); | ||
85 | if (prev_bit != curr_bit) { | ||
86 | matrix_debouncing[row] ^= ((matrix_row_t)1<<col); | ||
87 | if (debouncing) { | ||
88 | dprint("bounce!: "); dprintf("%02X", debouncing); dprintln(); | ||
89 | } | ||
90 | debouncing = DEBOUNCE; | ||
91 | } | ||
92 | } | ||
93 | unselect_cols(); | ||
94 | } | ||
95 | |||
96 | if (debouncing) { | ||
97 | if (--debouncing) { | ||
98 | _delay_ms(1); | ||
99 | } else { | ||
100 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
101 | matrix[i] = matrix_debouncing[i]; | ||
102 | } | ||
103 | } | ||
104 | } | ||
105 | |||
106 | matrix_scan_quantum(); | ||
107 | return 1; | ||
108 | } | ||
109 | |||
110 | inline matrix_row_t matrix_get_row(uint8_t row) { | ||
111 | return matrix[row]; | ||
112 | } | ||
113 | |||
114 | void matrix_print(void) { | ||
115 | print("\nr/c 0123456789ABCDEF\n"); | ||
116 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
117 | xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row))); | ||
118 | } | ||
119 | } | ||
120 | |||
121 | /* Row pin configuration | ||
122 | * row: 0 1 2 3 4 5 | ||
123 | * pin: PB7 PD0 PD1 PD2 PD3 PD5 | ||
124 | * | ||
125 | * Esc uses its own pin PE2 | ||
126 | */ | ||
127 | static void init_rows(void) { | ||
128 | DDRD &= ~0b00101111; // PD0, PD1, PD2, PD3, PD5 input | ||
129 | PORTD &= ~0b00101111; // PD0, PD1, PD2, PD3, PD5 low | ||
130 | |||
131 | DDRB &= ~0b10000000; // PB7 input | ||
132 | PORTB &= ~0b10000000; // PB7 low | ||
133 | |||
134 | DDRE &= ~0b00000100; // PE2 input | ||
135 | PORTE |= 0b00000100; // PE2 high | ||
136 | } | ||
137 | |||
138 | static uint8_t read_rows(uint8_t col) { | ||
139 | if (col == 14) { | ||
140 | return PINE&(1<<2) ? 0 : (1<<0); // PE2 (Row 0) | ||
141 | } else { | ||
142 | return (PIND&(1<<0) ? (1<<0) : 0) | // PD0 (Row 0) | ||
143 | (PIND&(1<<1) ? (1<<1) : 0) | // PD1 (Row 1) | ||
144 | (PIND&(1<<2) ? (1<<2) : 0) | // PD2 (Row 2) | ||
145 | (PIND&(1<<3) ? (1<<3) : 0) | // PD3 (Row 3) | ||
146 | (PIND&(1<<5) ? (1<<4) : 0) | // PD5 (Row 4) | ||
147 | (PINB&(1<<7) ? (1<<5) : 0); // PB7 (Row 5) | ||
148 | } | ||
149 | } | ||
150 | |||
151 | uint8_t read_fwkey(void) | ||
152 | { | ||
153 | return PINE&(1<<2) ? 0 : (1<<0); | ||
154 | } | ||
155 | |||
156 | static void unselect_cols(void) { | ||
157 | DDRB |= 0b01000000; // PB6 (U2) output | ||
158 | PORTB &= ~0b01000000; // PB6 (U2) low | ||
159 | |||
160 | DDRC |= 0b11000000; // PC6 (U1), PC7 (A2) output | ||
161 | PORTC &= ~0b11000000; // PC6 (U1), PC7 (A2) low | ||
162 | |||
163 | DDRF |= 0b00000011; // PF0 (A0), PF1 (A1) output | ||
164 | PORTF &= ~0b00000011; // PF0 (A0), PF1 (A1) low | ||
165 | } | ||
166 | |||
167 | static void select_col(uint8_t col) { | ||
168 | |||
169 | switch (col) { | ||
170 | case 0: | ||
171 | PORTC |= 0b01000000; // PC6 high | ||
172 | break; | ||
173 | case 1: | ||
174 | PORTC |= 0b01000000; // PC6 high | ||
175 | PORTF |= 0b00000001; // PF0 high | ||
176 | break; | ||
177 | case 2: | ||
178 | PORTC |= 0b01000000; // PC6 high | ||
179 | PORTF |= 0b00000010; // PF1 high | ||
180 | break; | ||
181 | case 3: | ||
182 | PORTC |= 0b01000000; // PC6 high | ||
183 | PORTF |= 0b00000011; // PF0, PF1 high | ||
184 | break; | ||
185 | case 4: | ||
186 | PORTC |= 0b11000000; // PC6, PC7 high | ||
187 | break; | ||
188 | case 5: | ||
189 | PORTC |= 0b11000000; // PC6, PC7 high | ||
190 | PORTF |= 0b00000001; // PF0 high | ||
191 | break; | ||
192 | case 6: | ||
193 | PORTC |= 0b11000000; // PC6, PC7 high | ||
194 | PORTF |= 0b00000010; // PF1 high | ||
195 | break; | ||
196 | case 7: | ||
197 | PORTC |= 0b11000000; // PC6, PC7 high | ||
198 | PORTF |= 0b00000011; // PF0, PF1 high | ||
199 | break; | ||
200 | case 8: | ||
201 | PORTB |= 0b01000000; // PB6 high | ||
202 | break; | ||
203 | case 9: | ||
204 | PORTB |= 0b01000000; // PB6 high | ||
205 | PORTF |= 0b00000001; // PF0 high | ||
206 | break; | ||
207 | case 10: | ||
208 | PORTB |= 0b01000000; // PB6 high | ||
209 | PORTF |= 0b00000010; // PF1 high | ||
210 | break; | ||
211 | case 11: | ||
212 | PORTB |= 0b01000000; // PB6 high | ||
213 | PORTF |= 0b00000011; // PF0, PF1 high | ||
214 | break; | ||
215 | case 12: | ||
216 | PORTB |= 0b01000000; // PB6 high | ||
217 | PORTC |= 0b10000000; // PC7 high | ||
218 | break; | ||
219 | case 13: | ||
220 | PORTB |= 0b01000000; // PB6 high | ||
221 | PORTF |= 0b00000001; // PF0 high | ||
222 | PORTC |= 0b10000000; // PC7 high | ||
223 | break; | ||
224 | case 15: | ||
225 | PORTB |= 0b01000000; // PB6 high | ||
226 | PORTF |= 0b00000010; // PF1 high | ||
227 | PORTC |= 0b10000000; // PC7 high | ||
228 | break; | ||
229 | } | ||
230 | } | ||
diff --git a/keyboards/duck/octagon/v1/readme.md b/keyboards/duck/octagon/v1/readme.md new file mode 100644 index 000000000..f614b3577 --- /dev/null +++ b/keyboards/duck/octagon/v1/readme.md | |||
@@ -0,0 +1,28 @@ | |||
1 | # Duck Octagon V1 | ||
2 | |||
3 | Non official firmware for custom Korean keyboard with 75% key layout made by Duck. | ||
4 | Group buy was run October 2014 via [geekhack](https://geekhack.org/index.php?topic=65036.0) 35 keyboards total. | ||
5 | |||
6 | Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin) | ||
7 | Hardware Supported: Duck Octagon PCB Ver 1.0, Atmega32u4 | ||
8 | Hardware Availability: Wait until GB of the next revision | ||
9 | |||
10 | Make example for this keyboard (after setting up your build environment): | ||
11 | |||
12 | make duck/octagon/v1:default | ||
13 | |||
14 | See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. | ||
15 | |||
16 | ## Hardware Notes | ||
17 | |||
18 | The Duck Octagon V1 PCB consists of: | ||
19 | |||
20 | ### Microchips | ||
21 | 2 74HC237D 3-to-8 line decoders | ||
22 | 1 Atmega32u4 microcontroller | ||
23 | 2 WS2811 LED controller | ||
24 | |||
25 | ## Notes | ||
26 | Thanks to Ralf Schmitt for previous implementations in his [TMK fork](https://github.com/xauser/tmk_keyboard/tree/xauser/) and few helping words. | ||
27 | |||
28 | Based heavily on Rasmus Schults [Duck Lightsaver QMK Port](https://github.com/qmk/qmk_firmware/tree/master/keyboards/lightsaver) | ||
diff --git a/keyboards/duck/octagon/v1/rules.mk b/keyboards/duck/octagon/v1/rules.mk new file mode 100644 index 000000000..84dd4e31d --- /dev/null +++ b/keyboards/duck/octagon/v1/rules.mk | |||
@@ -0,0 +1,24 @@ | |||
1 | # MCU name | ||
2 | MCU = atmega32u4 | ||
3 | |||
4 | # Bootloader selection | ||
5 | BOOTLOADER = atmel-dfu | ||
6 | |||
7 | # Build Options | ||
8 | # change yes to no to disable | ||
9 | # | ||
10 | BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite | ||
11 | MOUSEKEY_ENABLE = no # Mouse keys | ||
12 | EXTRAKEY_ENABLE = no # Audio control and System control | ||
13 | CONSOLE_ENABLE = no # Console for debug | ||
14 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
15 | NKRO_ENABLE = yes # Enable N-Key Rollover | ||
16 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | ||
17 | BACKLIGHT_DRIVER = custom | ||
18 | AUDIO_ENABLE = no # Audio output | ||
19 | RGBLIGHT_ENABLE = yes | ||
20 | |||
21 | CUSTOM_MATRIX = yes | ||
22 | SRC += matrix.c \ | ||
23 | |||
24 | LAYOUTS = 75_ansi | ||
diff --git a/keyboards/duck/octagon/v1/v1.c b/keyboards/duck/octagon/v1/v1.c new file mode 100644 index 000000000..e9e88c70d --- /dev/null +++ b/keyboards/duck/octagon/v1/v1.c | |||
@@ -0,0 +1,46 @@ | |||
1 | /* Copyright 2017 MechMerlin <[email protected]> | ||
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 "v1.h" | ||
17 | |||
18 | enum BACKLIGHT_AREAS { | ||
19 | BACKLIGHT_ALPHA = 0b0000001, | ||
20 | BACKLIGHT_EXTRA = 0b0000010, | ||
21 | BACKLIGHT_MODNUM = 0b0000100, | ||
22 | BACKLIGHT_FROW = 0b0001000, | ||
23 | BACKLIGHT_RGB = 0b0010000, | ||
24 | BACKLIGHT_RGBRED = 0b0010000, | ||
25 | BACKLIGHT_RGBGREEN = 0b0100000, | ||
26 | BACKLIGHT_RGBBLUE = 0b1000000, | ||
27 | BACKLIGHT_SWITCH = 0b0001111 | ||
28 | }; | ||
29 | |||
30 | uint8_t backlight_os_state = 0; | ||
31 | uint32_t backlight_layer_state = 0; | ||
32 | |||
33 | void backlight_set(uint8_t level) { | ||
34 | level & BACKLIGHT_ALPHA ? (PORTB |= 0b00000010) : (PORTB &= ~0b00000010); | ||
35 | level & BACKLIGHT_EXTRA ? (PORTB |= 0b00000100) : (PORTB &= ~0b00000100); | ||
36 | level & BACKLIGHT_MODNUM ? (PORTB |= 0b00001000) : (PORTB &= ~0b00001000); | ||
37 | level & BACKLIGHT_FROW ? (PORTE |= 0b01000000) : (PORTE &= ~0b01000000); | ||
38 | level & BACKLIGHT_RGBRED ? (PORTD |= 0b01000000) : (PORTD &= ~0b01000000); | ||
39 | level & BACKLIGHT_RGBGREEN ? (PORTD |= 0b10000000) : (PORTD &= ~0b10000000); | ||
40 | level & BACKLIGHT_RGBBLUE ? (PORTD |= 0b00010000) : (PORTD &= ~0b00010000); | ||
41 | } | ||
42 | |||
43 | void led_set_kb(uint8_t usb_led) { | ||
44 | backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001); | ||
45 | backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000); | ||
46 | } | ||
diff --git a/keyboards/duck/octagon/v1/v1.h b/keyboards/duck/octagon/v1/v1.h new file mode 100644 index 000000000..9f3d1e369 --- /dev/null +++ b/keyboards/duck/octagon/v1/v1.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* Copyright 2017 MechMerlin <[email protected]> | ||
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 | #pragma once | ||
17 | |||
18 | #include "quantum.h" | ||
19 | |||
20 | #define LAYOUT_75_ansi( \ | ||
21 | K5A, K5B, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, \ | ||
22 | K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4P, \ | ||
23 | K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, \ | ||
24 | K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2N, K2P, \ | ||
25 | K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, K1P, \ | ||
26 | K0A, K0B, K0C, K0G, K0J, K0K, K0L, K0M, K0N, K0P \ | ||
27 | ) { \ | ||
28 | { K5A, K5B, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P }, \ | ||
29 | { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, KC_NO, K4P }, \ | ||
30 | { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, KC_NO, K3P }, \ | ||
31 | { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, KC_NO, K2N, KC_NO, K2P }, \ | ||
32 | { K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, KC_NO, K1M, K1N, KC_NO, K1P }, \ | ||
33 | { K0A, K0B, K0C, KC_NO, KC_NO, K0G, KC_NO, KC_NO, K0J, K0K, K0L, KC_NO, K0M, K0N, KC_NO, K0P } \ | ||
34 | } | ||
diff --git a/keyboards/duck/octagon/v2/config.h b/keyboards/duck/octagon/v2/config.h new file mode 100644 index 000000000..0de966c60 --- /dev/null +++ b/keyboards/duck/octagon/v2/config.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | Copyright 2017 MechMerlin <[email protected]> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #pragma once | ||
19 | |||
20 | #include "config_common.h" | ||
21 | |||
22 | /* USB Device descriptor parameter */ | ||
23 | #define VENDOR_ID 0x444B // Duck ("DK") | ||
24 | #define PRODUCT_ID 0x4F32 // Octagon V2 ("O2") | ||
25 | #define DEVICE_VER 0x0002 | ||
26 | #define MANUFACTURER Duck | ||
27 | #define PRODUCT Octagon V2 | ||
28 | |||
29 | /* key matrix size */ | ||
30 | #define MATRIX_ROWS 6 | ||
31 | #define MATRIX_COLS 17 | ||
32 | |||
33 | #define DIODE_DIRECTION COL2ROW | ||
34 | |||
35 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
36 | #define DEBOUNCE 5 | ||
37 | |||
38 | /* number of backlight levels */ | ||
39 | #define BACKLIGHT_LEVELS 1 | ||
40 | |||
41 | #define RGBLIGHT_ANIMATIONS | ||
42 | #define RGB_DI_PIN D6 | ||
43 | #define RGBLED_NUM 17 | ||
44 | |||
45 | /* Set to top left most key */ | ||
46 | #define BOOTMAGIC_LITE_ROW 5 | ||
47 | #define BOOTMAGIC_LITE_COLUMN 10 | ||
48 | |||
49 | #define TAPPING_TERM 200 | ||
diff --git a/keyboards/duck/octagon/v2/indicator_leds.c b/keyboards/duck/octagon/v2/indicator_leds.c new file mode 100644 index 000000000..116306fb7 --- /dev/null +++ b/keyboards/duck/octagon/v2/indicator_leds.c | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | Copyright 2017 MechMerlin <[email protected]> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | #include <avr/interrupt.h> | ||
18 | #include <avr/io.h> | ||
19 | #include <stdbool.h> | ||
20 | #include <util/delay.h> | ||
21 | #include "indicator_leds.h" | ||
22 | |||
23 | #define LED_T1H 900 | ||
24 | #define LED_T1L 600 | ||
25 | #define LED_T0H 400 | ||
26 | #define LED_T0L 900 | ||
27 | |||
28 | void send_bit_d4(bool bitVal) { | ||
29 | if(bitVal) { | ||
30 | asm volatile ( | ||
31 | "sbi %[port], %[bit] \n\t" | ||
32 | ".rept %[onCycles] \n\t" | ||
33 | "nop \n\t" | ||
34 | ".endr \n\t" | ||
35 | "cbi %[port], %[bit] \n\t" | ||
36 | ".rept %[offCycles] \n\t" | ||
37 | "nop \n\t" | ||
38 | ".endr \n\t" | ||
39 | :: | ||
40 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
41 | [bit] "I" (4), | ||
42 | [onCycles] "I" (NS_TO_CYCLES(LED_T1H) - 2), | ||
43 | [offCycles] "I" (NS_TO_CYCLES(LED_T1L) - 2)); | ||
44 | } else { | ||
45 | asm volatile ( | ||
46 | "sbi %[port], %[bit] \n\t" | ||
47 | ".rept %[onCycles] \n\t" | ||
48 | "nop \n\t" | ||
49 | ".endr \n\t" | ||
50 | "cbi %[port], %[bit] \n\t" | ||
51 | ".rept %[offCycles] \n\t" | ||
52 | "nop \n\t" | ||
53 | ".endr \n\t" | ||
54 | :: | ||
55 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
56 | [bit] "I" (4), | ||
57 | [onCycles] "I" (NS_TO_CYCLES(LED_T0H) - 2), | ||
58 | [offCycles] "I" (NS_TO_CYCLES(LED_T0L) - 2)); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | void send_bit_d6(bool bitVal) | ||
63 | { | ||
64 | if(bitVal) { | ||
65 | asm volatile ( | ||
66 | "sbi %[port], %[bit] \n\t" | ||
67 | ".rept %[onCycles] \n\t" | ||
68 | "nop \n\t" | ||
69 | ".endr \n\t" | ||
70 | "cbi %[port], %[bit] \n\t" | ||
71 | ".rept %[offCycles] \n\t" | ||
72 | "nop \n\t" | ||
73 | ".endr \n\t" | ||
74 | :: | ||
75 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
76 | [bit] "I" (6), | ||
77 | [onCycles] "I" (NS_TO_CYCLES(LED_T1H) - 2), | ||
78 | [offCycles] "I" (NS_TO_CYCLES(LED_T1L) - 2)); | ||
79 | } else { | ||
80 | asm volatile ( | ||
81 | "sbi %[port], %[bit] \n\t" | ||
82 | ".rept %[onCycles] \n\t" | ||
83 | "nop \n\t" | ||
84 | ".endr \n\t" | ||
85 | "cbi %[port], %[bit] \n\t" | ||
86 | ".rept %[offCycles] \n\t" | ||
87 | "nop \n\t" | ||
88 | ".endr \n\t" | ||
89 | :: | ||
90 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
91 | [bit] "I" (6), | ||
92 | [onCycles] "I" (NS_TO_CYCLES(LED_T0H) - 2), | ||
93 | [offCycles] "I" (NS_TO_CYCLES(LED_T0L) - 2)); | ||
94 | } | ||
95 | } | ||
96 | |||
97 | void send_value(uint8_t byte, enum Device device) { | ||
98 | for(uint8_t b = 0; b < 8; b++) { | ||
99 | if(device == Device_STATUSLED) { | ||
100 | send_bit_d4(byte & 0b10000000); | ||
101 | } | ||
102 | if(device == Device_PCBRGB) { | ||
103 | send_bit_d6(byte & 0b10000000); | ||
104 | } | ||
105 | byte <<= 1; | ||
106 | } | ||
107 | } | ||
108 | |||
109 | void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device) { | ||
110 | send_value(r, device); | ||
111 | send_value(g, device); | ||
112 | send_value(b, device); | ||
113 | } | ||
114 | |||
115 | // Port from backlight_set_state | ||
116 | void indicator_leds_set(bool leds[8]) { | ||
117 | cli(); | ||
118 | send_color(leds[1] ? 255 : 0, leds[2] ? 255 : 0, leds[0] ? 255 : 0, Device_STATUSLED); | ||
119 | send_color(leds[4] ? 255 : 0, leds[3] ? 255 : 0, leds[5] ? 255 : 0, Device_STATUSLED); | ||
120 | leds[6] ? (PORTD &= ~0b10000000) : (PORTD |= 0b10000000); | ||
121 | sei(); | ||
122 | show(); | ||
123 | } | ||
diff --git a/keyboards/duck/octagon/v2/indicator_leds.h b/keyboards/duck/octagon/v2/indicator_leds.h new file mode 100644 index 000000000..ad3ec54f5 --- /dev/null +++ b/keyboards/duck/octagon/v2/indicator_leds.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #include "duck_led/duck_led.h" | ||
2 | |||
3 | void indicator_leds_set(bool leds[8]); | ||
4 | void backlight_toggle_rgb(bool enabled); | ||
5 | void backlight_set_rgb(uint8_t cfg[17][3]); | ||
6 | void backlight_init_ports(void); | ||
7 | void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device); | ||
diff --git a/keyboards/duck/octagon/v2/info.json b/keyboards/duck/octagon/v2/info.json new file mode 100644 index 000000000..23911f340 --- /dev/null +++ b/keyboards/duck/octagon/v2/info.json | |||
@@ -0,0 +1,14 @@ | |||
1 | { | ||
2 | "keyboard_name": "Octagon V2", | ||
3 | "url": "", | ||
4 | "maintainer": "qmk", | ||
5 | "layouts": { | ||
6 | "LAYOUT": { | ||
7 | "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":1, "y":0}, {"label":"F2", "x":2, "y":0}, {"label":"F3", "x":3, "y":0}, {"label":"F4", "x":4, "y":0}, {"label":"F5", "x":5, "y":0}, {"label":"F6", "x":6, "y":0}, {"label":"F7", "x":7, "y":0}, {"label":"F8", "x":8, "y":0}, {"label":"F9", "x":9, "y":0}, {"label":"F10", "x":10, "y":0}, {"label":"F11", "x":11, "y":0}, {"label":"F12", "x":12, "y":0}, {"label":"PrtSc", "x":13, "y":0}, {"label":"Pause", "x":14, "y":0}, {"label":"Delete", "x":15, "y":0}, {"label":"~", "x":0, "y":1}, {"label":"!", "x":1, "y":1}, {"label":"@", "x":2, "y":1}, {"label":"#", "x":3, "y":1}, {"label":"$", "x":4, "y":1}, {"label":"%", "x":5, "y":1}, {"label":"^", "x":6, "y":1}, {"label":"&", "x":7, "y":1}, {"label":"*", "x":8, "y":1}, {"label":"(", "x":9, "y":1}, {"label":")", "x":10, "y":1}, {"label":"_", "x":11, "y":1}, {"label":"+", "x":12, "y":1}, {"label":"Backspace", "x":13, "y":1, "w":2}, {"label":"Home", "x":15, "y":1}, {"label":"Tab", "x":0, "y":2, "w":1.5}, {"label":"Q", "x":1.5, "y":2}, {"label":"W", "x":2.5, "y":2}, {"label":"E", "x":3.5, "y":2}, {"label":"R", "x":4.5, "y":2}, {"label":"T", "x":5.5, "y":2}, {"label":"Y", "x":6.5, "y":2}, {"label":"U", "x":7.5, "y":2}, {"label":"I", "x":8.5, "y":2}, {"label":"O", "x":9.5, "y":2}, {"label":"P", "x":10.5, "y":2}, {"label":"{", "x":11.5, "y":2}, {"label":"}", "x":12.5, "y":2}, {"label":"|", "x":13.5, "y":2, "w":1.5}, {"label":"Page Up", "x":15, "y":2}, {"label":"Caps Lock", "x":0, "y":3, "w":1.75}, {"label":"A", "x":1.75, "y":3}, {"label":"S", "x":2.75, "y":3}, {"label":"D", "x":3.75, "y":3}, {"label":"F", "x":4.75, "y":3}, {"label":"G", "x":5.75, "y":3}, {"label":"H", "x":6.75, "y":3}, {"label":"J", "x":7.75, "y":3}, {"label":"K", "x":8.75, "y":3}, {"label":"L", "x":9.75, "y":3}, {"label":":", "x":10.75, "y":3}, {"label":"\"", "x":11.75, "y":3}, {"x":12.75, "y":3}, {"label":"Enter", "x":13.75, "y":3, "w":1.25}, {"label":"Page Down", "x":15, "y":3}, {"label":"Shift", "x":0, "y":4, "w":1.25}, {"x":1.25, "y":4}, {"label":"Z", "x":2.25, "y":4}, {"label":"X", "x":3.25, "y":4}, {"label":"C", "x":4.25, "y":4}, {"label":"V", "x":5.25, "y":4}, {"label":"B", "x":6.25, "y":4}, {"label":"N", "x":7.25, "y":4}, {"label":"M", "x":8.25, "y":4}, {"label":"<", "x":9.25, "y":4}, {"label":">", "x":10.25, "y":4}, {"label":"?", "x":11.25, "y":4}, {"label":"Shift", "x":12.25, "y":4, "w":1.75}, {"label":"\u2191", "x":14, "y":4}, {"label":"End", "x":15, "y":4}, {"label":"Ctrl", "x":0, "y":5, "w":1.25}, {"label":"Win", "x":1.25, "y":5, "w":1.25}, {"label":"Alt", "x":2.5, "y":5, "w":1.25}, {"x":3.75, "y":5, "w":6.25}, {"label":"Alt", "x":10, "y":5}, {"label":"Fn", "x":11, "y":5}, {"label":"Ctrl", "x":12, "y":5}, {"label":"\u2190", "x":13, "y":5}, {"label":"\u2193", "x":14, "y":5}, {"label":"\u2192", "x":15, "y":5}] | ||
8 | }, | ||
9 | |||
10 | "LAYOUT_75_ansi": { | ||
11 | "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":15, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":6, "y":1}, {"x":7, "y":1}, {"x":8, "y":1}, {"x":9, "y":1}, {"x":10, "y":1}, {"x":11, "y":1}, {"x":12, "y":1}, {"x":13, "y":1, "w":2}, {"x":15, "y":1}, {"x":0, "y":2, "w":1.5}, {"x":1.5, "y":2}, {"x":2.5, "y":2}, {"x":3.5, "y":2}, {"x":4.5, "y":2}, {"x":5.5, "y":2}, {"x":6.5, "y":2}, {"x":7.5, "y":2}, {"x":8.5, "y":2}, {"x":9.5, "y":2}, {"x":10.5, "y":2}, {"x":11.5, "y":2}, {"x":12.5, "y":2}, {"x":13.5, "y":2, "w":1.5}, {"x":15, "y":2}, {"x":0, "y":3, "w":1.75}, {"x":1.75, "y":3}, {"x":2.75, "y":3}, {"x":3.75, "y":3}, {"x":4.75, "y":3}, {"x":5.75, "y":3}, {"x":6.75, "y":3}, {"x":7.75, "y":3}, {"x":8.75, "y":3}, {"x":9.75, "y":3}, {"x":10.75, "y":3}, {"x":11.75, "y":3}, {"x":12.75, "y":3, "w":2.25}, {"x":15, "y":3}, {"x":0, "y":4, "w":2.25}, {"x":2.25, "y":4}, {"x":3.25, "y":4}, {"x":4.25, "y":4}, {"x":5.25, "y":4}, {"x":6.25, "y":4}, {"x":7.25, "y":4}, {"x":8.25, "y":4}, {"x":9.25, "y":4}, {"x":10.25, "y":4}, {"x":11.25, "y":4}, {"x":12.25, "y":4, "w":1.75}, {"x":14, "y":4}, {"x":15, "y":4}, {"x":0, "y":5, "w":1.25}, {"x":1.25, "y":5, "w":1.25}, {"x":2.5, "y":5, "w":1.25}, {"x":3.75, "y":5, "w":6.25}, {"x":10, "y":5}, {"x":11, "y":5}, {"x":12, "y":5}, {"x":13, "y":5}, {"x":14, "y":5}, {"x":15, "y":5}] | ||
12 | } | ||
13 | } | ||
14 | } | ||
diff --git a/keyboards/duck/octagon/v2/matrix.c b/keyboards/duck/octagon/v2/matrix.c new file mode 100644 index 000000000..25d1e45b0 --- /dev/null +++ b/keyboards/duck/octagon/v2/matrix.c | |||
@@ -0,0 +1,261 @@ | |||
1 | /* | ||
2 | Copyright 2017 MechMerlin <[email protected]> | ||
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 <util/delay.h> | ||
18 | #include <avr/io.h> | ||
19 | #include <stdio.h> | ||
20 | #include "matrix.h" | ||
21 | #include "util.h" | ||
22 | #include "print.h" | ||
23 | #include "debug.h" | ||
24 | |||
25 | static uint8_t debouncing = DEBOUNCE; | ||
26 | |||
27 | /* matrix state(1:on, 0:off) */ | ||
28 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
29 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
30 | |||
31 | static uint8_t read_rows(uint8_t col); | ||
32 | static void init_rows(void); | ||
33 | static void unselect_cols(void); | ||
34 | static void select_col(uint8_t col); | ||
35 | |||
36 | |||
37 | __attribute__ ((weak)) | ||
38 | void matrix_init_kb(void) { | ||
39 | matrix_init_user(); | ||
40 | } | ||
41 | |||
42 | __attribute__ ((weak)) | ||
43 | void matrix_scan_kb(void) { | ||
44 | matrix_scan_user(); | ||
45 | } | ||
46 | |||
47 | __attribute__ ((weak)) | ||
48 | void matrix_init_user(void) { | ||
49 | } | ||
50 | |||
51 | __attribute__ ((weak)) | ||
52 | void matrix_scan_user(void) { | ||
53 | } | ||
54 | |||
55 | void backlight_init_ports(void) | ||
56 | { | ||
57 | DDRD |= 0b11010000; | ||
58 | PORTD &= ~0b01010000; | ||
59 | PORTD |= 0b10000000; | ||
60 | DDRB |= 0b00011111; | ||
61 | PORTB &= ~0b00001110; | ||
62 | PORTB |= 0b00010001; | ||
63 | DDRE |= 0b01000000; | ||
64 | PORTE &= ~0b01000000; | ||
65 | } | ||
66 | |||
67 | void matrix_init(void) { | ||
68 | backlight_init_ports(); | ||
69 | unselect_cols(); | ||
70 | init_rows(); | ||
71 | |||
72 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | ||
73 | matrix[i] = 0; | ||
74 | matrix_debouncing[i] = 0; | ||
75 | } | ||
76 | |||
77 | matrix_init_quantum(); | ||
78 | } | ||
79 | |||
80 | uint8_t matrix_scan(void) { | ||
81 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { | ||
82 | select_col(col); | ||
83 | _delay_us(3); | ||
84 | |||
85 | uint8_t rows = read_rows(col); | ||
86 | |||
87 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
88 | bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col); | ||
89 | bool curr_bit = rows & (1<<row); | ||
90 | if (prev_bit != curr_bit) { | ||
91 | matrix_debouncing[row] ^= ((matrix_row_t)1<<col); | ||
92 | if (debouncing) { | ||
93 | dprint("bounce!: "); dprintf("%02X", debouncing); dprintln(); | ||
94 | } | ||
95 | debouncing = DEBOUNCE; | ||
96 | } | ||
97 | } | ||
98 | unselect_cols(); | ||
99 | } | ||
100 | |||
101 | if (debouncing) { | ||
102 | if (--debouncing) { | ||
103 | _delay_ms(1); | ||
104 | } else { | ||
105 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
106 | matrix[i] = matrix_debouncing[i]; | ||
107 | } | ||
108 | } | ||
109 | } | ||
110 | |||
111 | matrix_scan_quantum(); | ||
112 | return 1; | ||
113 | } | ||
114 | |||
115 | inline matrix_row_t matrix_get_row(uint8_t row) { | ||
116 | return matrix[row]; | ||
117 | } | ||
118 | |||
119 | void matrix_print(void) { | ||
120 | print("\nr/c 0123456789ABCDEF\n"); | ||
121 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
122 | xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row))); | ||
123 | } | ||
124 | } | ||
125 | |||
126 | /* Row pin configuration | ||
127 | * row: 0 1 2 3 4 5 | ||
128 | * pin: PB7 PD0 PD1 PD2 PD3 PD5 | ||
129 | * | ||
130 | * Esc uses its own pin PE2 | ||
131 | */ | ||
132 | static void init_rows(void) { | ||
133 | DDRD &= ~0b00101111; | ||
134 | PORTD &= ~0b00101111; | ||
135 | |||
136 | DDRB &= ~0b10000000; | ||
137 | PORTB &= ~0b10000000; | ||
138 | |||
139 | DDRE &= ~0b00000100; | ||
140 | PORTE |= 0b00000100; | ||
141 | } | ||
142 | |||
143 | static uint8_t read_rows(uint8_t col) { | ||
144 | if (col == 16) { | ||
145 | return PINE&(1<<2) ? 0 : (1<<0); | ||
146 | } else { | ||
147 | return (PIND&(1<<0) ? (1<<0) : 0) | | ||
148 | (PIND&(1<<1) ? (1<<1) : 0) | | ||
149 | (PIND&(1<<2) ? (1<<2) : 0) | | ||
150 | (PIND&(1<<3) ? (1<<3) : 0) | | ||
151 | (PIND&(1<<5) ? (1<<4) : 0) | | ||
152 | (PINB&(1<<7) ? (1<<5) : 0); | ||
153 | } | ||
154 | } | ||
155 | |||
156 | uint8_t read_fwkey(void) | ||
157 | { | ||
158 | return PINE&(1<<2) ? 0 : (1<<0); | ||
159 | } | ||
160 | |||
161 | /* Columns 0 - 15 | ||
162 | * These columns uses two 74HC237D 3 to 8 bit demultiplexers. | ||
163 | * col / pin: PC6 PB6 PF0 PF1 PC7 | ||
164 | * 0: 1 0 0 0 0 | ||
165 | * 1: 1 0 1 0 0 | ||
166 | * 2: 1 0 0 1 0 | ||
167 | * 3: 1 0 1 1 0 | ||
168 | * 4: 1 0 0 0 1 | ||
169 | * 5: 1 0 1 0 1 | ||
170 | * 6: 1 0 0 1 1 | ||
171 | * 7: 1 0 1 1 1 | ||
172 | * 8: 0 1 0 0 0 | ||
173 | * 9: 0 1 1 0 0 | ||
174 | * 10: 0 1 0 1 0 | ||
175 | * 11: 0 1 1 1 0 | ||
176 | * 12: 0 1 0 0 1 | ||
177 | * 13: 0 1 1 0 1 | ||
178 | * 14: 0 1 0 1 1 | ||
179 | * 15: 0 1 1 1 1 | ||
180 | * | ||
181 | */ | ||
182 | static void unselect_cols(void) { | ||
183 | DDRB |= 0b01000000; | ||
184 | PORTB &= ~0b01000000; | ||
185 | |||
186 | DDRC |= 0b11000000; | ||
187 | PORTC &= ~0b11000000; | ||
188 | |||
189 | DDRF |= 0b00000011; | ||
190 | PORTF &= ~0b00000011; | ||
191 | } | ||
192 | |||
193 | static void select_col(uint8_t col) { | ||
194 | |||
195 | switch (col) { | ||
196 | case 0: | ||
197 | PORTC |= 0b01000000; | ||
198 | break; | ||
199 | case 1: | ||
200 | PORTC |= 0b01000000; | ||
201 | PORTF |= 0b00000001; | ||
202 | break; | ||
203 | case 2: | ||
204 | PORTC |= 0b01000000; | ||
205 | PORTF |= 0b00000010; | ||
206 | break; | ||
207 | case 3: | ||
208 | PORTC |= 0b01000000; | ||
209 | PORTF |= 0b00000011; | ||
210 | break; | ||
211 | case 4: | ||
212 | PORTC |= 0b11000000; | ||
213 | break; | ||
214 | case 5: | ||
215 | PORTC |= 0b11000000; | ||
216 | PORTF |= 0b00000001; | ||
217 | break; | ||
218 | case 6: | ||
219 | PORTC |= 0b11000000; | ||
220 | PORTF |= 0b00000010; | ||
221 | break; | ||
222 | case 7: | ||
223 | PORTC |= 0b11000000; | ||
224 | PORTF |= 0b00000011; | ||
225 | break; | ||
226 | case 8: | ||
227 | PORTB |= 0b01000000; | ||
228 | break; | ||
229 | case 9: | ||
230 | PORTB |= 0b01000000; | ||
231 | PORTF |= 0b00000001; | ||
232 | break; | ||
233 | case 10: | ||
234 | PORTB |= 0b01000000; | ||
235 | PORTF |= 0b00000010; | ||
236 | break; | ||
237 | case 11: | ||
238 | PORTB |= 0b01000000; | ||
239 | PORTF |= 0b00000011; | ||
240 | break; | ||
241 | case 12: | ||
242 | PORTB |= 0b01000000; | ||
243 | PORTC |= 0b10000000; | ||
244 | break; | ||
245 | case 13: | ||
246 | PORTB |= 0b01000000; | ||
247 | PORTF |= 0b00000001; | ||
248 | PORTC |= 0b10000000; | ||
249 | break; | ||
250 | case 14: | ||
251 | PORTB |= 0b01000000; | ||
252 | PORTF |= 0b00000010; | ||
253 | PORTC |= 0b10000000; | ||
254 | break; | ||
255 | case 15: | ||
256 | PORTB |= 0b01000000; | ||
257 | PORTF |= 0b00000011; | ||
258 | PORTC |= 0b10000000; | ||
259 | break; | ||
260 | } | ||
261 | } | ||
diff --git a/keyboards/duck/octagon/v2/readme.md b/keyboards/duck/octagon/v2/readme.md new file mode 100644 index 000000000..cc9474fc9 --- /dev/null +++ b/keyboards/duck/octagon/v2/readme.md | |||
@@ -0,0 +1,30 @@ | |||
1 | # Duck Octagon V2 | ||
2 | |||
3 | Non official firmware for custom Korean keyboard with 75% key layout made by Duck. | ||
4 | Group buy was run January 2016 via [geekhack](https://geekhack.org/index.php?topic=78549.0) with 2 rounds, 100 keyboards total. | ||
5 | |||
6 | Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin) | ||
7 | Hardware Supported: Duck Octagon PCB Ver 2.0, Atmega32u4 | ||
8 | Hardware Availability: Wait until GB of the next revision | ||
9 | |||
10 | Make example for this keyboard (after setting up your build environment): | ||
11 | |||
12 | make octagon/v2:default | ||
13 | |||
14 | **Reset Key:** To put the Octagon V2 into reset, hold the top right most key (`K5Q`) while plugging in. | ||
15 | |||
16 | See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. | ||
17 | |||
18 | ## Hardware Notes | ||
19 | |||
20 | The Duck Octagon V2 PCB consists of: | ||
21 | |||
22 | ### Microchips | ||
23 | 2 74HC237D 3-to-8 line decoders | ||
24 | 1 Atmega32u4 microcontroller | ||
25 | 2 WS2811 LED controller | ||
26 | |||
27 | ## Notes | ||
28 | Thanks to Ralf Schmitt for previous implementations in his [TMK fork](https://github.com/xauser/tmk_keyboard/tree/xauser/) and few helping words. | ||
29 | |||
30 | Based heavily on Rasmus Schults [Duck Lightsaver QMK Port](https://github.com/qmk/qmk_firmware/tree/master/keyboards/lightsaver) | ||
diff --git a/keyboards/duck/octagon/v2/rules.mk b/keyboards/duck/octagon/v2/rules.mk new file mode 100644 index 000000000..14b5de127 --- /dev/null +++ b/keyboards/duck/octagon/v2/rules.mk | |||
@@ -0,0 +1,25 @@ | |||
1 | # MCU name | ||
2 | MCU = atmega32u4 | ||
3 | |||
4 | # Bootloader selection | ||
5 | BOOTLOADER = atmel-dfu | ||
6 | |||
7 | # Build Options | ||
8 | # change yes to no to disable | ||
9 | # | ||
10 | BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite | ||
11 | MOUSEKEY_ENABLE = no # Mouse keys | ||
12 | EXTRAKEY_ENABLE = no # Audio control and System control | ||
13 | CONSOLE_ENABLE = no # Console for debug | ||
14 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
15 | NKRO_ENABLE = yes # Enable N-Key Rollover | ||
16 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | ||
17 | BACKLIGHT_DRIVER = custom | ||
18 | AUDIO_ENABLE = no # Audio output | ||
19 | RGBLIGHT_ENABLE = yes | ||
20 | |||
21 | CUSTOM_MATRIX = yes | ||
22 | SRC += indicator_leds.c \ | ||
23 | matrix.c duck_led/duck_led.c | ||
24 | |||
25 | LAYOUTS = 75_ansi | ||
diff --git a/keyboards/duck/octagon/v2/v2.c b/keyboards/duck/octagon/v2/v2.c new file mode 100644 index 000000000..23e92b276 --- /dev/null +++ b/keyboards/duck/octagon/v2/v2.c | |||
@@ -0,0 +1,113 @@ | |||
1 | /* Copyright 2017 MechMerlin <[email protected]> | ||
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 "v2.h" | ||
17 | #include "indicator_leds.h" | ||
18 | |||
19 | enum BACKLIGHT_AREAS { | ||
20 | BACKLIGHT_ALPHA = 0b0000001, | ||
21 | BACKLIGHT_EXTRA = 0b0000010, | ||
22 | BACKLIGHT_MODNUM = 0b0000100, | ||
23 | BACKLIGHT_FROW = 0b0001000, | ||
24 | BACKLIGHT_RGB = 0b0010000, | ||
25 | BACKLIGHT_SWITCH = 0b0001111 | ||
26 | }; | ||
27 | |||
28 | uint8_t backlight_rgb_r = 255; | ||
29 | uint8_t backlight_rgb_g = 0; | ||
30 | uint8_t backlight_rgb_b = 0; | ||
31 | uint8_t backlight_os_state = 0; | ||
32 | uint32_t backlight_layer_state = 0; | ||
33 | |||
34 | void backlight_toggle_rgb(bool enabled) | ||
35 | { | ||
36 | if(enabled) { | ||
37 | uint8_t rgb[17][3] = { | ||
38 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
39 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
40 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
41 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
42 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
43 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
44 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
45 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
46 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
47 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
48 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
49 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
50 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
51 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
52 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
53 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
54 | {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b} | ||
55 | }; | ||
56 | backlight_set_rgb(rgb); | ||
57 | } else { | ||
58 | uint8_t rgb[17][3] = { | ||
59 | {0, 0, 0}, | ||
60 | {0, 0, 0}, | ||
61 | {0, 0, 0}, | ||
62 | {0, 0, 0}, | ||
63 | {0, 0, 0}, | ||
64 | {0, 0, 0}, | ||
65 | {0, 0, 0}, | ||
66 | {0, 0, 0}, | ||
67 | {0, 0, 0}, | ||
68 | {0, 0, 0}, | ||
69 | {0, 0, 0}, | ||
70 | {0, 0, 0}, | ||
71 | {0, 0, 0}, | ||
72 | {0, 0, 0}, | ||
73 | {0, 0, 0}, | ||
74 | {0, 0, 0}, | ||
75 | {0, 0, 0} | ||
76 | }; | ||
77 | backlight_set_rgb(rgb); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | void backlight_set_rgb(uint8_t cfg[17][3]) | ||
82 | { | ||
83 | cli(); | ||
84 | for(uint8_t i = 0; i < 17; ++i) { | ||
85 | send_color(cfg[i][0], cfg[i][1], cfg[i][2], Device_PCBRGB); | ||
86 | } | ||
87 | sei(); | ||
88 | show(); | ||
89 | } | ||
90 | |||
91 | void backlight_set(uint8_t level) { | ||
92 | level & BACKLIGHT_ALPHA ? (PORTB |= 0b00000010) : (PORTB &= ~0b00000010); | ||
93 | level & BACKLIGHT_EXTRA ? (PORTB |= 0b00000100) : (PORTB &= ~0b00000100); | ||
94 | level & BACKLIGHT_MODNUM ? (PORTB |= 0b00001000) : (PORTB &= ~0b00001000); | ||
95 | level & BACKLIGHT_FROW ? (PORTE |= 0b01000000) : (PORTE &= ~0b01000000); | ||
96 | level & BACKLIGHT_RGB ? backlight_toggle_rgb(true) : backlight_toggle_rgb(false); | ||
97 | } | ||
98 | |||
99 | // Port from backlight_update_state | ||
100 | void led_set_kb(uint8_t usb_led) { | ||
101 | bool status[7] = { | ||
102 | backlight_os_state & (1<<USB_LED_CAPS_LOCK), | ||
103 | backlight_os_state & (1<<USB_LED_SCROLL_LOCK), | ||
104 | backlight_os_state & (1<<USB_LED_NUM_LOCK), | ||
105 | backlight_layer_state & (1<<1), | ||
106 | backlight_layer_state & (1<<2), | ||
107 | backlight_layer_state & (1<<3), | ||
108 | backlight_layer_state & (1<<4) | ||
109 | }; | ||
110 | indicator_leds_set(status); | ||
111 | backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001); | ||
112 | backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000); | ||
113 | } | ||
diff --git a/keyboards/duck/octagon/v2/v2.h b/keyboards/duck/octagon/v2/v2.h new file mode 100644 index 000000000..d60631009 --- /dev/null +++ b/keyboards/duck/octagon/v2/v2.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* Copyright 2017 MechMerlin <[email protected]> | ||
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 | #pragma once | ||
17 | |||
18 | #include "quantum.h" | ||
19 | |||
20 | #define LAYOUT( \ | ||
21 | K5A, K5B, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5Q, \ | ||
22 | K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4O, K4P, \ | ||
23 | K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, K3P, \ | ||
24 | K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2O, K2P, \ | ||
25 | K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, K1O, K1P, \ | ||
26 | K0A, K0B, K0C, K0J, K0K, K0L, K0M, K0N, K0O, K0P \ | ||
27 | ) { \ | ||
28 | { K5A, K5B, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, KC_NO, K5Q }, \ | ||
29 | { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, KC_NO, K4O, K4P, KC_NO }, \ | ||
30 | { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, KC_NO, K3O, K3P, KC_NO }, \ | ||
31 | { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, KC_NO, K2O, K2P, KC_NO }, \ | ||
32 | { K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, KC_NO, K1M, K1N, K1O, K1P, KC_NO }, \ | ||
33 | { K0A, K0B, K0C, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K0J, KC_NO, K0K, K0L, K0M, K0N, K0O, K0P, KC_NO } \ | ||
34 | } | ||
35 | |||
36 | #define LAYOUT_75_ansi( \ | ||
37 | K5A, K5B, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5Q, \ | ||
38 | K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4O, K4P, \ | ||
39 | K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3O, K3P, \ | ||
40 | K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2O, K2P, \ | ||
41 | K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1M, K1N, K1O, K1P, \ | ||
42 | K0A, K0B, K0C, K0J, K0K, K0L, K0M, K0N, K0O, K0P \ | ||
43 | ) { \ | ||
44 | { K5A, K5B, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, KC_NO, K5Q }, \ | ||
45 | { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, KC_NO, K4O, K4P, KC_NO }, \ | ||
46 | { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, KC_NO, K3O, K3P, KC_NO }, \ | ||
47 | { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, KC_NO, KC_NO, K2O, K2P, KC_NO }, \ | ||
48 | { K1A, KC_NO, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, KC_NO, K1M, K1N, K1O, K1P, KC_NO }, \ | ||
49 | { K0A, K0B, K0C, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K0J, KC_NO, K0K, K0L, K0M, K0N, K0O, K0P, KC_NO } \ | ||
50 | } | ||
diff --git a/keyboards/duck/orion/.noci b/keyboards/duck/orion/.noci new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/keyboards/duck/orion/.noci | |||
diff --git a/keyboards/duck/orion/info.json b/keyboards/duck/orion/info.json new file mode 100644 index 000000000..3ba2d3017 --- /dev/null +++ b/keyboards/duck/orion/info.json | |||
@@ -0,0 +1,10 @@ | |||
1 | { | ||
2 | "keyboard_name": "Duck Orion V3", | ||
3 | "url": "", | ||
4 | "maintainer": "qmk", | ||
5 | "layouts": { | ||
6 | "LAYOUT_tkl_ansi": { | ||
7 | "layout": [{"x":0, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6.5, "y":0}, {"x":7.5, "y":0}, {"x":8.5, "y":0}, {"x":9.5, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":15.25, "y":0}, {"x":16.25, "y":0}, {"x":17.25, "y":0}, {"x":0, "y":1.5}, {"x":1, "y":1.5}, {"x":2, "y":1.5}, {"x":3, "y":1.5}, {"x":4, "y":1.5}, {"x":5, "y":1.5}, {"x":6, "y":1.5}, {"x":7, "y":1.5}, {"x":8, "y":1.5}, {"x":9, "y":1.5}, {"x":10, "y":1.5}, {"x":11, "y":1.5}, {"x":12, "y":1.5}, {"x":13, "y":1.5, "w":2}, {"x":15.25, "y":1.5}, {"x":16.25, "y":1.5}, {"x":17.25, "y":1.5}, {"x":0, "y":2.5, "w":1.5}, {"x":1.5, "y":2.5}, {"x":2.5, "y":2.5}, {"x":3.5, "y":2.5}, {"x":4.5, "y":2.5}, {"x":5.5, "y":2.5}, {"x":6.5, "y":2.5}, {"x":7.5, "y":2.5}, {"x":8.5, "y":2.5}, {"x":9.5, "y":2.5}, {"x":10.5, "y":2.5}, {"x":11.5, "y":2.5}, {"x":12.5, "y":2.5}, {"x":13.5, "y":2.5, "w":1.5}, {"x":15.25, "y":2.5}, {"x":16.25, "y":2.5}, {"x":17.25, "y":2.5}, {"x":0, "y":3.5, "w":1.75}, {"x":1.75, "y":3.5}, {"x":2.75, "y":3.5}, {"x":3.75, "y":3.5}, {"x":4.75, "y":3.5}, {"x":5.75, "y":3.5}, {"x":6.75, "y":3.5}, {"x":7.75, "y":3.5}, {"x":8.75, "y":3.5}, {"x":9.75, "y":3.5}, {"x":10.75, "y":3.5}, {"x":11.75, "y":3.5}, {"x":12.75, "y":3.5, "w":2.25}, {"x":0, "y":4.5, "w":2.25}, {"x":2.25, "y":4.5}, {"x":3.25, "y":4.5}, {"x":4.25, "y":4.5}, {"x":5.25, "y":4.5}, {"x":6.25, "y":4.5}, {"x":7.25, "y":4.5}, {"x":8.25, "y":4.5}, {"x":9.25, "y":4.5}, {"x":10.25, "y":4.5}, {"x":11.25, "y":4.5}, {"x":12.25, "y":4.5, "w":2.75}, {"x":16.25, "y":4.5}, {"x":0, "y":5.5, "w":1.25}, {"x":1.25, "y":5.5, "w":1.25}, {"x":2.5, "y":5.5, "w":1.25}, {"x":3.75, "y":5.5, "w":6.25}, {"x":10, "y":5.5, "w":1.25}, {"x":11.25, "y":5.5, "w":1.25}, {"x":12.5, "y":5.5, "w":1.25}, {"x":13.75, "y":5.5, "w":1.25}, {"x":15.25, "y":5.5}, {"x":16.25, "y":5.5}, {"x":17.25, "y":5.5}] | ||
8 | } | ||
9 | } | ||
10 | } | ||
diff --git a/keyboards/duck/orion/readme.md b/keyboards/duck/orion/readme.md new file mode 100644 index 000000000..b65901de1 --- /dev/null +++ b/keyboards/duck/orion/readme.md | |||
@@ -0,0 +1,7 @@ | |||
1 | # Duck Orion | ||
2 | |||
3 | Non official firmware for custom TKL Korean keyboard made by Duck. | ||
4 | |||
5 | Newest version is the [Orion V3](http://duck0113.tistory.com/127) | ||
6 | |||
7 | See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). | ||
diff --git a/keyboards/duck/orion/rules.mk b/keyboards/duck/orion/rules.mk new file mode 100644 index 000000000..3788e0fbf --- /dev/null +++ b/keyboards/duck/orion/rules.mk | |||
@@ -0,0 +1 @@ | |||
DEFAULT_FOLDER = duck/orion/v3 | |||
diff --git a/keyboards/duck/orion/v3/config.h b/keyboards/duck/orion/v3/config.h new file mode 100644 index 000000000..bcc5fb004 --- /dev/null +++ b/keyboards/duck/orion/v3/config.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | Copyright 2019 MechMerlin <[email protected]> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #pragma once | ||
19 | |||
20 | #include "config_common.h" | ||
21 | |||
22 | /* USB Device descriptor parameter */ | ||
23 | #define VENDOR_ID 0x444B // Duck ("DK") | ||
24 | #define PRODUCT_ID 0x4F52 // Orion ("OR") | ||
25 | #define DEVICE_VER 0x0002 | ||
26 | #define MANUFACTURER Duck | ||
27 | #define PRODUCT Orion V3 | ||
28 | |||
29 | /* key matrix size */ | ||
30 | #define MATRIX_ROWS 6 | ||
31 | #define MATRIX_COLS 18 | ||
32 | |||
33 | #define DIODE_DIRECTION COL2ROW | ||
34 | |||
35 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
36 | #define DEBOUNCE 5 | ||
37 | |||
38 | /* number of backlight levels */ | ||
39 | // #define BACKLIGHT_LEVELS 3 | ||
40 | |||
41 | #undef BACKLIGHT_PIN | ||
42 | #define BACKLIGHT_PINS { B1, B2, B3, E6 } | ||
43 | #define BACKLIGHT_LED_COUNT 4 | ||
44 | #define BACKLIGHT_LEVELS 10 | ||
45 | |||
46 | #define RGBLIGHT_ANIMATIONS | ||
47 | #define RGB_DI_PIN D6 | ||
48 | #define RGBLED_NUM 18 | ||
49 | |||
50 | /* Set to top left most key */ | ||
51 | #define BOOTMAGIC_LITE_ROW 4 | ||
52 | #define BOOTMAGIC_LITE_COLUMN 10 | ||
53 | |||
54 | #define TAPPING_TERM 200 | ||
diff --git a/keyboards/duck/orion/v3/indicator_leds.c b/keyboards/duck/orion/v3/indicator_leds.c new file mode 100644 index 000000000..951ef462c --- /dev/null +++ b/keyboards/duck/orion/v3/indicator_leds.c | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | Copyright 2019 MechMerlin <[email protected]> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | #include <avr/interrupt.h> | ||
18 | #include <avr/io.h> | ||
19 | #include <stdbool.h> | ||
20 | #include <util/delay.h> | ||
21 | #include "indicator_leds.h" | ||
22 | #include "duck_led/duck_led.h" | ||
23 | |||
24 | #define LED_T1H 600 | ||
25 | #define LED_T1L 650 | ||
26 | #define LED_T0H 250 | ||
27 | #define LED_T0L 1000 | ||
28 | |||
29 | void send_bit_d4(bool bitVal) { | ||
30 | if(bitVal) { | ||
31 | asm volatile ( | ||
32 | "sbi %[port], %[bit] \n\t" | ||
33 | ".rept %[onCycles] \n\t" | ||
34 | "nop \n\t" | ||
35 | ".endr \n\t" | ||
36 | "cbi %[port], %[bit] \n\t" | ||
37 | ".rept %[offCycles] \n\t" | ||
38 | "nop \n\t" | ||
39 | ".endr \n\t" | ||
40 | :: | ||
41 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
42 | [bit] "I" (4), | ||
43 | [onCycles] "I" (NS_TO_CYCLES(LED_T1H) - 2), | ||
44 | [offCycles] "I" (NS_TO_CYCLES(LED_T1L) - 2)); | ||
45 | } else { | ||
46 | asm volatile ( | ||
47 | "sbi %[port], %[bit] \n\t" | ||
48 | ".rept %[onCycles] \n\t" | ||
49 | "nop \n\t" | ||
50 | ".endr \n\t" | ||
51 | "cbi %[port], %[bit] \n\t" | ||
52 | ".rept %[offCycles] \n\t" | ||
53 | "nop \n\t" | ||
54 | ".endr \n\t" | ||
55 | :: | ||
56 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
57 | [bit] "I" (4), | ||
58 | [onCycles] "I" (NS_TO_CYCLES(LED_T0H) - 2), | ||
59 | [offCycles] "I" (NS_TO_CYCLES(LED_T0L) - 2)); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | void send_value(uint8_t byte, enum Device device) { | ||
64 | for(uint8_t b = 0; b < 8; b++) { | ||
65 | if(device == Device_STATUSLED) { | ||
66 | send_bit_d4(byte & 0b10000000); | ||
67 | byte <<= 1; | ||
68 | } | ||
69 | } | ||
70 | } | ||
71 | |||
72 | // Send the LED indicators to the WS2811S chips | ||
73 | void indicator_leds_set(bool leds[8]) { | ||
74 | uint8_t led_cnt; | ||
75 | |||
76 | cli(); | ||
77 | for(led_cnt = 0; led_cnt < 8; led_cnt++) | ||
78 | send_value(leds[led_cnt] ? 255 : 0, Device_STATUSLED); | ||
79 | sei(); | ||
80 | show(); | ||
81 | } | ||
82 | |||
diff --git a/keyboards/duck/orion/v3/indicator_leds.h b/keyboards/duck/orion/v3/indicator_leds.h new file mode 100644 index 000000000..fe66eef6b --- /dev/null +++ b/keyboards/duck/orion/v3/indicator_leds.h | |||
@@ -0,0 +1 @@ | |||
void indicator_leds_set(bool leds[8]); | |||
diff --git a/keyboards/duck/orion/v3/keymaps/default/keymap.c b/keyboards/duck/orion/v3/keymaps/default/keymap.c new file mode 100644 index 000000000..0da0cdaeb --- /dev/null +++ b/keyboards/duck/orion/v3/keymaps/default/keymap.c | |||
@@ -0,0 +1,34 @@ | |||
1 | /* Copyright 2019 MechMerlin <[email protected]> | ||
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 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
19 | [0] = LAYOUT_tkl_ansi( | ||
20 | KC_ESC, 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_PSCR,KC_SLCK,KC_PAUS, | ||
21 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,KC_MINS, KC_EQL,KC_BSPC, KC_INS ,KC_HOME,KC_PGUP, | ||
22 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,KC_LBRC,KC_RBRC,KC_BSLS, KC_DEL ,KC_END ,KC_PGDN, | ||
23 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L,KC_SCLN,KC_QUOT, KC_ENT, | ||
24 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, | ||
25 | KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, MO(1),KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT), | ||
26 | |||
27 | [1] = LAYOUT_tkl_ansi( | ||
28 | 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, KC_TRNS, | ||
29 | 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, KC_TRNS, KC_TRNS, | ||
30 | BL_TOGG, BL_STEP, BL_INC, BL_DEC, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
31 | RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
32 | KC_TRNS, RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
33 | KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) | ||
34 | }; | ||
diff --git a/keyboards/duck/orion/v3/matrix.c b/keyboards/duck/orion/v3/matrix.c new file mode 100644 index 000000000..84673bd44 --- /dev/null +++ b/keyboards/duck/orion/v3/matrix.c | |||
@@ -0,0 +1,266 @@ | |||
1 | /* | ||
2 | Copyright 2019 MechMerlin <[email protected]> | ||
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 "quantum.h" | ||
18 | |||
19 | static uint8_t debouncing = DEBOUNCE; | ||
20 | |||
21 | /* matrix state(1:on, 0:off) */ | ||
22 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
23 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
24 | |||
25 | static uint8_t read_rows(uint8_t col); | ||
26 | static void init_rows(void); | ||
27 | static void unselect_cols(void); | ||
28 | static void select_col(uint8_t col); | ||
29 | |||
30 | |||
31 | __attribute__ ((weak)) | ||
32 | void matrix_init_kb(void) { | ||
33 | matrix_init_user(); | ||
34 | } | ||
35 | |||
36 | __attribute__ ((weak)) | ||
37 | void matrix_scan_kb(void) { | ||
38 | matrix_scan_user(); | ||
39 | } | ||
40 | |||
41 | __attribute__ ((weak)) | ||
42 | void matrix_init_user(void) { | ||
43 | } | ||
44 | |||
45 | __attribute__ ((weak)) | ||
46 | void matrix_scan_user(void) { | ||
47 | } | ||
48 | |||
49 | void indicator_init_ports(void) { | ||
50 | |||
51 | // Num LED | ||
52 | setPinOutput(B4); | ||
53 | |||
54 | // Caps Lock | ||
55 | setPinOutput(B0); | ||
56 | |||
57 | // Scroll Lock | ||
58 | setPinOutput(D7); | ||
59 | } | ||
60 | |||
61 | void matrix_init(void) { | ||
62 | indicator_init_ports(); | ||
63 | unselect_cols(); | ||
64 | init_rows(); | ||
65 | |||
66 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | ||
67 | matrix[i] = 0; | ||
68 | matrix_debouncing[i] = 0; | ||
69 | } | ||
70 | |||
71 | matrix_init_quantum(); | ||
72 | } | ||
73 | |||
74 | uint8_t matrix_scan(void) { | ||
75 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { | ||
76 | select_col(col); | ||
77 | _delay_us(3); | ||
78 | |||
79 | uint8_t rows = read_rows(col); | ||
80 | |||
81 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
82 | bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col); | ||
83 | bool curr_bit = rows & (1<<row); | ||
84 | if (prev_bit != curr_bit) { | ||
85 | matrix_debouncing[row] ^= ((matrix_row_t)1<<col); | ||
86 | if (debouncing) { | ||
87 | dprint("bounce!: "); dprintf("%02X", debouncing); dprintln(); | ||
88 | } | ||
89 | debouncing = DEBOUNCE; | ||
90 | } | ||
91 | } | ||
92 | unselect_cols(); | ||
93 | } | ||
94 | |||
95 | if (debouncing) { | ||
96 | if (--debouncing) { | ||
97 | _delay_ms(1); | ||
98 | } else { | ||
99 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
100 | matrix[i] = matrix_debouncing[i]; | ||
101 | } | ||
102 | } | ||
103 | } | ||
104 | |||
105 | matrix_scan_quantum(); | ||
106 | return 1; | ||
107 | } | ||
108 | |||
109 | inline matrix_row_t matrix_get_row(uint8_t row) { | ||
110 | return matrix[row]; | ||
111 | } | ||
112 | |||
113 | void matrix_print(void) { | ||
114 | print("\nr/c 0123456789ABCDEF\n"); | ||
115 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
116 | xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row))); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | /* Row pin configuration - diode connected | ||
121 | * row: 0 1 2 3 4 5 | ||
122 | * pin: PD0 PD1 PD2 PD3 PD5 PB7 | ||
123 | * | ||
124 | * Backspace uses its own pin PE2 on the column pin, row pin is grounded | ||
125 | */ | ||
126 | static void init_rows(void) { | ||
127 | DDRD &= ~0b00101111; | ||
128 | PORTD &= ~0b00101111; | ||
129 | |||
130 | DDRB &= ~0b10000000; | ||
131 | PORTB &= ~0b10000000; | ||
132 | |||
133 | DDRE &= ~0b00000100; | ||
134 | PORTE |= 0b00000100; | ||
135 | } | ||
136 | |||
137 | static uint8_t read_rows(uint8_t col) { | ||
138 | |||
139 | return (PIND&(1<<0) ? (1<<0) : 0) | | ||
140 | (PIND&(1<<1) ? (1<<1) : 0) | | ||
141 | (PIND&(1<<2) ? (1<<2) : 0) | | ||
142 | (PIND&(1<<3) ? (1<<3) : 0) | | ||
143 | (PIND&(1<<5) ? (1<<4) : 0) | | ||
144 | (PINB&(1<<7) ? (1<<5) : 0) | | ||
145 | (col== 17 ? ((PINE&(1<<2) ? 0 : (1<<1))) : 0); | ||
146 | |||
147 | } | ||
148 | |||
149 | uint8_t read_fwkey(void) | ||
150 | { | ||
151 | return PINE&(1<<2) ? 0 : (1<<2); | ||
152 | } | ||
153 | |||
154 | /* Columns 0 - 15 | ||
155 | * | ||
156 | * atmega32u4 decoder pin | ||
157 | * PC6 U1 E3 | ||
158 | * PB6 U2 E3 | ||
159 | * PF0 U1, U2 A0 | ||
160 | * PF1 U1, U2 A1 | ||
161 | * PC7 U1, U2 A2 | ||
162 | * | ||
163 | * These columns uses two 74HC237D 3 to 8 bit demultiplexers. | ||
164 | * col / pin: PC6 PB6 PF0 PF1 PC7 Decoder Pin | ||
165 | * 0: 1 0 0 0 0 U1 Y0 | ||
166 | * 1: 1 0 1 0 0 U1 Y1 | ||
167 | * 2: 1 0 0 1 0 U1 Y2 | ||
168 | * 3: 1 0 1 1 0 U1 Y3 | ||
169 | * 4: 1 0 0 0 1 U1 Y4 | ||
170 | * 5: 1 0 1 0 1 U1 Y5 | ||
171 | * 6: 1 0 0 1 1 U1 Y6 | ||
172 | * 7: 1 0 1 1 1 U1 Y7 | ||
173 | * | ||
174 | * 8: 0 1 0 0 0 U2 Y0 | ||
175 | * 9: 0 1 1 0 0 U2 Y1 | ||
176 | * 10: 0 1 0 1 0 U2 Y2 | ||
177 | * 11: 0 1 1 1 0 U2 Y3 | ||
178 | * 12: 0 1 0 0 1 U2 Y4 | ||
179 | * 13: 0 1 1 0 1 U2 Y5 | ||
180 | * 14: 0 1 0 1 1 U2 Y6 | ||
181 | * 15: 0 1 1 1 1 U2 Y7 | ||
182 | * | ||
183 | */ | ||
184 | static void unselect_cols(void) { | ||
185 | DDRB |= 0b01100000; | ||
186 | PORTB &= ~0b01100000; | ||
187 | |||
188 | DDRC |= 0b11000000; | ||
189 | PORTC &= ~0b11000000; | ||
190 | |||
191 | DDRF |= 0b00000011; | ||
192 | PORTF &= ~0b00000011; | ||
193 | } | ||
194 | |||
195 | static void select_col(uint8_t col) { | ||
196 | |||
197 | switch (col) { | ||
198 | case 0: | ||
199 | PORTC |= 0b01000000; | ||
200 | break; | ||
201 | case 1: | ||
202 | PORTC |= 0b01000000; | ||
203 | PORTF |= 0b00000001; | ||
204 | break; | ||
205 | case 2: | ||
206 | PORTC |= 0b01000000; | ||
207 | PORTF |= 0b00000010; | ||
208 | break; | ||
209 | case 3: | ||
210 | PORTC |= 0b01000000; | ||
211 | PORTF |= 0b00000011; | ||
212 | break; | ||
213 | case 4: | ||
214 | PORTC |= 0b11000000; | ||
215 | break; | ||
216 | case 5: | ||
217 | PORTC |= 0b11000000; | ||
218 | PORTF |= 0b00000001; | ||
219 | break; | ||
220 | case 6: | ||
221 | PORTC |= 0b11000000; | ||
222 | PORTF |= 0b00000010; | ||
223 | break; | ||
224 | case 7: | ||
225 | PORTC |= 0b11000000; | ||
226 | PORTF |= 0b00000011; | ||
227 | break; | ||
228 | case 8: | ||
229 | PORTB |= 0b01000000; | ||
230 | break; | ||
231 | case 9: | ||
232 | PORTB |= 0b01000000; | ||
233 | PORTF |= 0b00000001; | ||
234 | break; | ||
235 | case 10: | ||
236 | PORTB |= 0b01000000; | ||
237 | PORTF |= 0b00000010; | ||
238 | break; | ||
239 | case 11: | ||
240 | PORTB |= 0b01000000; | ||
241 | PORTF |= 0b00000011; | ||
242 | break; | ||
243 | case 12: | ||
244 | PORTB |= 0b01000000; | ||
245 | PORTC |= 0b10000000; | ||
246 | break; | ||
247 | case 13: | ||
248 | PORTB |= 0b01000000; | ||
249 | PORTF |= 0b00000001; | ||
250 | PORTC |= 0b10000000; | ||
251 | break; | ||
252 | case 14: | ||
253 | PORTB |= 0b01000000; | ||
254 | PORTF |= 0b00000010; | ||
255 | PORTC |= 0b10000000; | ||
256 | break; | ||
257 | case 15: | ||
258 | PORTB |= 0b01000000; | ||
259 | PORTF |= 0b00000011; | ||
260 | PORTC |= 0b10000000; | ||
261 | break; | ||
262 | case 16: | ||
263 | PORTB |= 0b00100000; | ||
264 | break; | ||
265 | } | ||
266 | } | ||
diff --git a/keyboards/duck/orion/v3/readme.md b/keyboards/duck/orion/v3/readme.md new file mode 100644 index 000000000..8d1b83401 --- /dev/null +++ b/keyboards/duck/orion/v3/readme.md | |||
@@ -0,0 +1,30 @@ | |||
1 | # Duck Orion V3 | ||
2 | |||
3 | Non official firmware for custom TKL Korean keyboard made by Duck. | ||
4 | Group buy was run December 2018 via [geekhack](https://geekhack.org/index.php?topic=98581.0) with 100 keyboards total. | ||
5 | |||
6 | * Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin) | ||
7 | * Hardware Supported: Duck Orion V3 PCB Ver 2.1 | ||
8 | * Hardware Availability: Wait until GB of the next revision | ||
9 | |||
10 | Make example for this keyboard (after setting up your build environment): | ||
11 | |||
12 | make duck/orion/v3:default | ||
13 | |||
14 | **Reset Key:** To put the Orion V3 into reset, hold Backspace key (`K4N`) while plugging in. | ||
15 | |||
16 | **CAUTION:** At this time 12/19/19 layer indicator lighting has not been implemented by default. | ||
17 | |||
18 | See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). | ||
19 | |||
20 | ## Hardware Notes | ||
21 | |||
22 | The Orion V3 PCB consists of: | ||
23 | |||
24 | ### Microchips | ||
25 | 2 74HC237D 3-to-8 line decoders U1, U2 | ||
26 | 1 Atmega32u4 microcontroller | ||
27 | 2 WS2811 LED controller U5, U6 | ||
28 | |||
29 | ## Notes | ||
30 | Special thanks to Marcus aka Keebology for doing this remotely and mapping the matrix, indicator LEDs, and backlight LEDs. | ||
diff --git a/keyboards/duck/orion/v3/rules.mk b/keyboards/duck/orion/v3/rules.mk new file mode 100644 index 000000000..64897bcd6 --- /dev/null +++ b/keyboards/duck/orion/v3/rules.mk | |||
@@ -0,0 +1,25 @@ | |||
1 | # MCU name | ||
2 | MCU = atmega32u4 | ||
3 | |||
4 | # Bootloader selection | ||
5 | BOOTLOADER = atmel-dfu | ||
6 | |||
7 | # Build Options | ||
8 | # change yes to no to disable | ||
9 | # | ||
10 | BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite | ||
11 | MOUSEKEY_ENABLE = no # Mouse keys | ||
12 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
13 | CONSOLE_ENABLE = no # Console for debug | ||
14 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
15 | NKRO_ENABLE = yes # Enable N-Key Rollover | ||
16 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | ||
17 | BACKLIGHT_DRIVER = custom | ||
18 | AUDIO_ENABLE = no # Audio output | ||
19 | RGBLIGHT_ENABLE = yes | ||
20 | |||
21 | CUSTOM_MATRIX = yes | ||
22 | SRC += indicator_leds.c \ | ||
23 | matrix.c duck_led/duck_led.c | ||
24 | |||
25 | LAYOUTS = tkl_ansi | ||
diff --git a/keyboards/duck/orion/v3/v3.c b/keyboards/duck/orion/v3/v3.c new file mode 100644 index 000000000..2e8f85a11 --- /dev/null +++ b/keyboards/duck/orion/v3/v3.c | |||
@@ -0,0 +1,39 @@ | |||
1 | /* Copyright 2019 MechMerlin <[email protected]> | ||
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 "v3.h" | ||
17 | #include "indicator_leds.h" | ||
18 | |||
19 | // Alphas PB1 | ||
20 | // Navigation Cluster: PB2 | ||
21 | // Number Row, Mods: PB3 | ||
22 | // Function Row: PE6 | ||
23 | |||
24 | // Other than using RGB or LED matrix, QMK cannot turn on specific zones | ||
25 | // of backlight LEDs. Unfortunately, Duck PCBs do not follow this design | ||
26 | // and instead use multiple pins connected to each of these zones. QMK is | ||
27 | // only able to control them ALL with the current default mechanisms. | ||
28 | |||
29 | // Locking indicator LEDs | ||
30 | // The Duck Orion V3 has 3 locking indicator LEDs and are located to the right | ||
31 | // of the Escape key. | ||
32 | bool led_update_kb(led_t led_state) { | ||
33 | if(led_update_user(led_state)) { | ||
34 | writePin(B0, !led_state.caps_lock); | ||
35 | writePin(B4, !led_state.num_lock); | ||
36 | writePin(D7, !led_state.scroll_lock); | ||
37 | } | ||
38 | return true; | ||
39 | } | ||
diff --git a/keyboards/duck/orion/v3/v3.h b/keyboards/duck/orion/v3/v3.h new file mode 100644 index 000000000..70591cf03 --- /dev/null +++ b/keyboards/duck/orion/v3/v3.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* Copyright 2019 MechMerlin <[email protected]> | ||
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 | #pragma once | ||
17 | |||
18 | #include "quantum.h" | ||
19 | |||
20 | #define ___ KC_NO | ||
21 | |||
22 | #define LAYOUT_tkl_ansi( \ | ||
23 | K5A, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, \ | ||
24 | K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4R, K4O, K4P, K4Q, \ | ||
25 | K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3O, K3P, K3Q, \ | ||
26 | K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2N, \ | ||
27 | K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1N, K1P, \ | ||
28 | K0A, K0B, K0C, K0F, K0I, K0K, K0M, K0N, K0O, K0P, K0Q \ | ||
29 | ) { \ | ||
30 | { K5A, ___, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, ___ }, \ | ||
31 | { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, ___, K4O, K4P, K4Q, K4R }, \ | ||
32 | { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3O, K3P, K3Q, ___ }, \ | ||
33 | { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, ___, K2N, ___, ___, ___, ___ }, \ | ||
34 | { K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, ___, ___, K1N, ___, K1P, ___, ___ }, \ | ||
35 | { K0A, K0B, K0C, ___, ___, K0F, ___, ___, K0I, ___, K0K, ___, K0M, K0N, K0O, K0P, K0Q, ___ } \ | ||
36 | } | ||
diff --git a/keyboards/duck/readme.md b/keyboards/duck/readme.md new file mode 100644 index 000000000..f5f6593b5 --- /dev/null +++ b/keyboards/duck/readme.md | |||
@@ -0,0 +1,18 @@ | |||
1 | # Duck Keyboards | ||
2 | |||
3 | [Duck](http://duck0113.tistory.com/) is a popular Korean custom keyboard designer. | ||
4 | Duck boards can only be bought new during a Group Buy and are commonly on a first come, first serve basis. | ||
5 | |||
6 | **QMK is not the official firmware for Duck Keyboards.** | ||
7 | |||
8 | For the official firmware, please use [OTD](http://kbdlab.co.kr/index.php?document_srl=100301&mid=board_sw). | ||
9 | |||
10 | ## QMK Powered Duck Boards | ||
11 | Eagle V2 | ||
12 | Jetfire V1 | ||
13 | Lightsaver V3 | ||
14 | Octagon V1 | ||
15 | Octagon V2 | ||
16 | Orion V3 | ||
17 | TC-V3 | ||
18 | Viper V2 | ||
diff --git a/keyboards/duck/tcv3/config.h b/keyboards/duck/tcv3/config.h new file mode 100644 index 000000000..9a75ff77f --- /dev/null +++ b/keyboards/duck/tcv3/config.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | Copyright 2019 MechMerlin <[email protected]> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #pragma once | ||
19 | |||
20 | #include "config_common.h" | ||
21 | |||
22 | /* USB Device descriptor parameter */ | ||
23 | #define VENDOR_ID 0x444B // Duck ("DK") | ||
24 | #define PRODUCT_ID 0x5443 // TC-V3 ("TC") | ||
25 | #define DEVICE_VER 0x0001 | ||
26 | #define MANUFACTURER Duck | ||
27 | #define PRODUCT TC-V3 | ||
28 | |||
29 | /* key matrix size */ | ||
30 | #define MATRIX_ROWS 6 | ||
31 | #define MATRIX_COLS 20 | ||
32 | |||
33 | #define DIODE_DIRECTION COL2ROW | ||
34 | |||
35 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
36 | #define DEBOUNCE 5 | ||
37 | |||
38 | #define RGBLIGHT_ANIMATIONS | ||
39 | #define RGB_DI_PIN D6 | ||
40 | #define RGBLED_NUM 17 | ||
41 | |||
42 | /* Set to top left most key */ | ||
43 | #define BOOTMAGIC_LITE_ROW 5 | ||
44 | #define BOOTMAGIC_LITE_COLUMN 10 | ||
diff --git a/keyboards/duck/tcv3/indicator_leds.c b/keyboards/duck/tcv3/indicator_leds.c new file mode 100644 index 000000000..d7d641f9c --- /dev/null +++ b/keyboards/duck/tcv3/indicator_leds.c | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | Copyright 2019 MechMerlin <[email protected]> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | #include <avr/interrupt.h> | ||
18 | #include <avr/io.h> | ||
19 | #include <stdbool.h> | ||
20 | #include <util/delay.h> | ||
21 | #include "indicator_leds.h" | ||
22 | |||
23 | #define LED_T1H 900 | ||
24 | #define LED_T1L 600 | ||
25 | #define LED_T0H 400 | ||
26 | #define LED_T0L 900 | ||
27 | |||
28 | void send_bit_d4(bool bitVal) { | ||
29 | if(bitVal) { | ||
30 | asm volatile ( | ||
31 | "sbi %[port], %[bit] \n\t" | ||
32 | ".rept %[onCycles] \n\t" | ||
33 | "nop \n\t" | ||
34 | ".endr \n\t" | ||
35 | "cbi %[port], %[bit] \n\t" | ||
36 | ".rept %[offCycles] \n\t" | ||
37 | "nop \n\t" | ||
38 | ".endr \n\t" | ||
39 | :: | ||
40 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
41 | [bit] "I" (4), | ||
42 | [onCycles] "I" (NS_TO_CYCLES(LED_T1H) - 2), | ||
43 | [offCycles] "I" (NS_TO_CYCLES(LED_T1L) - 2)); | ||
44 | } else { | ||
45 | asm volatile ( | ||
46 | "sbi %[port], %[bit] \n\t" | ||
47 | ".rept %[onCycles] \n\t" | ||
48 | "nop \n\t" | ||
49 | ".endr \n\t" | ||
50 | "cbi %[port], %[bit] \n\t" | ||
51 | ".rept %[offCycles] \n\t" | ||
52 | "nop \n\t" | ||
53 | ".endr \n\t" | ||
54 | :: | ||
55 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
56 | [bit] "I" (4), | ||
57 | [onCycles] "I" (NS_TO_CYCLES(LED_T0H) - 2), | ||
58 | [offCycles] "I" (NS_TO_CYCLES(LED_T0L) - 2)); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | void send_bit_d6(bool bitVal) | ||
63 | { | ||
64 | if(bitVal) { | ||
65 | asm volatile ( | ||
66 | "sbi %[port], %[bit] \n\t" | ||
67 | ".rept %[onCycles] \n\t" | ||
68 | "nop \n\t" | ||
69 | ".endr \n\t" | ||
70 | "cbi %[port], %[bit] \n\t" | ||
71 | ".rept %[offCycles] \n\t" | ||
72 | "nop \n\t" | ||
73 | ".endr \n\t" | ||
74 | :: | ||
75 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
76 | [bit] "I" (6), | ||
77 | [onCycles] "I" (NS_TO_CYCLES(LED_T1H) - 2), | ||
78 | [offCycles] "I" (NS_TO_CYCLES(LED_T1L) - 2)); | ||
79 | } else { | ||
80 | asm volatile ( | ||
81 | "sbi %[port], %[bit] \n\t" | ||
82 | ".rept %[onCycles] \n\t" | ||
83 | "nop \n\t" | ||
84 | ".endr \n\t" | ||
85 | "cbi %[port], %[bit] \n\t" | ||
86 | ".rept %[offCycles] \n\t" | ||
87 | "nop \n\t" | ||
88 | ".endr \n\t" | ||
89 | :: | ||
90 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
91 | [bit] "I" (6), | ||
92 | [onCycles] "I" (NS_TO_CYCLES(LED_T0H) - 2), | ||
93 | [offCycles] "I" (NS_TO_CYCLES(LED_T0L) - 2)); | ||
94 | } | ||
95 | } | ||
96 | |||
97 | void send_value(uint8_t byte, enum Device device) { | ||
98 | for(uint8_t b = 0; b < 8; b++) { | ||
99 | if(device == Device_STATUSLED) { | ||
100 | send_bit_d4(byte & 0b10000000); | ||
101 | } | ||
102 | if(device == Device_PCBRGB) { | ||
103 | send_bit_d6(byte & 0b10000000); | ||
104 | } | ||
105 | byte <<= 1; | ||
106 | } | ||
107 | } | ||
108 | |||
109 | void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device) { | ||
110 | send_value(r, device); | ||
111 | send_value(g, device); | ||
112 | send_value(b, device); | ||
113 | } | ||
114 | |||
115 | // Port from backlight_set_state | ||
116 | void indicator_leds_set(bool leds[8]) { | ||
117 | cli(); | ||
118 | send_color(leds[1] ? 255 : 0, leds[2] ? 255 : 0, leds[0] ? 255 : 0, Device_STATUSLED); | ||
119 | send_color(leds[4] ? 255 : 0, leds[3] ? 255 : 0, leds[5] ? 255 : 0, Device_STATUSLED); | ||
120 | leds[6] ? (PORTD &= ~0b10000000) : (PORTD |= 0b10000000); | ||
121 | sei(); | ||
122 | show(); | ||
123 | } | ||
diff --git a/keyboards/duck/tcv3/indicator_leds.h b/keyboards/duck/tcv3/indicator_leds.h new file mode 100644 index 000000000..ad3ec54f5 --- /dev/null +++ b/keyboards/duck/tcv3/indicator_leds.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #include "duck_led/duck_led.h" | ||
2 | |||
3 | void indicator_leds_set(bool leds[8]); | ||
4 | void backlight_toggle_rgb(bool enabled); | ||
5 | void backlight_set_rgb(uint8_t cfg[17][3]); | ||
6 | void backlight_init_ports(void); | ||
7 | void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device); | ||
diff --git a/keyboards/duck/tcv3/info.json b/keyboards/duck/tcv3/info.json new file mode 100644 index 000000000..169ed18a7 --- /dev/null +++ b/keyboards/duck/tcv3/info.json | |||
@@ -0,0 +1,14 @@ | |||
1 | { | ||
2 | "keyboard_name": "TCV3", | ||
3 | "url": "", | ||
4 | "maintainer": "qmk", | ||
5 | "layouts": { | ||
6 | "LAYOUT_all": { | ||
7 | "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2.25, "y":0}, {"x":4.25, "y":0}, {"x":5.25, "y":0}, {"x":6.25, "y":0}, {"x":7.25, "y":0}, {"x":8.75, "y":0}, {"x":9.75, "y":0}, {"x":10.75, "y":0}, {"x":11.75, "y":0}, {"x":13.25, "y":0}, {"x":14.25, "y":0}, {"x":15.25, "y":0}, {"x":16.25, "y":0}, {"x":17.5, "y":0}, {"x":18.5, "y":0}, {"x":0, "y":1.25}, {"x":1, "y":1.25}, {"x":2.25, "y":1.25}, {"x":3.25, "y":1.25}, {"x":4.25, "y":1.25}, {"x":5.25, "y":1.25}, {"x":6.25, "y":1.25}, {"x":7.25, "y":1.25}, {"x":8.25, "y":1.25}, {"x":9.25, "y":1.25}, {"x":10.25, "y":1.25}, {"x":11.25, "y":1.25}, {"x":12.25, "y":1.25}, {"x":13.25, "y":1.25}, {"x":14.25, "y":1.25}, {"x":15.25, "y":1.25}, {"x":16.25, "y":1.25}, {"x":17.5, "y":1.25}, {"x":18.5, "y":1.25}, {"x":0, "y":2.25}, {"x":1, "y":2.25}, {"x":2.25, "y":2.25, "w":1.5}, {"x":3.75, "y":2.25}, {"x":4.75, "y":2.25}, {"x":5.75, "y":2.25}, {"x":6.75, "y":2.25}, {"x":7.75, "y":2.25}, {"x":8.75, "y":2.25}, {"x":9.75, "y":2.25}, {"x":10.75, "y":2.25}, {"x":11.75, "y":2.25}, {"x":12.75, "y":2.25}, {"x":13.75, "y":2.25}, {"x":14.75, "y":2.25}, {"x":15.75, "y":2.25, "w":1.5}, {"x":17.5, "y":2.25}, {"x":18.5, "y":2.25}, {"x":0, "y":3.25}, {"x":1, "y":3.25}, {"x":2.25, "y":3.25, "w":1.75}, {"x":4, "y":3.25}, {"x":5, "y":3.25}, {"x":6, "y":3.25}, {"x":7, "y":3.25}, {"x":8, "y":3.25}, {"x":9, "y":3.25}, {"x":10, "y":3.25}, {"x":11, "y":3.25}, {"x":12, "y":3.25}, {"x":13, "y":3.25}, {"x":14, "y":3.25}, {"x":15, "y":3.25}, {"x":16, "y":3.25, "w":1.25}, {"x":17.5, "y":3.25}, {"x":18.5, "y":3.25}, {"x":0, "y":4.25}, {"x":1, "y":4.25}, {"x":2.25, "y":4.25, "w":1.25}, {"x":3.5, "y":4.25}, {"x":4.5, "y":4.25}, {"x":5.5, "y":4.25}, {"x":6.5, "y":4.25}, {"x":7.5, "y":4.25}, {"x":8.5, "y":4.25}, {"x":9.5, "y":4.25}, {"x":10.5, "y":4.25}, {"x":11.5, "y":4.25}, {"x":12.5, "y":4.25}, {"x":13.5, "y":4.25}, {"x":14.5, "y":4.25, "w":1.75}, {"x":16.25, "y":4.25}, {"x":17.5, "y":4.5}, {"x":0, "y":5.25}, {"x":1, "y":5.25}, {"x":2.25, "y":5.25, "w":1.5}, {"x":3.75, "y":5.25}, {"x":4.75, "y":5.25, "w":1.5}, {"x":6.25, "y":5.25, "w":6}, {"x":12.25, "y":5.25, "w":1.5}, {"x":13.75, "y":5.25}, {"x":14.75, "y":5.25, "w":1.5}, {"x":16.5, "y":5.5}, {"x":17.5, "y":5.5}, {"x":18.5, "y":5.5}] | ||
8 | }, | ||
9 | |||
10 | "LAYOUT": { | ||
11 | "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2.25, "y":0}, {"x":4.25, "y":0}, {"x":5.25, "y":0}, {"x":6.25, "y":0}, {"x":7.25, "y":0}, {"x":8.75, "y":0}, {"x":9.75, "y":0}, {"x":10.75, "y":0}, {"x":11.75, "y":0}, {"x":13.25, "y":0}, {"x":14.25, "y":0}, {"x":15.25, "y":0}, {"x":16.25, "y":0}, {"x":17.5, "y":0}, {"x":18.5, "y":0}, {"x":0, "y":1.25}, {"x":1, "y":1.25}, {"x":2.25, "y":1.25}, {"x":3.25, "y":1.25}, {"x":4.25, "y":1.25}, {"x":5.25, "y":1.25}, {"x":6.25, "y":1.25}, {"x":7.25, "y":1.25}, {"x":8.25, "y":1.25}, {"x":9.25, "y":1.25}, {"x":10.25, "y":1.25}, {"x":11.25, "y":1.25}, {"x":12.25, "y":1.25}, {"x":13.25, "y":1.25}, {"x":14.25, "y":1.25}, {"x":15.25, "y":1.25, "w":2}, {"x":17.5, "y":1.25}, {"x":18.5, "y":1.25}, {"x":0, "y":2.25}, {"x":1, "y":2.25}, {"x":2.25, "y":2.25, "w":1.5}, {"x":3.75, "y":2.25}, {"x":4.75, "y":2.25}, {"x":5.75, "y":2.25}, {"x":6.75, "y":2.25}, {"x":7.75, "y":2.25}, {"x":8.75, "y":2.25}, {"x":9.75, "y":2.25}, {"x":10.75, "y":2.25}, {"x":11.75, "y":2.25}, {"x":12.75, "y":2.25}, {"x":13.75, "y":2.25}, {"x":14.75, "y":2.25}, {"x":15.75, "y":2.25, "w":1.5}, {"x":17.5, "y":2.25}, {"x":18.5, "y":2.25}, {"x":0, "y":3.25}, {"x":1, "y":3.25}, {"x":2.25, "y":3.25, "w":1.75}, {"x":4, "y":3.25}, {"x":5, "y":3.25}, {"x":6, "y":3.25}, {"x":7, "y":3.25}, {"x":8, "y":3.25}, {"x":9, "y":3.25}, {"x":10, "y":3.25}, {"x":11, "y":3.25}, {"x":12, "y":3.25}, {"x":13, "y":3.25}, {"x":14, "y":3.25}, {"x":15, "y":3.25, "w":2.25}, {"x":17.5, "y":3.25}, {"x":18.5, "y":3.25}, {"x":0, "y":4.25}, {"x":1, "y":4.25}, {"x":2.25, "y":4.25, "w":2.25}, {"x":4.5, "y":4.25}, {"x":5.5, "y":4.25}, {"x":6.5, "y":4.25}, {"x":7.5, "y":4.25}, {"x":8.5, "y":4.25}, {"x":9.5, "y":4.25}, {"x":10.5, "y":4.25}, {"x":11.5, "y":4.25}, {"x":12.5, "y":4.25}, {"x":13.5, "y":4.25}, {"x":14.5, "y":4.25, "w":2.75}, {"x":17.5, "y":4.5}, {"x":0, "y":5.25}, {"x":1, "y":5.25}, {"x":2.25, "y":5.25, "w":1.5}, {"x":3.75, "y":5.25}, {"x":4.75, "y":5.25, "w":1.5}, {"x":6.25, "y":5.25, "w":6}, {"x":12.25, "y":5.25, "w":1.5}, {"x":13.75, "y":5.25}, {"x":14.75, "y":5.25, "w":1.5}, {"x":16.5, "y":5.5}, {"x":17.5, "y":5.5}, {"x":18.5, "y":5.5}] | ||
12 | } | ||
13 | } | ||
14 | } | ||
diff --git a/keyboards/duck/tcv3/keymaps/default/keymap.c b/keyboards/duck/tcv3/keymaps/default/keymap.c new file mode 100644 index 000000000..a7dfdddf6 --- /dev/null +++ b/keyboards/duck/tcv3/keymaps/default/keymap.c | |||
@@ -0,0 +1,37 @@ | |||
1 | /* Copyright 2019 MechMerlin <[email protected]> | ||
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 | #define _BL 0 // Base Layer | ||
19 | #define _FL 1 // Fn Layer | ||
20 | |||
21 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
22 | [_BL] = LAYOUT( | ||
23 | KC_F1, KC_F2, KC_ESC, 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_PSCR, KC_PAUS, | ||
24 | KC_F3, KC_F4, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_DEL, | ||
25 | KC_F5, KC_F6, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_HOME, KC_END, | ||
26 | KC_F7, KC_F8, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, KC_PGDN, | ||
27 | KC_F9, KC_F10, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, | ||
28 | KC_F11, KC_F12, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(_FL), KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), | ||
29 | |||
30 | [_FL] = LAYOUT( | ||
31 | KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_MOD, RGB_VAI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
32 | 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, KC_TRNS, KC_TRNS, KC_TRNS, | ||
33 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
34 | 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, KC_TRNS, KC_TRNS, | ||
35 | 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, | ||
36 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
37 | }; \ No newline at end of file | ||
diff --git a/keyboards/duck/tcv3/keymaps/default/readme.md b/keyboards/duck/tcv3/keymaps/default/readme.md new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/keyboards/duck/tcv3/keymaps/default/readme.md | |||
diff --git a/keyboards/duck/tcv3/keymaps/via/config.h b/keyboards/duck/tcv3/keymaps/via/config.h new file mode 100644 index 000000000..1f4e07e39 --- /dev/null +++ b/keyboards/duck/tcv3/keymaps/via/config.h | |||
@@ -0,0 +1 @@ | |||
#define DYNAMIC_KEYMAP_LAYER_COUNT 3 \ No newline at end of file | |||
diff --git a/keyboards/duck/tcv3/keymaps/via/keymap.c b/keyboards/duck/tcv3/keymaps/via/keymap.c new file mode 100644 index 000000000..925e1b208 --- /dev/null +++ b/keyboards/duck/tcv3/keymaps/via/keymap.c | |||
@@ -0,0 +1,42 @@ | |||
1 | /* Copyright 2019 MechMerlin <[email protected]> | ||
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 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
19 | [0] = LAYOUT( | ||
20 | KC_F1, KC_F2, KC_ESC, 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_PSCR, KC_PAUS, | ||
21 | KC_F3, KC_F4, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_DEL, | ||
22 | KC_F5, KC_F6, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_HOME, KC_END, | ||
23 | KC_F7, KC_F8, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, KC_PGDN, | ||
24 | KC_F9, KC_F10, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, | ||
25 | KC_F11, KC_F12, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), | ||
26 | |||
27 | [1] = LAYOUT( | ||
28 | KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_MOD, RGB_VAI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
29 | 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, KC_TRNS, KC_TRNS, KC_TRNS, | ||
30 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
31 | 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, KC_TRNS, KC_TRNS, | ||
32 | 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, | ||
33 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
34 | |||
35 | [2] = LAYOUT( | ||
36 | 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, KC_TRNS, KC_TRNS, | ||
37 | 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, KC_TRNS, KC_TRNS, KC_TRNS, | ||
38 | 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, KC_TRNS, KC_TRNS, KC_TRNS, | ||
39 | 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, KC_TRNS, KC_TRNS, | ||
40 | 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, | ||
41 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
42 | }; \ No newline at end of file | ||
diff --git a/keyboards/duck/tcv3/keymaps/via/rules.mk b/keyboards/duck/tcv3/keymaps/via/rules.mk new file mode 100644 index 000000000..36b7ba9cb --- /dev/null +++ b/keyboards/duck/tcv3/keymaps/via/rules.mk | |||
@@ -0,0 +1,2 @@ | |||
1 | VIA_ENABLE = yes | ||
2 | LTO_ENABLE = yes | ||
diff --git a/keyboards/duck/tcv3/matrix.c b/keyboards/duck/tcv3/matrix.c new file mode 100644 index 000000000..d2d90470a --- /dev/null +++ b/keyboards/duck/tcv3/matrix.c | |||
@@ -0,0 +1,280 @@ | |||
1 | /* | ||
2 | Copyright 2019 MechMerlin <[email protected]> | ||
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 <util/delay.h> | ||
18 | #include <avr/io.h> | ||
19 | #include <stdio.h> | ||
20 | #include "matrix.h" | ||
21 | #include "util.h" | ||
22 | #include "print.h" | ||
23 | #include "debug.h" | ||
24 | |||
25 | static uint8_t debouncing = DEBOUNCE; | ||
26 | |||
27 | /* matrix state(1:on, 0:off) */ | ||
28 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
29 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
30 | |||
31 | static uint8_t read_rows(uint8_t col); | ||
32 | static void init_rows(void); | ||
33 | static void unselect_cols(void); | ||
34 | static void select_col(uint8_t col); | ||
35 | |||
36 | |||
37 | __attribute__ ((weak)) | ||
38 | void matrix_init_kb(void) { | ||
39 | matrix_init_user(); | ||
40 | } | ||
41 | |||
42 | __attribute__ ((weak)) | ||
43 | void matrix_scan_kb(void) { | ||
44 | matrix_scan_user(); | ||
45 | } | ||
46 | |||
47 | __attribute__ ((weak)) | ||
48 | void matrix_init_user(void) { | ||
49 | } | ||
50 | |||
51 | __attribute__ ((weak)) | ||
52 | void matrix_scan_user(void) { | ||
53 | } | ||
54 | |||
55 | void backlight_init_ports(void) | ||
56 | { | ||
57 | // DDRD |= 0b11010000; | ||
58 | // PORTD &= ~0b01010000; | ||
59 | // PORTD |= 0b10000000; | ||
60 | // DDRB |= 0b00011111; | ||
61 | // PORTB &= ~0b00001110; | ||
62 | // PORTB |= 0b00010001; | ||
63 | // DDRE |= 0b01000000; | ||
64 | // PORTE &= ~0b01000000; | ||
65 | } | ||
66 | |||
67 | void matrix_init(void) { | ||
68 | backlight_init_ports(); | ||
69 | unselect_cols(); | ||
70 | init_rows(); | ||
71 | |||
72 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | ||
73 | matrix[i] = 0; | ||
74 | matrix_debouncing[i] = 0; | ||
75 | } | ||
76 | |||
77 | matrix_init_quantum(); | ||
78 | } | ||
79 | |||
80 | uint8_t matrix_scan(void) { | ||
81 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { | ||
82 | select_col(col); | ||
83 | _delay_us(3); | ||
84 | |||
85 | uint8_t rows = read_rows(col); | ||
86 | |||
87 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
88 | bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col); | ||
89 | bool curr_bit = rows & (1<<row); | ||
90 | if (prev_bit != curr_bit) { | ||
91 | matrix_debouncing[row] ^= ((matrix_row_t)1<<col); | ||
92 | if (debouncing) { | ||
93 | dprint("bounce!: "); dprintf("%02X", debouncing); dprintln(); | ||
94 | } | ||
95 | debouncing = DEBOUNCE; | ||
96 | } | ||
97 | } | ||
98 | unselect_cols(); | ||
99 | } | ||
100 | |||
101 | if (debouncing) { | ||
102 | if (--debouncing) { | ||
103 | _delay_ms(1); | ||
104 | } else { | ||
105 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
106 | matrix[i] = matrix_debouncing[i]; | ||
107 | } | ||
108 | } | ||
109 | } | ||
110 | |||
111 | matrix_scan_quantum(); | ||
112 | return 1; | ||
113 | } | ||
114 | |||
115 | inline matrix_row_t matrix_get_row(uint8_t row) { | ||
116 | return matrix[row]; | ||
117 | } | ||
118 | |||
119 | void matrix_print(void) { | ||
120 | print("\nr/c 0123456789ABCDEF\n"); | ||
121 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
122 | xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row))); | ||
123 | } | ||
124 | } | ||
125 | /* Row pin configuration | ||
126 | * row: 0 1 2 3 4 5 | ||
127 | * pin: PB7 PD0 PD1 PD2 PD3 PD5 | ||
128 | * | ||
129 | * Reset Key uses its own pin PE2 | ||
130 | */ | ||
131 | static void init_rows(void) { | ||
132 | DDRD &= ~0b00101111; | ||
133 | PORTD &= ~0b00101111; | ||
134 | |||
135 | DDRB &= ~0b10000000; | ||
136 | PORTB &= ~0b10000000; | ||
137 | |||
138 | DDRE &= ~0b00000100; | ||
139 | PORTE |= 0b00000100; | ||
140 | } | ||
141 | |||
142 | static uint8_t read_rows(uint8_t col) { | ||
143 | if (col == 19) { | ||
144 | return PINE&(1<<2) ? 0 : (1<<0); | ||
145 | } else { | ||
146 | return (PIND&(1<<0) ? (1<<1) : 0) | | ||
147 | (PIND&(1<<1) ? (1<<2) : 0) | | ||
148 | (PIND&(1<<2) ? (1<<3) : 0) | | ||
149 | (PIND&(1<<3) ? (1<<4) : 0) | | ||
150 | (PIND&(1<<5) ? (1<<5) : 0) | | ||
151 | (PINB&(1<<7) ? (1<<0) : 0); | ||
152 | } | ||
153 | } | ||
154 | |||
155 | |||
156 | /* Columns 0 - G | ||
157 | * These columns uses two 74HC237D 3 to 8 bit demultiplexers. | ||
158 | * | ||
159 | * atmega32u4 decoder pin | ||
160 | * C6 U1 E2 | ||
161 | * B6 U2 E2 | ||
162 | * F0 U1, U2 A0 | ||
163 | * F1 U1, U2 A1 | ||
164 | * C7 U1, U2 A2 | ||
165 | * | ||
166 | * col 0: B4 | ||
167 | * col 1: D7 | ||
168 | * col I: B5 | ||
169 | * | ||
170 | * col / pin: PC6 PB6 PF0 PF1 PC7 Decoder Pin | ||
171 | * 2: 1 0 0 0 0 U1 Y0 | ||
172 | * 3: 1 0 1 0 0 U1 Y1 | ||
173 | * 4: 1 0 0 1 0 U1 Y2 | ||
174 | * 5: 1 0 1 1 0 U1 Y3 | ||
175 | * 6: 1 0 0 0 1 U1 Y4 | ||
176 | * 7: 1 0 1 0 1 U1 Y5 | ||
177 | * 8: 1 0 0 1 1 U1 Y6 | ||
178 | * 9: 1 0 1 1 1 U1 Y7 | ||
179 | * A: 0 1 0 0 0 U2 Y0 | ||
180 | * B: 0 1 1 0 0 U2 Y1 | ||
181 | * C: 0 1 0 1 0 U2 Y2 | ||
182 | * D: 0 1 1 1 0 U2 Y3 | ||
183 | * E: 0 1 0 0 1 U2 Y4 | ||
184 | * F: 0 1 1 0 1 U2 Y5 | ||
185 | * G: 0 1 0 1 1 U2 Y6 | ||
186 | * H: 0 1 1 1 1 U2 Y7 | ||
187 | * | ||
188 | */ | ||
189 | static void unselect_cols(void) { | ||
190 | DDRB |= 0b01110000; | ||
191 | PORTB &= ~0b01110000; | ||
192 | |||
193 | DDRC |= 0b11000000; | ||
194 | PORTC &= ~0b11000000; | ||
195 | |||
196 | DDRD |= 0b10000000; | ||
197 | PORTD &= ~0b10000000; | ||
198 | |||
199 | DDRF |= 0b00000011; | ||
200 | PORTF &= ~0b00000011; | ||
201 | } | ||
202 | |||
203 | static void select_col(uint8_t col) { | ||
204 | |||
205 | switch (col) { | ||
206 | case 0: | ||
207 | PORTB |= 0b00010000; | ||
208 | break; | ||
209 | case 1: | ||
210 | PORTD |= 0b10000000; | ||
211 | break; | ||
212 | case 2: // U1 Y0 | ||
213 | PORTC |= 0b01000000; | ||
214 | break; | ||
215 | case 3: // U1 Y1 | ||
216 | PORTC |= 0b01000000; | ||
217 | PORTF |= 0b00000001; | ||
218 | break; | ||
219 | case 4: // U1 Y2 | ||
220 | PORTC |= 0b01000000; | ||
221 | PORTF |= 0b00000010; | ||
222 | break; | ||
223 | case 5: // U1 Y3 | ||
224 | PORTC |= 0b01000000; | ||
225 | PORTF |= 0b00000011; | ||
226 | break; | ||
227 | case 6: // U1 Y4 | ||
228 | PORTC |= 0b11000000; | ||
229 | break; | ||
230 | case 7: // U1 Y5 | ||
231 | PORTC |= 0b11000000; | ||
232 | PORTF |= 0b00000001; | ||
233 | break; | ||
234 | case 8: // U1 Y6 | ||
235 | PORTC |= 0b11000000; | ||
236 | PORTF |= 0b00000010; | ||
237 | break; | ||
238 | case 9: // U1 Y7 | ||
239 | PORTC |= 0b11000000; | ||
240 | PORTF |= 0b00000011; | ||
241 | break; | ||
242 | case 10: // U2 Y0 | ||
243 | PORTB |= 0b01000000; | ||
244 | break; | ||
245 | case 11: // U2 Y1 | ||
246 | PORTB |= 0b01000000; | ||
247 | PORTF |= 0b00000001; | ||
248 | break; | ||
249 | case 12: // U2 Y2 | ||
250 | PORTB |= 0b01000000; | ||
251 | PORTF |= 0b00000010; | ||
252 | break; | ||
253 | case 13: // U2 Y3 | ||
254 | PORTB |= 0b01000000; | ||
255 | PORTF |= 0b00000011; | ||
256 | break; | ||
257 | case 14: // U2 Y4 | ||
258 | PORTB |= 0b01000000; | ||
259 | PORTC |= 0b10000000; | ||
260 | break; | ||
261 | case 15: // U2 Y5 | ||
262 | PORTB |= 0b01000000; | ||
263 | PORTC |= 0b10000000; | ||
264 | PORTF |= 0b00000001; | ||
265 | break; | ||
266 | case 16: // U2 Y6 | ||
267 | PORTB |= 0b01000000; | ||
268 | PORTC |= 0b10000000; | ||
269 | PORTF |= 0b00000010; | ||
270 | break; | ||
271 | case 17: // U2 Y7 | ||
272 | PORTB |= 0b01000000; | ||
273 | PORTC |= 0b10000000; | ||
274 | PORTF |= 0b00000011; | ||
275 | break; | ||
276 | case 18: | ||
277 | PORTB |= 0b00100000; | ||
278 | break; | ||
279 | } | ||
280 | } \ No newline at end of file | ||
diff --git a/keyboards/duck/tcv3/readme.md b/keyboards/duck/tcv3/readme.md new file mode 100644 index 000000000..79fb14bd1 --- /dev/null +++ b/keyboards/duck/tcv3/readme.md | |||
@@ -0,0 +1,27 @@ | |||
1 | # Duck TC-V3 | ||
2 | |||
3 | Non official firmware for custom Korean keyboard made by Duck. | ||
4 | Group buy was run April 2018 via [geekhack](https://geekhack.org/index.php?topic=95335.0). | ||
5 | |||
6 | * Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin) | ||
7 | * Hardware Supported: Duck TC-V3 ver 1.0 PCB, Atmega32u4, 74HC237D | ||
8 | * Hardware Availability: Wait until GB of the next revision | ||
9 | |||
10 | Make example for this keyboard (after setting up your build environment): | ||
11 | |||
12 | make duck/tcv3:default | ||
13 | |||
14 | **Reset Key:** To put the TC-V3 into reset, hold the top second most right key (`K0J`) while plugging in. | ||
15 | |||
16 | **CAUTION:** At this time 02/28/20 backlighting has not been tested fully and may not properly work. | ||
17 | |||
18 | See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. | ||
19 | |||
20 | ## Hardware Notes | ||
21 | |||
22 | The Duck TC-V3 PCB consists of: | ||
23 | |||
24 | ### Microchips | ||
25 | * 2 74HC237D 3-to-8 line decoders | ||
26 | * 1 Atmega32u4 microcontroller | ||
27 | * 3 WS2811 LED controller | ||
diff --git a/keyboards/duck/tcv3/rules.mk b/keyboards/duck/tcv3/rules.mk new file mode 100644 index 000000000..3fef0ce54 --- /dev/null +++ b/keyboards/duck/tcv3/rules.mk | |||
@@ -0,0 +1,22 @@ | |||
1 | # MCU name | ||
2 | MCU = atmega32u4 | ||
3 | |||
4 | # Bootloader selection | ||
5 | BOOTLOADER = atmel-dfu | ||
6 | |||
7 | # Build Options | ||
8 | # change yes to no to disable | ||
9 | # | ||
10 | BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite | ||
11 | MOUSEKEY_ENABLE = no # Mouse keys | ||
12 | EXTRAKEY_ENABLE = no # Audio control and System control | ||
13 | CONSOLE_ENABLE = no # Console for debug | ||
14 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
15 | NKRO_ENABLE = yes # Enable N-Key Rollover | ||
16 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
17 | AUDIO_ENABLE = no # Audio output | ||
18 | RGBLIGHT_ENABLE = yes | ||
19 | |||
20 | CUSTOM_MATRIX = yes | ||
21 | SRC += indicator_leds.c \ | ||
22 | matrix.c duck_led/duck_led.c | ||
diff --git a/keyboards/duck/tcv3/tcv3.c b/keyboards/duck/tcv3/tcv3.c new file mode 100644 index 000000000..4d52d22c1 --- /dev/null +++ b/keyboards/duck/tcv3/tcv3.c | |||
@@ -0,0 +1,130 @@ | |||
1 | /* Copyright 2019 MechMerlin <[email protected]> | ||
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 "tcv3.h" | ||
17 | #include "indicator_leds.h" | ||
18 | |||
19 | enum BACKLIGHT_AREAS { | ||
20 | BACKLIGHT_ALPHA = 0b0000001, | ||
21 | BACKLIGHT_FROW = 0b0000010, | ||
22 | BACKLIGHT_MOD = 0b0000100, | ||
23 | BACKLIGHT_MACRO = 0b0001000, | ||
24 | BACKLIGHT_SWITCH = 0b0001111 | ||
25 | }; | ||
26 | |||
27 | // uint8_t backlight_rgb_r = 255; | ||
28 | // uint8_t backlight_rgb_g = 0; | ||
29 | // uint8_t backlight_rgb_b = 0; | ||
30 | // uint8_t backlight_os_state = 0; | ||
31 | // uint32_t backlight_layer_state = 0; | ||
32 | |||
33 | // void backlight_toggle_rgb(bool enabled) | ||
34 | // { | ||
35 | // if(enabled) { | ||
36 | // uint8_t rgb[17][3] = { | ||
37 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
38 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
39 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
40 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
41 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
42 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
43 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
44 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
45 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
46 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
47 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
48 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
49 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
50 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
51 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
52 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}, | ||
53 | // {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b} | ||
54 | // }; | ||
55 | // backlight_set_rgb(rgb); | ||
56 | // } else { | ||
57 | // uint8_t rgb[17][3] = { | ||
58 | // {0, 0, 0}, | ||
59 | // {0, 0, 0}, | ||
60 | // {0, 0, 0}, | ||
61 | // {0, 0, 0}, | ||
62 | // {0, 0, 0}, | ||
63 | // {0, 0, 0}, | ||
64 | // {0, 0, 0}, | ||
65 | // {0, 0, 0}, | ||
66 | // {0, 0, 0}, | ||
67 | // {0, 0, 0}, | ||
68 | // {0, 0, 0}, | ||
69 | // {0, 0, 0}, | ||
70 | // {0, 0, 0}, | ||
71 | // {0, 0, 0}, | ||
72 | // {0, 0, 0}, | ||
73 | // {0, 0, 0}, | ||
74 | // {0, 0, 0} | ||
75 | // }; | ||
76 | // backlight_set_rgb(rgb); | ||
77 | // } | ||
78 | // } | ||
79 | |||
80 | // void backlight_set_rgb(uint8_t cfg[17][3]) | ||
81 | // { | ||
82 | // cli(); | ||
83 | // for(uint8_t i = 0; i < 17; ++i) { | ||
84 | // send_color(cfg[i][0], cfg[i][1], cfg[i][2], Device_PCBRGB); | ||
85 | // } | ||
86 | // sei(); | ||
87 | // show(); | ||
88 | // } | ||
89 | |||
90 | // Q5, Q6, Q7 is connected to B1 - alphas | ||
91 | // Q8, Q9 is connected to B2 - frow | ||
92 | // Q1, Q2, Q3 is connected to B3 - mods | ||
93 | // Q4 is connected to E6 - macro keys | ||
94 | |||
95 | void backlight_set(uint8_t level) { | ||
96 | level & BACKLIGHT_ALPHA ? (PORTB |= 0b00000010) : (PORTB &= ~0b00000010); | ||
97 | level & BACKLIGHT_FROW ? (PORTB |= 0b00000100) : (PORTB &= ~0b00000100); | ||
98 | level & BACKLIGHT_MOD ? (PORTB |= 0b00001000) : (PORTB &= ~0b00001000); | ||
99 | level & BACKLIGHT_MACRO ? (PORTE |= 0b01000000) : (PORTE &= ~0b01000000); | ||
100 | } | ||
101 | |||
102 | // // Port from backlight_update_state | ||
103 | // void led_set_kb(uint8_t usb_led) { | ||
104 | // bool status[7] = { | ||
105 | // backlight_os_state & (1<<USB_LED_CAPS_LOCK), | ||
106 | // backlight_os_state & (1<<USB_LED_SCROLL_LOCK), | ||
107 | // backlight_os_state & (1<<USB_LED_NUM_LOCK), | ||
108 | // backlight_layer_state & (1<<1), | ||
109 | // backlight_layer_state & (1<<2), | ||
110 | // backlight_layer_state & (1<<3), | ||
111 | // backlight_layer_state & (1<<4) | ||
112 | // }; | ||
113 | // indicator_leds_set(status); | ||
114 | // backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001); | ||
115 | // backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000); | ||
116 | // } | ||
117 | |||
118 | // U5 Pin 1, 2, 3 connected to top left LEDs | ||
119 | |||
120 | // U6 Pin 1, 2, 3 connected to bottom right leds col of 3 | ||
121 | // U7 Pin 1 connected to row connected to bottom right leds solo LED | ||
122 | // U7 Pin 2, 3 connected to bottom right leds row of 2 | ||
123 | // U6 Pin 5 connected to U7 Pin 6 | ||
124 | |||
125 | // U5 pin 5 connected to U6 Pin 6 | ||
126 | |||
127 | // U5, U6, U7 Pin 8 VCC | ||
128 | // U5, U6, U7 Pin 4 GRND | ||
129 | |||
130 | // U5 Pin 6 connected to atmega32u4 D4 | ||
diff --git a/keyboards/duck/tcv3/tcv3.h b/keyboards/duck/tcv3/tcv3.h new file mode 100644 index 000000000..8e40e94ae --- /dev/null +++ b/keyboards/duck/tcv3/tcv3.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* Copyright 2019 MechMerlin <[email protected]> | ||
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 | #pragma once | ||
17 | |||
18 | #include "quantum.h" | ||
19 | |||
20 | #define XXX KC_NO | ||
21 | |||
22 | #define LAYOUT_all( \ | ||
23 | K00, K01, K02, K04, K05, K06, K07, K09, K0A, K0B, K0C, K0D, K0E, K0F, K0G, K0J, K0I, \ | ||
24 | K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, \ | ||
25 | K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, K2G, K2H, K2I, \ | ||
26 | K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, K3G, K3H, K3I, \ | ||
27 | K40, K41, K42, k43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4E, K4F, K4G, K4H, \ | ||
28 | K50, K51, K52, K53, K54, K5A, K5C, K5E, K5F, K5G, K5H, K5I \ | ||
29 | ) { \ | ||
30 | { K00, K01, K02, XXX, K04, K05, K06, K07, XXX, K09, K0A, K0B, K0C, K0D, K0E, K0F, K0G, XXX, K0I, K0J }, \ | ||
31 | { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, XXX }, \ | ||
32 | { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, XXX, K2G, K2H, K2I, XXX }, \ | ||
33 | { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, XXX, K3G, K3H, K3I, XXX }, \ | ||
34 | { K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, XXX, K4E, K4F, K4G, K4H, XXX, XXX }, \ | ||
35 | { K50, K51, K52, K53, K54, XXX, XXX, XXX, XXX, XXX, K5A, XXX, K5C, XXX, K5E, K5F, K5G, K5H, K5I, XXX }, \ | ||
36 | } | ||
37 | |||
38 | |||
39 | #define LAYOUT( \ | ||
40 | K00, K01, K02, K04, K05, K06, K07, K09, K0A, K0B, K0C, K0D, K0E, K0F, K0G, K0J, K0I, \ | ||
41 | K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1G, K1H, K1I, \ | ||
42 | K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, K2G, K2H, K2I, \ | ||
43 | K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3G, K3H, K3I, \ | ||
44 | K40, K41, K42, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4E, K4F, K4H, \ | ||
45 | K50, K51, K52, K53, K54, K5A, K5C, K5E, K5F, K5G, K5H, K5I \ | ||
46 | ) { \ | ||
47 | { K00, K01, K02, XXX, K04, K05, K06, K07, XXX, K09, K0A, K0B, K0C, K0D, K0E, K0F, K0G, XXX, K0I, K0J }, \ | ||
48 | { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, XXX, K1G, K1H, K1I, XXX }, \ | ||
49 | { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, XXX, K2G, K2H, K2I, XXX }, \ | ||
50 | { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, XXX, XXX, K3G, K3H, K3I, XXX }, \ | ||
51 | { K40, K41, K42, XXX, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, XXX, K4E, K4F, XXX, K4H, XXX, XXX }, \ | ||
52 | { K50, K51, K52, K53, K54, XXX, XXX, XXX, XXX, XXX, K5A, XXX, K5C, XXX, K5E, K5F, K5G, K5H, K5I, XXX }, \ | ||
53 | } | ||