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 |
Diffstat (limited to 'keyboards/duck/octagon')
24 files changed, 1279 insertions, 0 deletions
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 | } | ||