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/orion |
Diffstat (limited to 'keyboards/duck/orion')
-rw-r--r-- | keyboards/duck/orion/.noci | 0 | ||||
-rw-r--r-- | keyboards/duck/orion/info.json | 10 | ||||
-rw-r--r-- | keyboards/duck/orion/readme.md | 7 | ||||
-rw-r--r-- | keyboards/duck/orion/rules.mk | 1 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/config.h | 54 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/indicator_leds.c | 82 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/indicator_leds.h | 1 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/keymaps/default/keymap.c | 34 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/matrix.c | 266 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/readme.md | 30 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/rules.mk | 25 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/v3.c | 39 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/v3.h | 36 |
13 files changed, 585 insertions, 0 deletions
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 | } | ||