diff options
author | Akshay <[email protected]> | 2022-04-10 12:13:40 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2022-04-10 12:13:40 +0100 |
commit | dc90387ce7d8ba7b607d9c48540bf6d8b560f14d (patch) | |
tree | 4ccb8fa5886b66fa9d480edef74236c27f035e16 /keyboards/duck/octagon/v1 |
Diffstat (limited to 'keyboards/duck/octagon/v1')
-rw-r--r-- | keyboards/duck/octagon/v1/.noci | 0 | ||||
-rw-r--r-- | keyboards/duck/octagon/v1/config.h | 49 | ||||
-rw-r--r-- | keyboards/duck/octagon/v1/info.json | 95 | ||||
-rw-r--r-- | keyboards/duck/octagon/v1/matrix.c | 230 | ||||
-rw-r--r-- | keyboards/duck/octagon/v1/readme.md | 28 | ||||
-rw-r--r-- | keyboards/duck/octagon/v1/rules.mk | 24 | ||||
-rw-r--r-- | keyboards/duck/octagon/v1/v1.c | 46 | ||||
-rw-r--r-- | keyboards/duck/octagon/v1/v1.h | 34 |
8 files changed, 506 insertions, 0 deletions
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 | } | ||