aboutsummaryrefslogtreecommitdiff
path: root/keyboards/duck/tcv3
diff options
context:
space:
mode:
authorAkshay <[email protected]>2022-04-10 12:13:40 +0100
committerAkshay <[email protected]>2022-04-10 12:13:40 +0100
commitdc90387ce7d8ba7b607d9c48540bf6d8b560f14d (patch)
tree4ccb8fa5886b66fa9d480edef74236c27f035e16 /keyboards/duck/tcv3
Diffstat (limited to 'keyboards/duck/tcv3')
-rw-r--r--keyboards/duck/tcv3/config.h44
-rw-r--r--keyboards/duck/tcv3/indicator_leds.c123
-rw-r--r--keyboards/duck/tcv3/indicator_leds.h7
-rw-r--r--keyboards/duck/tcv3/info.json14
-rw-r--r--keyboards/duck/tcv3/keymaps/default/keymap.c37
-rw-r--r--keyboards/duck/tcv3/keymaps/default/readme.md0
-rw-r--r--keyboards/duck/tcv3/keymaps/via/config.h1
-rw-r--r--keyboards/duck/tcv3/keymaps/via/keymap.c42
-rw-r--r--keyboards/duck/tcv3/keymaps/via/rules.mk2
-rw-r--r--keyboards/duck/tcv3/matrix.c280
-rw-r--r--keyboards/duck/tcv3/readme.md27
-rw-r--r--keyboards/duck/tcv3/rules.mk22
-rw-r--r--keyboards/duck/tcv3/tcv3.c130
-rw-r--r--keyboards/duck/tcv3/tcv3.h53
14 files changed, 782 insertions, 0 deletions
diff --git a/keyboards/duck/tcv3/config.h b/keyboards/duck/tcv3/config.h
new file mode 100644
index 000000000..9a75ff77f
--- /dev/null
+++ b/keyboards/duck/tcv3/config.h
@@ -0,0 +1,44 @@
1/*
2Copyright 2019 MechMerlin <[email protected]>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#include "config_common.h"
21
22/* USB Device descriptor parameter */
23#define VENDOR_ID 0x444B // Duck ("DK")
24#define PRODUCT_ID 0x5443 // TC-V3 ("TC")
25#define DEVICE_VER 0x0001
26#define MANUFACTURER Duck
27#define PRODUCT TC-V3
28
29/* key matrix size */
30#define MATRIX_ROWS 6
31#define MATRIX_COLS 20
32
33#define DIODE_DIRECTION COL2ROW
34
35/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
36#define DEBOUNCE 5
37
38#define RGBLIGHT_ANIMATIONS
39#define RGB_DI_PIN D6
40#define RGBLED_NUM 17
41
42/* Set to top left most key */
43#define BOOTMAGIC_LITE_ROW 5
44#define BOOTMAGIC_LITE_COLUMN 10
diff --git a/keyboards/duck/tcv3/indicator_leds.c b/keyboards/duck/tcv3/indicator_leds.c
new file mode 100644
index 000000000..d7d641f9c
--- /dev/null
+++ b/keyboards/duck/tcv3/indicator_leds.c
@@ -0,0 +1,123 @@
1/*
2Copyright 2019 MechMerlin <[email protected]>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along 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
28void 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
62void 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
97void 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
109void 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
116void indicator_leds_set(bool leds[8]) {
117 cli();
118 send_color(leds[1] ? 255 : 0, leds[2] ? 255 : 0, leds[0] ? 255 : 0, Device_STATUSLED);
119 send_color(leds[4] ? 255 : 0, leds[3] ? 255 : 0, leds[5] ? 255 : 0, Device_STATUSLED);
120 leds[6] ? (PORTD &= ~0b10000000) : (PORTD |= 0b10000000);
121 sei();
122 show();
123}
diff --git a/keyboards/duck/tcv3/indicator_leds.h b/keyboards/duck/tcv3/indicator_leds.h
new file mode 100644
index 000000000..ad3ec54f5
--- /dev/null
+++ b/keyboards/duck/tcv3/indicator_leds.h
@@ -0,0 +1,7 @@
1#include "duck_led/duck_led.h"
2
3void indicator_leds_set(bool leds[8]);
4void backlight_toggle_rgb(bool enabled);
5void backlight_set_rgb(uint8_t cfg[17][3]);
6void backlight_init_ports(void);
7void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device);
diff --git a/keyboards/duck/tcv3/info.json b/keyboards/duck/tcv3/info.json
new file mode 100644
index 000000000..169ed18a7
--- /dev/null
+++ b/keyboards/duck/tcv3/info.json
@@ -0,0 +1,14 @@
1{
2 "keyboard_name": "TCV3",
3 "url": "",
4 "maintainer": "qmk",
5 "layouts": {
6 "LAYOUT_all": {
7 "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2.25, "y":0}, {"x":4.25, "y":0}, {"x":5.25, "y":0}, {"x":6.25, "y":0}, {"x":7.25, "y":0}, {"x":8.75, "y":0}, {"x":9.75, "y":0}, {"x":10.75, "y":0}, {"x":11.75, "y":0}, {"x":13.25, "y":0}, {"x":14.25, "y":0}, {"x":15.25, "y":0}, {"x":16.25, "y":0}, {"x":17.5, "y":0}, {"x":18.5, "y":0}, {"x":0, "y":1.25}, {"x":1, "y":1.25}, {"x":2.25, "y":1.25}, {"x":3.25, "y":1.25}, {"x":4.25, "y":1.25}, {"x":5.25, "y":1.25}, {"x":6.25, "y":1.25}, {"x":7.25, "y":1.25}, {"x":8.25, "y":1.25}, {"x":9.25, "y":1.25}, {"x":10.25, "y":1.25}, {"x":11.25, "y":1.25}, {"x":12.25, "y":1.25}, {"x":13.25, "y":1.25}, {"x":14.25, "y":1.25}, {"x":15.25, "y":1.25}, {"x":16.25, "y":1.25}, {"x":17.5, "y":1.25}, {"x":18.5, "y":1.25}, {"x":0, "y":2.25}, {"x":1, "y":2.25}, {"x":2.25, "y":2.25, "w":1.5}, {"x":3.75, "y":2.25}, {"x":4.75, "y":2.25}, {"x":5.75, "y":2.25}, {"x":6.75, "y":2.25}, {"x":7.75, "y":2.25}, {"x":8.75, "y":2.25}, {"x":9.75, "y":2.25}, {"x":10.75, "y":2.25}, {"x":11.75, "y":2.25}, {"x":12.75, "y":2.25}, {"x":13.75, "y":2.25}, {"x":14.75, "y":2.25}, {"x":15.75, "y":2.25, "w":1.5}, {"x":17.5, "y":2.25}, {"x":18.5, "y":2.25}, {"x":0, "y":3.25}, {"x":1, "y":3.25}, {"x":2.25, "y":3.25, "w":1.75}, {"x":4, "y":3.25}, {"x":5, "y":3.25}, {"x":6, "y":3.25}, {"x":7, "y":3.25}, {"x":8, "y":3.25}, {"x":9, "y":3.25}, {"x":10, "y":3.25}, {"x":11, "y":3.25}, {"x":12, "y":3.25}, {"x":13, "y":3.25}, {"x":14, "y":3.25}, {"x":15, "y":3.25}, {"x":16, "y":3.25, "w":1.25}, {"x":17.5, "y":3.25}, {"x":18.5, "y":3.25}, {"x":0, "y":4.25}, {"x":1, "y":4.25}, {"x":2.25, "y":4.25, "w":1.25}, {"x":3.5, "y":4.25}, {"x":4.5, "y":4.25}, {"x":5.5, "y":4.25}, {"x":6.5, "y":4.25}, {"x":7.5, "y":4.25}, {"x":8.5, "y":4.25}, {"x":9.5, "y":4.25}, {"x":10.5, "y":4.25}, {"x":11.5, "y":4.25}, {"x":12.5, "y":4.25}, {"x":13.5, "y":4.25}, {"x":14.5, "y":4.25, "w":1.75}, {"x":16.25, "y":4.25}, {"x":17.5, "y":4.5}, {"x":0, "y":5.25}, {"x":1, "y":5.25}, {"x":2.25, "y":5.25, "w":1.5}, {"x":3.75, "y":5.25}, {"x":4.75, "y":5.25, "w":1.5}, {"x":6.25, "y":5.25, "w":6}, {"x":12.25, "y":5.25, "w":1.5}, {"x":13.75, "y":5.25}, {"x":14.75, "y":5.25, "w":1.5}, {"x":16.5, "y":5.5}, {"x":17.5, "y":5.5}, {"x":18.5, "y":5.5}]
8 },
9
10 "LAYOUT": {
11 "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2.25, "y":0}, {"x":4.25, "y":0}, {"x":5.25, "y":0}, {"x":6.25, "y":0}, {"x":7.25, "y":0}, {"x":8.75, "y":0}, {"x":9.75, "y":0}, {"x":10.75, "y":0}, {"x":11.75, "y":0}, {"x":13.25, "y":0}, {"x":14.25, "y":0}, {"x":15.25, "y":0}, {"x":16.25, "y":0}, {"x":17.5, "y":0}, {"x":18.5, "y":0}, {"x":0, "y":1.25}, {"x":1, "y":1.25}, {"x":2.25, "y":1.25}, {"x":3.25, "y":1.25}, {"x":4.25, "y":1.25}, {"x":5.25, "y":1.25}, {"x":6.25, "y":1.25}, {"x":7.25, "y":1.25}, {"x":8.25, "y":1.25}, {"x":9.25, "y":1.25}, {"x":10.25, "y":1.25}, {"x":11.25, "y":1.25}, {"x":12.25, "y":1.25}, {"x":13.25, "y":1.25}, {"x":14.25, "y":1.25}, {"x":15.25, "y":1.25, "w":2}, {"x":17.5, "y":1.25}, {"x":18.5, "y":1.25}, {"x":0, "y":2.25}, {"x":1, "y":2.25}, {"x":2.25, "y":2.25, "w":1.5}, {"x":3.75, "y":2.25}, {"x":4.75, "y":2.25}, {"x":5.75, "y":2.25}, {"x":6.75, "y":2.25}, {"x":7.75, "y":2.25}, {"x":8.75, "y":2.25}, {"x":9.75, "y":2.25}, {"x":10.75, "y":2.25}, {"x":11.75, "y":2.25}, {"x":12.75, "y":2.25}, {"x":13.75, "y":2.25}, {"x":14.75, "y":2.25}, {"x":15.75, "y":2.25, "w":1.5}, {"x":17.5, "y":2.25}, {"x":18.5, "y":2.25}, {"x":0, "y":3.25}, {"x":1, "y":3.25}, {"x":2.25, "y":3.25, "w":1.75}, {"x":4, "y":3.25}, {"x":5, "y":3.25}, {"x":6, "y":3.25}, {"x":7, "y":3.25}, {"x":8, "y":3.25}, {"x":9, "y":3.25}, {"x":10, "y":3.25}, {"x":11, "y":3.25}, {"x":12, "y":3.25}, {"x":13, "y":3.25}, {"x":14, "y":3.25}, {"x":15, "y":3.25, "w":2.25}, {"x":17.5, "y":3.25}, {"x":18.5, "y":3.25}, {"x":0, "y":4.25}, {"x":1, "y":4.25}, {"x":2.25, "y":4.25, "w":2.25}, {"x":4.5, "y":4.25}, {"x":5.5, "y":4.25}, {"x":6.5, "y":4.25}, {"x":7.5, "y":4.25}, {"x":8.5, "y":4.25}, {"x":9.5, "y":4.25}, {"x":10.5, "y":4.25}, {"x":11.5, "y":4.25}, {"x":12.5, "y":4.25}, {"x":13.5, "y":4.25}, {"x":14.5, "y":4.25, "w":2.75}, {"x":17.5, "y":4.5}, {"x":0, "y":5.25}, {"x":1, "y":5.25}, {"x":2.25, "y":5.25, "w":1.5}, {"x":3.75, "y":5.25}, {"x":4.75, "y":5.25, "w":1.5}, {"x":6.25, "y":5.25, "w":6}, {"x":12.25, "y":5.25, "w":1.5}, {"x":13.75, "y":5.25}, {"x":14.75, "y":5.25, "w":1.5}, {"x":16.5, "y":5.5}, {"x":17.5, "y":5.5}, {"x":18.5, "y":5.5}]
12 }
13 }
14}
diff --git a/keyboards/duck/tcv3/keymaps/default/keymap.c b/keyboards/duck/tcv3/keymaps/default/keymap.c
new file mode 100644
index 000000000..a7dfdddf6
--- /dev/null
+++ b/keyboards/duck/tcv3/keymaps/default/keymap.c
@@ -0,0 +1,37 @@
1/* Copyright 2019 MechMerlin <[email protected]>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include QMK_KEYBOARD_H
17
18#define _BL 0 // Base Layer
19#define _FL 1 // Fn Layer
20
21const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
22 [_BL] = LAYOUT(
23 KC_F1, KC_F2, KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_PAUS,
24 KC_F3, KC_F4, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_DEL,
25 KC_F5, KC_F6, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_HOME, KC_END,
26 KC_F7, KC_F8, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, KC_PGDN,
27 KC_F9, KC_F10, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
28 KC_F11, KC_F12, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(_FL), KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
29
30 [_FL] = LAYOUT(
31 KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_MOD, RGB_VAI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
32 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
33 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
34 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
35 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
36 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
37}; \ No newline at end of file
diff --git a/keyboards/duck/tcv3/keymaps/default/readme.md b/keyboards/duck/tcv3/keymaps/default/readme.md
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/keyboards/duck/tcv3/keymaps/default/readme.md
diff --git a/keyboards/duck/tcv3/keymaps/via/config.h b/keyboards/duck/tcv3/keymaps/via/config.h
new file mode 100644
index 000000000..1f4e07e39
--- /dev/null
+++ b/keyboards/duck/tcv3/keymaps/via/config.h
@@ -0,0 +1 @@
#define DYNAMIC_KEYMAP_LAYER_COUNT 3 \ No newline at end of file
diff --git a/keyboards/duck/tcv3/keymaps/via/keymap.c b/keyboards/duck/tcv3/keymaps/via/keymap.c
new file mode 100644
index 000000000..925e1b208
--- /dev/null
+++ b/keyboards/duck/tcv3/keymaps/via/keymap.c
@@ -0,0 +1,42 @@
1/* Copyright 2019 MechMerlin <[email protected]>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include QMK_KEYBOARD_H
17
18const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
19 [0] = LAYOUT(
20 KC_F1, KC_F2, KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_PAUS,
21 KC_F3, KC_F4, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_DEL,
22 KC_F5, KC_F6, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_HOME, KC_END,
23 KC_F7, KC_F8, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, KC_PGDN,
24 KC_F9, KC_F10, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
25 KC_F11, KC_F12, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
26
27 [1] = LAYOUT(
28 KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_MOD, RGB_VAI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
29 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
30 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
31 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
32 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
33 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
34
35 [2] = LAYOUT(
36 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
37 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
38 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
39 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
40 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
41 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
42}; \ No newline at end of file
diff --git a/keyboards/duck/tcv3/keymaps/via/rules.mk b/keyboards/duck/tcv3/keymaps/via/rules.mk
new file mode 100644
index 000000000..36b7ba9cb
--- /dev/null
+++ b/keyboards/duck/tcv3/keymaps/via/rules.mk
@@ -0,0 +1,2 @@
1VIA_ENABLE = yes
2LTO_ENABLE = yes
diff --git a/keyboards/duck/tcv3/matrix.c b/keyboards/duck/tcv3/matrix.c
new file mode 100644
index 000000000..d2d90470a
--- /dev/null
+++ b/keyboards/duck/tcv3/matrix.c
@@ -0,0 +1,280 @@
1/*
2Copyright 2019 MechMerlin <[email protected]>
3This program is free software: you can redistribute it and/or modify
4it under the terms of the GNU General Public License as published by
5the Free Software Foundation, either version 2 of the License, or
6(at your option) any later version.
7
8This program is distributed in the hope that it will be useful,
9but WITHOUT ANY WARRANTY; without even the implied warranty of
10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License
14along 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
25static uint8_t debouncing = DEBOUNCE;
26
27/* matrix state(1:on, 0:off) */
28static matrix_row_t matrix[MATRIX_ROWS];
29static matrix_row_t matrix_debouncing[MATRIX_ROWS];
30
31static uint8_t read_rows(uint8_t col);
32static void init_rows(void);
33static void unselect_cols(void);
34static void select_col(uint8_t col);
35
36
37__attribute__ ((weak))
38void matrix_init_kb(void) {
39 matrix_init_user();
40}
41
42__attribute__ ((weak))
43void matrix_scan_kb(void) {
44 matrix_scan_user();
45}
46
47__attribute__ ((weak))
48void matrix_init_user(void) {
49}
50
51__attribute__ ((weak))
52void matrix_scan_user(void) {
53}
54
55void 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
67void 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
80uint8_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
115inline matrix_row_t matrix_get_row(uint8_t row) {
116 return matrix[row];
117}
118
119void matrix_print(void) {
120 print("\nr/c 0123456789ABCDEF\n");
121 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
122 xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row)));
123 }
124}
125/* Row pin configuration
126 * row: 0 1 2 3 4 5
127 * pin: PB7 PD0 PD1 PD2 PD3 PD5
128 *
129 * Reset Key uses its own pin PE2
130 */
131static void init_rows(void) {
132 DDRD &= ~0b00101111;
133 PORTD &= ~0b00101111;
134
135 DDRB &= ~0b10000000;
136 PORTB &= ~0b10000000;
137
138 DDRE &= ~0b00000100;
139 PORTE |= 0b00000100;
140}
141
142static uint8_t read_rows(uint8_t col) {
143 if (col == 19) {
144 return PINE&(1<<2) ? 0 : (1<<0);
145 } else {
146 return (PIND&(1<<0) ? (1<<1) : 0) |
147 (PIND&(1<<1) ? (1<<2) : 0) |
148 (PIND&(1<<2) ? (1<<3) : 0) |
149 (PIND&(1<<3) ? (1<<4) : 0) |
150 (PIND&(1<<5) ? (1<<5) : 0) |
151 (PINB&(1<<7) ? (1<<0) : 0);
152 }
153}
154
155
156/* Columns 0 - G
157 * These columns uses two 74HC237D 3 to 8 bit demultiplexers.
158 *
159 * atmega32u4 decoder pin
160 * C6 U1 E2
161 * B6 U2 E2
162 * F0 U1, U2 A0
163 * F1 U1, U2 A1
164 * C7 U1, U2 A2
165 *
166 * col 0: B4
167 * col 1: D7
168 * col I: B5
169 *
170 * col / pin: PC6 PB6 PF0 PF1 PC7 Decoder Pin
171 * 2: 1 0 0 0 0 U1 Y0
172 * 3: 1 0 1 0 0 U1 Y1
173 * 4: 1 0 0 1 0 U1 Y2
174 * 5: 1 0 1 1 0 U1 Y3
175 * 6: 1 0 0 0 1 U1 Y4
176 * 7: 1 0 1 0 1 U1 Y5
177 * 8: 1 0 0 1 1 U1 Y6
178 * 9: 1 0 1 1 1 U1 Y7
179 * A: 0 1 0 0 0 U2 Y0
180 * B: 0 1 1 0 0 U2 Y1
181 * C: 0 1 0 1 0 U2 Y2
182 * D: 0 1 1 1 0 U2 Y3
183 * E: 0 1 0 0 1 U2 Y4
184 * F: 0 1 1 0 1 U2 Y5
185 * G: 0 1 0 1 1 U2 Y6
186 * H: 0 1 1 1 1 U2 Y7
187 *
188 */
189static void unselect_cols(void) {
190 DDRB |= 0b01110000;
191 PORTB &= ~0b01110000;
192
193 DDRC |= 0b11000000;
194 PORTC &= ~0b11000000;
195
196 DDRD |= 0b10000000;
197 PORTD &= ~0b10000000;
198
199 DDRF |= 0b00000011;
200 PORTF &= ~0b00000011;
201}
202
203static void select_col(uint8_t col) {
204
205 switch (col) {
206 case 0:
207 PORTB |= 0b00010000;
208 break;
209 case 1:
210 PORTD |= 0b10000000;
211 break;
212 case 2: // U1 Y0
213 PORTC |= 0b01000000;
214 break;
215 case 3: // U1 Y1
216 PORTC |= 0b01000000;
217 PORTF |= 0b00000001;
218 break;
219 case 4: // U1 Y2
220 PORTC |= 0b01000000;
221 PORTF |= 0b00000010;
222 break;
223 case 5: // U1 Y3
224 PORTC |= 0b01000000;
225 PORTF |= 0b00000011;
226 break;
227 case 6: // U1 Y4
228 PORTC |= 0b11000000;
229 break;
230 case 7: // U1 Y5
231 PORTC |= 0b11000000;
232 PORTF |= 0b00000001;
233 break;
234 case 8: // U1 Y6
235 PORTC |= 0b11000000;
236 PORTF |= 0b00000010;
237 break;
238 case 9: // U1 Y7
239 PORTC |= 0b11000000;
240 PORTF |= 0b00000011;
241 break;
242 case 10: // U2 Y0
243 PORTB |= 0b01000000;
244 break;
245 case 11: // U2 Y1
246 PORTB |= 0b01000000;
247 PORTF |= 0b00000001;
248 break;
249 case 12: // U2 Y2
250 PORTB |= 0b01000000;
251 PORTF |= 0b00000010;
252 break;
253 case 13: // U2 Y3
254 PORTB |= 0b01000000;
255 PORTF |= 0b00000011;
256 break;
257 case 14: // U2 Y4
258 PORTB |= 0b01000000;
259 PORTC |= 0b10000000;
260 break;
261 case 15: // U2 Y5
262 PORTB |= 0b01000000;
263 PORTC |= 0b10000000;
264 PORTF |= 0b00000001;
265 break;
266 case 16: // U2 Y6
267 PORTB |= 0b01000000;
268 PORTC |= 0b10000000;
269 PORTF |= 0b00000010;
270 break;
271 case 17: // U2 Y7
272 PORTB |= 0b01000000;
273 PORTC |= 0b10000000;
274 PORTF |= 0b00000011;
275 break;
276 case 18:
277 PORTB |= 0b00100000;
278 break;
279 }
280} \ No newline at end of file
diff --git a/keyboards/duck/tcv3/readme.md b/keyboards/duck/tcv3/readme.md
new file mode 100644
index 000000000..79fb14bd1
--- /dev/null
+++ b/keyboards/duck/tcv3/readme.md
@@ -0,0 +1,27 @@
1# Duck TC-V3
2
3Non official firmware for custom Korean keyboard made by Duck.
4Group buy was run April 2018 via [geekhack](https://geekhack.org/index.php?topic=95335.0).
5
6* Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin)
7* Hardware Supported: Duck TC-V3 ver 1.0 PCB, Atmega32u4, 74HC237D
8* Hardware Availability: Wait until GB of the next revision
9
10Make example for this keyboard (after setting up your build environment):
11
12 make duck/tcv3:default
13
14**Reset Key:** To put the TC-V3 into reset, hold the top second most right key (`K0J`) while plugging in.
15
16**CAUTION:** At this time 02/28/20 backlighting has not been tested fully and may not properly work.
17
18See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
19
20## Hardware Notes
21
22The Duck TC-V3 PCB consists of:
23
24### Microchips
25* 2 74HC237D 3-to-8 line decoders
26* 1 Atmega32u4 microcontroller
27* 3 WS2811 LED controller
diff --git a/keyboards/duck/tcv3/rules.mk b/keyboards/duck/tcv3/rules.mk
new file mode 100644
index 000000000..3fef0ce54
--- /dev/null
+++ b/keyboards/duck/tcv3/rules.mk
@@ -0,0 +1,22 @@
1# MCU name
2MCU = atmega32u4
3
4# Bootloader selection
5BOOTLOADER = atmel-dfu
6
7# Build Options
8# change yes to no to disable
9#
10BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
11MOUSEKEY_ENABLE = no # Mouse keys
12EXTRAKEY_ENABLE = no # Audio control and System control
13CONSOLE_ENABLE = no # Console for debug
14COMMAND_ENABLE = yes # Commands for debug and configuration
15NKRO_ENABLE = yes # Enable N-Key Rollover
16BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
17AUDIO_ENABLE = no # Audio output
18RGBLIGHT_ENABLE = yes
19
20CUSTOM_MATRIX = yes
21SRC += indicator_leds.c \
22 matrix.c duck_led/duck_led.c
diff --git a/keyboards/duck/tcv3/tcv3.c b/keyboards/duck/tcv3/tcv3.c
new file mode 100644
index 000000000..4d52d22c1
--- /dev/null
+++ b/keyboards/duck/tcv3/tcv3.c
@@ -0,0 +1,130 @@
1/* Copyright 2019 MechMerlin <[email protected]>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include "tcv3.h"
17#include "indicator_leds.h"
18
19enum BACKLIGHT_AREAS {
20 BACKLIGHT_ALPHA = 0b0000001,
21 BACKLIGHT_FROW = 0b0000010,
22 BACKLIGHT_MOD = 0b0000100,
23 BACKLIGHT_MACRO = 0b0001000,
24 BACKLIGHT_SWITCH = 0b0001111
25};
26
27// uint8_t backlight_rgb_r = 255;
28// uint8_t backlight_rgb_g = 0;
29// uint8_t backlight_rgb_b = 0;
30// uint8_t backlight_os_state = 0;
31// uint32_t backlight_layer_state = 0;
32
33// void backlight_toggle_rgb(bool enabled)
34// {
35// if(enabled) {
36// uint8_t rgb[17][3] = {
37// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
38// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
39// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
40// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
41// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
42// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
43// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
44// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
45// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
46// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
47// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
48// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
49// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
50// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
51// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
52// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
53// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}
54// };
55// backlight_set_rgb(rgb);
56// } else {
57// uint8_t rgb[17][3] = {
58// {0, 0, 0},
59// {0, 0, 0},
60// {0, 0, 0},
61// {0, 0, 0},
62// {0, 0, 0},
63// {0, 0, 0},
64// {0, 0, 0},
65// {0, 0, 0},
66// {0, 0, 0},
67// {0, 0, 0},
68// {0, 0, 0},
69// {0, 0, 0},
70// {0, 0, 0},
71// {0, 0, 0},
72// {0, 0, 0},
73// {0, 0, 0},
74// {0, 0, 0}
75// };
76// backlight_set_rgb(rgb);
77// }
78// }
79
80// void backlight_set_rgb(uint8_t cfg[17][3])
81// {
82// cli();
83// for(uint8_t i = 0; i < 17; ++i) {
84// send_color(cfg[i][0], cfg[i][1], cfg[i][2], Device_PCBRGB);
85// }
86// sei();
87// show();
88// }
89
90// Q5, Q6, Q7 is connected to B1 - alphas
91// Q8, Q9 is connected to B2 - frow
92// Q1, Q2, Q3 is connected to B3 - mods
93// Q4 is connected to E6 - macro keys
94
95void backlight_set(uint8_t level) {
96 level & BACKLIGHT_ALPHA ? (PORTB |= 0b00000010) : (PORTB &= ~0b00000010);
97 level & BACKLIGHT_FROW ? (PORTB |= 0b00000100) : (PORTB &= ~0b00000100);
98 level & BACKLIGHT_MOD ? (PORTB |= 0b00001000) : (PORTB &= ~0b00001000);
99 level & BACKLIGHT_MACRO ? (PORTE |= 0b01000000) : (PORTE &= ~0b01000000);
100}
101
102// // Port from backlight_update_state
103// void led_set_kb(uint8_t usb_led) {
104// bool status[7] = {
105// backlight_os_state & (1<<USB_LED_CAPS_LOCK),
106// backlight_os_state & (1<<USB_LED_SCROLL_LOCK),
107// backlight_os_state & (1<<USB_LED_NUM_LOCK),
108// backlight_layer_state & (1<<1),
109// backlight_layer_state & (1<<2),
110// backlight_layer_state & (1<<3),
111// backlight_layer_state & (1<<4)
112// };
113// indicator_leds_set(status);
114// backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
115// backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
116// }
117
118// U5 Pin 1, 2, 3 connected to top left LEDs
119
120// U6 Pin 1, 2, 3 connected to bottom right leds col of 3
121// U7 Pin 1 connected to row connected to bottom right leds solo LED
122// U7 Pin 2, 3 connected to bottom right leds row of 2
123// U6 Pin 5 connected to U7 Pin 6
124
125// U5 pin 5 connected to U6 Pin 6
126
127// U5, U6, U7 Pin 8 VCC
128// U5, U6, U7 Pin 4 GRND
129
130// U5 Pin 6 connected to atmega32u4 D4
diff --git a/keyboards/duck/tcv3/tcv3.h b/keyboards/duck/tcv3/tcv3.h
new file mode 100644
index 000000000..8e40e94ae
--- /dev/null
+++ b/keyboards/duck/tcv3/tcv3.h
@@ -0,0 +1,53 @@
1/* Copyright 2019 MechMerlin <[email protected]>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#include "quantum.h"
19
20#define XXX KC_NO
21
22#define LAYOUT_all( \
23 K00, K01, K02, K04, K05, K06, K07, K09, K0A, K0B, K0C, K0D, K0E, K0F, K0G, K0J, K0I, \
24 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, \
25 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, K2G, K2H, K2I, \
26 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, K3G, K3H, K3I, \
27 K40, K41, K42, k43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4E, K4F, K4G, K4H, \
28 K50, K51, K52, K53, K54, K5A, K5C, K5E, K5F, K5G, K5H, K5I \
29) { \
30 { K00, K01, K02, XXX, K04, K05, K06, K07, XXX, K09, K0A, K0B, K0C, K0D, K0E, K0F, K0G, XXX, K0I, K0J }, \
31 { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, XXX }, \
32 { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, XXX, K2G, K2H, K2I, XXX }, \
33 { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, XXX, K3G, K3H, K3I, XXX }, \
34 { K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, XXX, K4E, K4F, K4G, K4H, XXX, XXX }, \
35 { K50, K51, K52, K53, K54, XXX, XXX, XXX, XXX, XXX, K5A, XXX, K5C, XXX, K5E, K5F, K5G, K5H, K5I, XXX }, \
36}
37
38
39#define LAYOUT( \
40 K00, K01, K02, K04, K05, K06, K07, K09, K0A, K0B, K0C, K0D, K0E, K0F, K0G, K0J, K0I, \
41 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1G, K1H, K1I, \
42 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, K2G, K2H, K2I, \
43 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3G, K3H, K3I, \
44 K40, K41, K42, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4E, K4F, K4H, \
45 K50, K51, K52, K53, K54, K5A, K5C, K5E, K5F, K5G, K5H, K5I \
46) { \
47 { K00, K01, K02, XXX, K04, K05, K06, K07, XXX, K09, K0A, K0B, K0C, K0D, K0E, K0F, K0G, XXX, K0I, K0J }, \
48 { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, XXX, K1G, K1H, K1I, XXX }, \
49 { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, XXX, K2G, K2H, K2I, XXX }, \
50 { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, XXX, XXX, K3G, K3H, K3I, XXX }, \
51 { K40, K41, K42, XXX, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, XXX, K4E, K4F, XXX, K4H, XXX, XXX }, \
52 { K50, K51, K52, K53, K54, XXX, XXX, XXX, XXX, XXX, K5A, XXX, K5C, XXX, K5E, K5F, K5G, K5H, K5I, XXX }, \
53}