diff options
author | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-10-04 22:06:57 -0700 |
---|---|---|
committer | noroadsleft <18669334+noroadsleft@users.noreply.github.com> | 2019-10-04 22:06:57 -0700 |
commit | 60b2a9a5ea88321629e970e936652cc1ba786b80 (patch) | |
tree | e2d35cd155cdc334ead653a9699ff2ae7dcde6a0 | |
parent | 537623c9db15e29889c1c78e55ebcbba13edbabb (diff) | |
download | qmk_firmware-60b2a9a5ea88321629e970e936652cc1ba786b80.tar.gz qmk_firmware-60b2a9a5ea88321629e970e936652cc1ba786b80.zip |
[Keyboard] Preliminary Support for Duck Orion V3 (#6892)
* initial commit
* fixup init_rows and read_rows routine
* fixup matrix based on Marcus's tracing info
* add a temporary keymap
* add notes
* use a standard tkl ansi keymap
* turn on that last column
* backslash and backspace row left to fix
* reorg from backslash to pgdn
* got the matrix done but the backspace location at K4N is still suspect
* add reset info into readme
* add qmk configurator support
* add community layout support
* remove uneeded keymap readme
* add a new column just for the reset switch
* change copyright dates
* add cautionary message to readme as we don't know about the lighting condition yet
* Update keyboards/duck/orion/v3/v3.c
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Update keyboards/duck/orion/v3/v3.c
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Update keyboards/duck/orion/v3/v3.c
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* change bootloader comments
-rw-r--r-- | keyboards/duck/orion/info.json | 12 | ||||
-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 | 50 | ||||
-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 | 26 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/matrix.c | 272 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/readme.md | 30 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/rules.mk | 39 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/v3.c | 65 | ||||
-rw-r--r-- | keyboards/duck/orion/v3/v3.h | 36 |
12 files changed, 621 insertions, 0 deletions
diff --git a/keyboards/duck/orion/info.json b/keyboards/duck/orion/info.json new file mode 100644 index 000000000..a1f0a5b38 --- /dev/null +++ b/keyboards/duck/orion/info.json | |||
@@ -0,0 +1,12 @@ | |||
1 | { | ||
2 | "keyboard_name": "Duck Orion V3", | ||
3 | "url": "", | ||
4 | "maintainer": "qmk", | ||
5 | "width": 18.25, | ||
6 | "height": 6.5, | ||
7 | "layouts": { | ||
8 | "LAYOUT_tkl_ansi": { | ||
9 | "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}] | ||
10 | } | ||
11 | } | ||
12 | } \ No newline at end of file | ||
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..3a17d5941 --- /dev/null +++ b/keyboards/duck/orion/v3/config.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | Copyright 2019 MechMerlin <mechmerlin@gmail.com> | ||
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 | #define DESCRIPTION TKL Korean custom keyboard | ||
29 | |||
30 | /* key matrix size */ | ||
31 | #define MATRIX_ROWS 6 | ||
32 | #define MATRIX_COLS 18 | ||
33 | |||
34 | #define DIODE_DIRECTION COL2ROW | ||
35 | |||
36 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
37 | #define DEBOUNCE 5 | ||
38 | |||
39 | /* number of backlight levels */ | ||
40 | #define BACKLIGHT_LEVELS 3 | ||
41 | |||
42 | #define RGBLIGHT_ANIMATIONS | ||
43 | #define RGB_DI_PIN D6 | ||
44 | #define RGBLED_NUM 17 | ||
45 | |||
46 | /* Set to top left most key */ | ||
47 | #define BOOTMAGIC_LITE_ROW 4 | ||
48 | #define BOOTMAGIC_LITE_COLUMN 10 | ||
49 | |||
50 | #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 <mechmerlin@gmail.com> | ||
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..83fa4f9a8 --- /dev/null +++ b/keyboards/duck/orion/v3/keymaps/default/keymap.c | |||
@@ -0,0 +1,26 @@ | |||
1 | /* Copyright 2019 MechMerlin <mechmerlin@gmail.com> | ||
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, KC_APP,KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT) \ | ||
26 | }; | ||
diff --git a/keyboards/duck/orion/v3/matrix.c b/keyboards/duck/orion/v3/matrix.c new file mode 100644 index 000000000..3c3240b9f --- /dev/null +++ b/keyboards/duck/orion/v3/matrix.c | |||
@@ -0,0 +1,272 @@ | |||
1 | /* | ||
2 | Copyright 2019 MechMerlin <mechmerlin@gmail.com> | ||
3 | This program is free software: you can redistribute it and/or modify | ||
4 | it under the terms of the GNU General Public License as published by | ||
5 | the Free Software Foundation, either version 2 of the License, or | ||
6 | (at your option) any later version. | ||
7 | |||
8 | This program is distributed in the hope that it will be useful, | ||
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | GNU General Public License for more details. | ||
12 | |||
13 | You should have received a copy of the GNU General Public License | ||
14 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include <util/delay.h> | ||
18 | #include <avr/io.h> | ||
19 | #include <stdio.h> | ||
20 | #include "matrix.h" | ||
21 | #include "util.h" | ||
22 | #include "print.h" | ||
23 | #include "debug.h" | ||
24 | |||
25 | static uint8_t debouncing = DEBOUNCE; | ||
26 | |||
27 | /* matrix state(1:on, 0:off) */ | ||
28 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
29 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
30 | |||
31 | static uint8_t read_rows(uint8_t col); | ||
32 | static void init_rows(void); | ||
33 | static void unselect_cols(void); | ||
34 | static void select_col(uint8_t col); | ||
35 | |||
36 | |||
37 | __attribute__ ((weak)) | ||
38 | void matrix_init_kb(void) { | ||
39 | matrix_init_user(); | ||
40 | } | ||
41 | |||
42 | __attribute__ ((weak)) | ||
43 | void matrix_scan_kb(void) { | ||
44 | matrix_scan_user(); | ||
45 | } | ||
46 | |||
47 | __attribute__ ((weak)) | ||
48 | void matrix_init_user(void) { | ||
49 | } | ||
50 | |||
51 | __attribute__ ((weak)) | ||
52 | void matrix_scan_user(void) { | ||
53 | } | ||
54 | |||
55 | void backlight_init_ports(void) | ||
56 | { | ||
57 | DDRD |= 0b11010000; | ||
58 | PORTD &= ~0b01010000; | ||
59 | PORTD |= 0b10000000; | ||
60 | DDRB |= 0b00011111; | ||
61 | PORTB &= ~0b00001110; | ||
62 | PORTB |= 0b00010001; | ||
63 | DDRE |= 0b01000000; | ||
64 | PORTE &= ~0b01000000; | ||
65 | } | ||
66 | |||
67 | void matrix_init(void) { | ||
68 | backlight_init_ports(); | ||
69 | unselect_cols(); | ||
70 | init_rows(); | ||
71 | |||
72 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | ||
73 | matrix[i] = 0; | ||
74 | matrix_debouncing[i] = 0; | ||
75 | } | ||
76 | |||
77 | matrix_init_quantum(); | ||
78 | } | ||
79 | |||
80 | uint8_t matrix_scan(void) { | ||
81 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { | ||
82 | select_col(col); | ||
83 | _delay_us(3); | ||
84 | |||
85 | uint8_t rows = read_rows(col); | ||
86 | |||
87 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
88 | bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col); | ||
89 | bool curr_bit = rows & (1<<row); | ||
90 | if (prev_bit != curr_bit) { | ||
91 | matrix_debouncing[row] ^= ((matrix_row_t)1<<col); | ||
92 | if (debouncing) { | ||
93 | dprint("bounce!: "); dprintf("%02X", debouncing); dprintln(); | ||
94 | } | ||
95 | debouncing = DEBOUNCE; | ||
96 | } | ||
97 | } | ||
98 | unselect_cols(); | ||
99 | } | ||
100 | |||
101 | if (debouncing) { | ||
102 | if (--debouncing) { | ||
103 | _delay_ms(1); | ||
104 | } else { | ||
105 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
106 | matrix[i] = matrix_debouncing[i]; | ||
107 | } | ||
108 | } | ||
109 | } | ||
110 | |||
111 | matrix_scan_quantum(); | ||
112 | return 1; | ||
113 | } | ||
114 | |||
115 | inline matrix_row_t matrix_get_row(uint8_t row) { | ||
116 | return matrix[row]; | ||
117 | } | ||
118 | |||
119 | void matrix_print(void) { | ||
120 | print("\nr/c 0123456789ABCDEF\n"); | ||
121 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
122 | xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row))); | ||
123 | } | ||
124 | } | ||
125 | |||
126 | /* Row pin configuration - diode connected | ||
127 | * row: 0 1 2 3 4 5 | ||
128 | * pin: PD0 PD1 PD2 PD3 PD5 PB7 | ||
129 | * | ||
130 | * Backspace uses its own pin PE2 on the column pin, row pin is grounded | ||
131 | */ | ||
132 | static void init_rows(void) { | ||
133 | DDRD &= ~0b00101111; | ||
134 | PORTD &= ~0b00101111; | ||
135 | |||
136 | DDRB &= ~0b10000000; | ||
137 | PORTB &= ~0b10000000; | ||
138 | |||
139 | DDRE &= ~0b00000100; | ||
140 | PORTE |= 0b00000100; | ||
141 | } | ||
142 | |||
143 | static uint8_t read_rows(uint8_t col) { | ||
144 | |||
145 | return (PIND&(1<<0) ? (1<<0) : 0) | | ||
146 | (PIND&(1<<1) ? (1<<1) : 0) | | ||
147 | (PIND&(1<<2) ? (1<<2) : 0) | | ||
148 | (PIND&(1<<3) ? (1<<3) : 0) | | ||
149 | (PIND&(1<<5) ? (1<<4) : 0) | | ||
150 | (PINB&(1<<7) ? (1<<5) : 0) | | ||
151 | (col== 17 ? ((PINE&(1<<2) ? 0 : (1<<1))) : 0); | ||
152 | |||
153 | } | ||
154 | |||
155 | uint8_t read_fwkey(void) | ||
156 | { | ||
157 | return PINE&(1<<2) ? 0 : (1<<2); | ||
158 | } | ||
159 | |||
160 | /* Columns 0 - 15 | ||
161 | * | ||
162 | * atmega32u4 decoder pin | ||
163 | * PC6 U1 E3 | ||
164 | * PB6 U2 E3 | ||
165 | * PF0 U1, U2 A0 | ||
166 | * PF1 U1, U2 A1 | ||
167 | * PC7 U1, U2 A2 | ||
168 | * | ||
169 | * These columns uses two 74HC237D 3 to 8 bit demultiplexers. | ||
170 | * col / pin: PC6 PB6 PF0 PF1 PC7 Decoder Pin | ||
171 | * 0: 1 0 0 0 0 U1 Y0 | ||
172 | * 1: 1 0 1 0 0 U1 Y1 | ||
173 | * 2: 1 0 0 1 0 U1 Y2 | ||
174 | * 3: 1 0 1 1 0 U1 Y3 | ||
175 | * 4: 1 0 0 0 1 U1 Y4 | ||
176 | * 5: 1 0 1 0 1 U1 Y5 | ||
177 | * 6: 1 0 0 1 1 U1 Y6 | ||
178 | * 7: 1 0 1 1 1 U1 Y7 | ||
179 | * | ||
180 | * 8: 0 1 0 0 0 U2 Y0 | ||
181 | * 9: 0 1 1 0 0 U2 Y1 | ||
182 | * 10: 0 1 0 1 0 U2 Y2 | ||
183 | * 11: 0 1 1 1 0 U2 Y3 | ||
184 | * 12: 0 1 0 0 1 U2 Y4 | ||
185 | * 13: 0 1 1 0 1 U2 Y5 | ||
186 | * 14: 0 1 0 1 1 U2 Y6 | ||
187 | * 15: 0 1 1 1 1 U2 Y7 | ||
188 | * | ||
189 | */ | ||
190 | static void unselect_cols(void) { | ||
191 | DDRB |= 0b01100000; | ||
192 | PORTB &= ~0b01100000; | ||
193 | |||
194 | DDRC |= 0b11000000; | ||
195 | PORTC &= ~0b11000000; | ||
196 | |||
197 | DDRF |= 0b00000011; | ||
198 | PORTF &= ~0b00000011; | ||
199 | } | ||
200 | |||
201 | static void select_col(uint8_t col) { | ||
202 | |||
203 | switch (col) { | ||
204 | case 0: | ||
205 | PORTC |= 0b01000000; | ||
206 | break; | ||
207 | case 1: | ||
208 | PORTC |= 0b01000000; | ||
209 | PORTF |= 0b00000001; | ||
210 | break; | ||
211 | case 2: | ||
212 | PORTC |= 0b01000000; | ||
213 | PORTF |= 0b00000010; | ||
214 | break; | ||
215 | case 3: | ||
216 | PORTC |= 0b01000000; | ||
217 | PORTF |= 0b00000011; | ||
218 | break; | ||
219 | case 4: | ||
220 | PORTC |= 0b11000000; | ||
221 | break; | ||
222 | case 5: | ||
223 | PORTC |= 0b11000000; | ||
224 | PORTF |= 0b00000001; | ||
225 | break; | ||
226 | case 6: | ||
227 | PORTC |= 0b11000000; | ||
228 | PORTF |= 0b00000010; | ||
229 | break; | ||
230 | case 7: | ||
231 | PORTC |= 0b11000000; | ||
232 | PORTF |= 0b00000011; | ||
233 | break; | ||
234 | case 8: | ||
235 | PORTB |= 0b01000000; | ||
236 | break; | ||
237 | case 9: | ||
238 | PORTB |= 0b01000000; | ||
239 | PORTF |= 0b00000001; | ||
240 | break; | ||
241 | case 10: | ||
242 | PORTB |= 0b01000000; | ||
243 | PORTF |= 0b00000010; | ||
244 | break; | ||
245 | case 11: | ||
246 | PORTB |= 0b01000000; | ||
247 | PORTF |= 0b00000011; | ||
248 | break; | ||
249 | case 12: | ||
250 | PORTB |= 0b01000000; | ||
251 | PORTC |= 0b10000000; | ||
252 | break; | ||
253 | case 13: | ||
254 | PORTB |= 0b01000000; | ||
255 | PORTF |= 0b00000001; | ||
256 | PORTC |= 0b10000000; | ||
257 | break; | ||
258 | case 14: | ||
259 | PORTB |= 0b01000000; | ||
260 | PORTF |= 0b00000010; | ||
261 | PORTC |= 0b10000000; | ||
262 | break; | ||
263 | case 15: | ||
264 | PORTB |= 0b01000000; | ||
265 | PORTF |= 0b00000011; | ||
266 | PORTC |= 0b10000000; | ||
267 | break; | ||
268 | case 16: | ||
269 | PORTB |= 0b00100000; | ||
270 | break; | ||
271 | } | ||
272 | } | ||
diff --git a/keyboards/duck/orion/v3/readme.md b/keyboards/duck/orion/v3/readme.md new file mode 100644 index 000000000..50032e93e --- /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 Eagle/Viper 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 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 10/03/19 lighting has not been tested fully and may not properly work. | ||
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 | ||
26 | 1 Atmega32u4 microcontroller | ||
27 | 2 WS2811 LED controller | ||
28 | |||
29 | ## Notes | ||
30 | Special thanks to Marcus aka Keebology for doing this remotely and mapping the matrix. \ No newline at end of file | ||
diff --git a/keyboards/duck/orion/v3/rules.mk b/keyboards/duck/orion/v3/rules.mk new file mode 100644 index 000000000..a57b3d60c --- /dev/null +++ b/keyboards/duck/orion/v3/rules.mk | |||
@@ -0,0 +1,39 @@ | |||
1 | # MCU name | ||
2 | MCU = atmega32u4 | ||
3 | |||
4 | # Bootloader selection | ||
5 | # Teensy halfkay | ||
6 | # Pro Micro caterina | ||
7 | # Atmel DFU atmel-dfu | ||
8 | # LUFA DFU lufa-dfu | ||
9 | # QMK DFU qmk-dfu | ||
10 | # ATmega32A bootloadHID | ||
11 | # ATmega328P USBasp | ||
12 | BOOTLOADER = atmel-dfu | ||
13 | |||
14 | |||
15 | # Build Options | ||
16 | # change yes to no to disable | ||
17 | # | ||
18 | BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000) | ||
19 | MOUSEKEY_ENABLE = no # Mouse keys(+4700) | ||
20 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
21 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
22 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
23 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
24 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
25 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
26 | NKRO_ENABLE = yes # USB Nkey Rollover | ||
27 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default | ||
28 | MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) | ||
29 | UNICODE_ENABLE = no # Unicode | ||
30 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
31 | AUDIO_ENABLE = no # Audio output on port C6 | ||
32 | FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches | ||
33 | RGBLIGHT_ENABLE = yes | ||
34 | |||
35 | CUSTOM_MATRIX = yes | ||
36 | SRC += indicator_leds.c \ | ||
37 | matrix.c duck_led/duck_led.c | ||
38 | |||
39 | LAYOUTS = tkl_ansi \ No newline at end of file | ||
diff --git a/keyboards/duck/orion/v3/v3.c b/keyboards/duck/orion/v3/v3.c new file mode 100644 index 000000000..95da4b45b --- /dev/null +++ b/keyboards/duck/orion/v3/v3.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /* Copyright 2019 MechMerlin <mechmerlin@gmail.com> | ||
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 | enum BACKLIGHT_AREAS { | ||
20 | BACKLIGHT_ALPHAS = 0b00000010, | ||
21 | BACKLIGHT_MODNUM = 0b00001000 | ||
22 | }; | ||
23 | |||
24 | void backlight_set(uint8_t level) { | ||
25 | switch(level) { | ||
26 | case 0: | ||
27 | PORTB |= BACKLIGHT_ALPHAS; | ||
28 | PORTB |= BACKLIGHT_MODNUM; | ||
29 | break; | ||
30 | case 1: | ||
31 | PORTB &= ~BACKLIGHT_ALPHAS; | ||
32 | PORTB |= BACKLIGHT_MODNUM; | ||
33 | break; | ||
34 | case 2: | ||
35 | PORTB |= BACKLIGHT_ALPHAS; | ||
36 | PORTB &= ~BACKLIGHT_MODNUM; | ||
37 | break; | ||
38 | case 3: | ||
39 | PORTB &= ~BACKLIGHT_ALPHAS; | ||
40 | PORTB &= ~BACKLIGHT_MODNUM; | ||
41 | break; | ||
42 | } | ||
43 | } | ||
44 | |||
45 | // Port from backlight_update_state | ||
46 | void led_set_kb(uint8_t usb_led) { | ||
47 | bool status[8] = { | ||
48 | IS_HOST_LED_ON(USB_LED_SCROLL_LOCK), /* LED 3 */ | ||
49 | IS_HOST_LED_ON(USB_LED_CAPS_LOCK), /* LED 2 */ | ||
50 | IS_HOST_LED_ON(USB_LED_NUM_LOCK), /* LED 1 */ | ||
51 | |||
52 | layer_state & (1<<2), /* LED 6 */ | ||
53 | layer_state & (1<<1), /* LED 5 */ | ||
54 | layer_state & (1<<0) ? 0: 1, /* LED 4 */ | ||
55 | |||
56 | layer_state & (1<<5), /* LED 8 */ | ||
57 | layer_state & (1<<4) /* LED 7 */ | ||
58 | }; | ||
59 | |||
60 | indicator_leds_set(status); | ||
61 | } | ||
62 | |||
63 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
64 | return process_record_user(keycode, record); | ||
65 | } | ||
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 <mechmerlin@gmail.com> | ||
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 | } | ||