diff options
| author | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2020-06-02 21:59:13 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-02 21:59:13 -0700 |
| commit | be73820f7bc4f03e3d095b694f31092187583ac7 (patch) | |
| tree | 00169335671348f97b4126a4c8165620e8c88ca5 /keyboards/duck | |
| parent | 81a2113cbd820151c1529bebd0bc71629d2de66e (diff) | |
| download | qmk_firmware-be73820f7bc4f03e3d095b694f31092187583ac7.tar.gz qmk_firmware-be73820f7bc4f03e3d095b694f31092187583ac7.zip | |
[Keyboard] New Keyboard: Duck TC-V3 (#8265)
Co-Authored-By: Ryan <fauxpark@gmail.com>
Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com>
Co-Authored-By: Drashna Jaelre <drashna@live.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Joel Challis <git@zvecr.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
Diffstat (limited to 'keyboards/duck')
| -rw-r--r-- | keyboards/duck/readme.md | 3 | ||||
| -rw-r--r-- | keyboards/duck/tcv3/config.h | 45 | ||||
| -rw-r--r-- | keyboards/duck/tcv3/indicator_leds.c | 123 | ||||
| -rw-r--r-- | keyboards/duck/tcv3/indicator_leds.h | 7 | ||||
| -rw-r--r-- | keyboards/duck/tcv3/info.json | 16 | ||||
| -rw-r--r-- | keyboards/duck/tcv3/keymaps/default/keymap.c | 37 | ||||
| -rw-r--r-- | keyboards/duck/tcv3/keymaps/default/readme.md | 0 | ||||
| -rw-r--r-- | keyboards/duck/tcv3/keymaps/via/config.h | 1 | ||||
| -rw-r--r-- | keyboards/duck/tcv3/keymaps/via/keymap.c | 42 | ||||
| -rw-r--r-- | keyboards/duck/tcv3/keymaps/via/rules.mk | 2 | ||||
| -rw-r--r-- | keyboards/duck/tcv3/matrix.c | 272 | ||||
| -rw-r--r-- | keyboards/duck/tcv3/readme.md | 27 | ||||
| -rw-r--r-- | keyboards/duck/tcv3/rules.mk | 36 | ||||
| -rw-r--r-- | keyboards/duck/tcv3/tcv3.c | 134 | ||||
| -rw-r--r-- | keyboards/duck/tcv3/tcv3.h | 53 |
15 files changed, 797 insertions, 1 deletions
diff --git a/keyboards/duck/readme.md b/keyboards/duck/readme.md index 32076da7d..f5f6593b5 100644 --- a/keyboards/duck/readme.md +++ b/keyboards/duck/readme.md | |||
| @@ -14,4 +14,5 @@ Lightsaver V3 | |||
| 14 | Octagon V1 | 14 | Octagon V1 |
| 15 | Octagon V2 | 15 | Octagon V2 |
| 16 | Orion V3 | 16 | Orion V3 |
| 17 | Viper V2 \ No newline at end of file | 17 | TC-V3 |
| 18 | Viper V2 | ||
diff --git a/keyboards/duck/tcv3/config.h b/keyboards/duck/tcv3/config.h new file mode 100644 index 000000000..524b12b83 --- /dev/null +++ b/keyboards/duck/tcv3/config.h | |||
| @@ -0,0 +1,45 @@ | |||
| 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 0x5443 // TC-V3 ("TC") | ||
| 25 | #define DEVICE_VER 0x0001 | ||
| 26 | #define MANUFACTURER Duck | ||
| 27 | #define PRODUCT TC-V3 | ||
| 28 | #define DESCRIPTION Duck TC-V3 | ||
| 29 | |||
| 30 | /* key matrix size */ | ||
| 31 | #define MATRIX_ROWS 6 | ||
| 32 | #define MATRIX_COLS 20 | ||
| 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 | #define RGBLIGHT_ANIMATIONS | ||
| 40 | #define RGB_DI_PIN D6 | ||
| 41 | #define RGBLED_NUM 17 | ||
| 42 | |||
| 43 | /* Set to top left most key */ | ||
| 44 | #define BOOTMAGIC_LITE_ROW 5 | ||
| 45 | #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 | /* | ||
| 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 | |||
| 23 | #define LED_T1H 900 | ||
| 24 | #define LED_T1L 600 | ||
| 25 | #define LED_T0H 400 | ||
| 26 | #define LED_T0L 900 | ||
| 27 | |||
| 28 | void send_bit_d4(bool bitVal) { | ||
| 29 | if(bitVal) { | ||
| 30 | asm volatile ( | ||
| 31 | "sbi %[port], %[bit] \n\t" | ||
| 32 | ".rept %[onCycles] \n\t" | ||
| 33 | "nop \n\t" | ||
| 34 | ".endr \n\t" | ||
| 35 | "cbi %[port], %[bit] \n\t" | ||
| 36 | ".rept %[offCycles] \n\t" | ||
| 37 | "nop \n\t" | ||
| 38 | ".endr \n\t" | ||
| 39 | :: | ||
| 40 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
| 41 | [bit] "I" (4), | ||
| 42 | [onCycles] "I" (NS_TO_CYCLES(LED_T1H) - 2), | ||
| 43 | [offCycles] "I" (NS_TO_CYCLES(LED_T1L) - 2)); | ||
| 44 | } else { | ||
| 45 | asm volatile ( | ||
| 46 | "sbi %[port], %[bit] \n\t" | ||
| 47 | ".rept %[onCycles] \n\t" | ||
| 48 | "nop \n\t" | ||
| 49 | ".endr \n\t" | ||
| 50 | "cbi %[port], %[bit] \n\t" | ||
| 51 | ".rept %[offCycles] \n\t" | ||
| 52 | "nop \n\t" | ||
| 53 | ".endr \n\t" | ||
| 54 | :: | ||
| 55 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
| 56 | [bit] "I" (4), | ||
| 57 | [onCycles] "I" (NS_TO_CYCLES(LED_T0H) - 2), | ||
| 58 | [offCycles] "I" (NS_TO_CYCLES(LED_T0L) - 2)); | ||
| 59 | } | ||
| 60 | } | ||
| 61 | |||
| 62 | void send_bit_d6(bool bitVal) | ||
| 63 | { | ||
| 64 | if(bitVal) { | ||
| 65 | asm volatile ( | ||
| 66 | "sbi %[port], %[bit] \n\t" | ||
| 67 | ".rept %[onCycles] \n\t" | ||
| 68 | "nop \n\t" | ||
| 69 | ".endr \n\t" | ||
| 70 | "cbi %[port], %[bit] \n\t" | ||
| 71 | ".rept %[offCycles] \n\t" | ||
| 72 | "nop \n\t" | ||
| 73 | ".endr \n\t" | ||
| 74 | :: | ||
| 75 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
| 76 | [bit] "I" (6), | ||
| 77 | [onCycles] "I" (NS_TO_CYCLES(LED_T1H) - 2), | ||
| 78 | [offCycles] "I" (NS_TO_CYCLES(LED_T1L) - 2)); | ||
| 79 | } else { | ||
| 80 | asm volatile ( | ||
| 81 | "sbi %[port], %[bit] \n\t" | ||
| 82 | ".rept %[onCycles] \n\t" | ||
| 83 | "nop \n\t" | ||
| 84 | ".endr \n\t" | ||
| 85 | "cbi %[port], %[bit] \n\t" | ||
| 86 | ".rept %[offCycles] \n\t" | ||
| 87 | "nop \n\t" | ||
| 88 | ".endr \n\t" | ||
| 89 | :: | ||
| 90 | [port] "I" (_SFR_IO_ADDR(PORTD)), | ||
| 91 | [bit] "I" (6), | ||
| 92 | [onCycles] "I" (NS_TO_CYCLES(LED_T0H) - 2), | ||
| 93 | [offCycles] "I" (NS_TO_CYCLES(LED_T0L) - 2)); | ||
| 94 | } | ||
| 95 | } | ||
| 96 | |||
| 97 | void send_value(uint8_t byte, enum Device device) { | ||
| 98 | for(uint8_t b = 0; b < 8; b++) { | ||
| 99 | if(device == Device_STATUSLED) { | ||
| 100 | send_bit_d4(byte & 0b10000000); | ||
| 101 | } | ||
| 102 | if(device == Device_PCBRGB) { | ||
| 103 | send_bit_d6(byte & 0b10000000); | ||
| 104 | } | ||
| 105 | byte <<= 1; | ||
| 106 | } | ||
| 107 | } | ||
| 108 | |||
| 109 | void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device) { | ||
| 110 | send_value(r, device); | ||
| 111 | send_value(g, device); | ||
| 112 | send_value(b, device); | ||
| 113 | } | ||
| 114 | |||
| 115 | // Port from backlight_set_state | ||
| 116 | void indicator_leds_set(bool leds[8]) { | ||
| 117 | cli(); | ||
| 118 | send_color(leds[1] ? 255 : 0, leds[2] ? 255 : 0, leds[0] ? 255 : 0, Device_STATUSLED); | ||
| 119 | send_color(leds[4] ? 255 : 0, leds[3] ? 255 : 0, leds[5] ? 255 : 0, Device_STATUSLED); | ||
| 120 | leds[6] ? (PORTD &= ~0b10000000) : (PORTD |= 0b10000000); | ||
| 121 | sei(); | ||
| 122 | show(); | ||
| 123 | } | ||
diff --git a/keyboards/duck/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 | |||
| 3 | void indicator_leds_set(bool leds[8]); | ||
| 4 | void backlight_toggle_rgb(bool enabled); | ||
| 5 | void backlight_set_rgb(uint8_t cfg[17][3]); | ||
| 6 | void backlight_init_ports(void); | ||
| 7 | void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device); | ||
diff --git a/keyboards/duck/tcv3/info.json b/keyboards/duck/tcv3/info.json new file mode 100644 index 000000000..e93c6b04f --- /dev/null +++ b/keyboards/duck/tcv3/info.json | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | { | ||
| 2 | "keyboard_name": "TCV3", | ||
| 3 | "url": "", | ||
| 4 | "maintainer": "qmk", | ||
| 5 | "width": 19.5, | ||
| 6 | "height": 6.5, | ||
| 7 | "layouts": { | ||
| 8 | "LAYOUT_all": { | ||
| 9 | "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}] | ||
| 10 | }, | ||
| 11 | |||
| 12 | "LAYOUT": { | ||
| 13 | "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}] | ||
| 14 | } | ||
| 15 | } | ||
| 16 | } | ||
diff --git a/keyboards/duck/tcv3/keymaps/default/keymap.c b/keyboards/duck/tcv3/keymaps/default/keymap.c new file mode 100644 index 000000000..3f8e67954 --- /dev/null +++ b/keyboards/duck/tcv3/keymaps/default/keymap.c | |||
| @@ -0,0 +1,37 @@ | |||
| 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 | #define _BL 0 // Base Layer | ||
| 19 | #define _FL 1 // Fn Layer | ||
| 20 | |||
| 21 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 22 | [_BL] = LAYOUT(\ | ||
| 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..ed82d0e12 --- /dev/null +++ b/keyboards/duck/tcv3/keymaps/via/keymap.c | |||
| @@ -0,0 +1,42 @@ | |||
| 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(\ | ||
| 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 @@ | |||
| 1 | VIA_ENABLE = yes | ||
| 2 | LTO_ENABLE = yes | ||
diff --git a/keyboards/duck/tcv3/matrix.c b/keyboards/duck/tcv3/matrix.c new file mode 100644 index 000000000..38bc5c882 --- /dev/null +++ b/keyboards/duck/tcv3/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 | #include "debounce.h" | ||
| 25 | #include "wait.h" | ||
| 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 | debounce_init(MATRIX_ROWS); | ||
| 78 | |||
| 79 | matrix_init_quantum(); | ||
| 80 | } | ||
| 81 | uint8_t matrix_scan(void) { | ||
| 82 | bool changed = false; | ||
| 83 | |||
| 84 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { | ||
| 85 | select_col(col); | ||
| 86 | wait_us(30); | ||
| 87 | |||
| 88 | uint8_t rows = read_rows(col); | ||
| 89 | |||
| 90 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 91 | bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col); | ||
| 92 | bool curr_bit = rows & (1<<row); | ||
| 93 | if (prev_bit != curr_bit) { | ||
| 94 | matrix_debouncing[row] ^= ((matrix_row_t)1<<col); | ||
| 95 | changed = true; | ||
| 96 | } | ||
| 97 | } | ||
| 98 | unselect_cols(); | ||
| 99 | } | ||
| 100 | |||
| 101 | debounce(matrix, matrix_debouncing, MATRIX_ROWS, changed); | ||
| 102 | |||
| 103 | matrix_scan_quantum(); | ||
| 104 | return (uint8_t)changed; | ||
| 105 | } | ||
| 106 | |||
| 107 | inline matrix_row_t matrix_get_row(uint8_t row) { | ||
| 108 | return matrix[row]; | ||
| 109 | } | ||
| 110 | |||
| 111 | void matrix_print(void) { | ||
| 112 | print("\nr/c 0123456789ABCDEF\n"); | ||
| 113 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 114 | xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row))); | ||
| 115 | } | ||
| 116 | } | ||
| 117 | /* Row pin configuration | ||
| 118 | * row: 0 1 2 3 4 5 | ||
| 119 | * pin: PB7 PD0 PD1 PD2 PD3 PD5 | ||
| 120 | * | ||
| 121 | * Reset Key uses its own pin PE2 | ||
| 122 | */ | ||
| 123 | static void init_rows(void) { | ||
| 124 | DDRD &= ~0b00101111; | ||
| 125 | PORTD &= ~0b00101111; | ||
| 126 | |||
| 127 | DDRB &= ~0b10000000; | ||
| 128 | PORTB &= ~0b10000000; | ||
| 129 | |||
| 130 | DDRE &= ~0b00000100; | ||
| 131 | PORTE |= 0b00000100; | ||
| 132 | } | ||
| 133 | |||
| 134 | static uint8_t read_rows(uint8_t col) { | ||
| 135 | if (col == 20) { | ||
| 136 | return PINE&(1<<2) ? 0 : (1<<0); | ||
| 137 | } else { | ||
| 138 | return (PIND&(1<<0) ? (1<<1) : 0) | | ||
| 139 | (PIND&(1<<1) ? (1<<2) : 0) | | ||
| 140 | (PIND&(1<<2) ? (1<<3) : 0) | | ||
| 141 | (PIND&(1<<3) ? (1<<4) : 0) | | ||
| 142 | (PIND&(1<<5) ? (1<<5) : 0) | | ||
| 143 | (PINB&(1<<7) ? (1<<0) : 0); | ||
| 144 | } | ||
| 145 | } | ||
| 146 | |||
| 147 | |||
| 148 | /* Columns 0 - G | ||
| 149 | * These columns uses two 74HC237D 3 to 8 bit demultiplexers. | ||
| 150 | * | ||
| 151 | * atmega32u4 decoder pin | ||
| 152 | * C6 U1 E2 | ||
| 153 | * B6 U2 E2 | ||
| 154 | * F0 U1, U2 A0 | ||
| 155 | * F1 U1, U2 A1 | ||
| 156 | * C7 U1, U2 A2 | ||
| 157 | * | ||
| 158 | * col 0: B4 | ||
| 159 | * col 1: D7 | ||
| 160 | * col I: B5 | ||
| 161 | * | ||
| 162 | * col / pin: PC6 PB6 PF0 PF1 PC7 Decoder Pin | ||
| 163 | * 2: 1 0 0 0 0 U1 Y0 | ||
| 164 | * 3: 1 0 1 0 0 U1 Y1 | ||
| 165 | * 4: 1 0 0 1 0 U1 Y2 | ||
| 166 | * 5: 1 0 1 1 0 U1 Y3 | ||
| 167 | * 6: 1 0 0 0 1 U1 Y4 | ||
| 168 | * 7: 1 0 1 0 1 U1 Y5 | ||
| 169 | * 8: 1 0 0 1 1 U1 Y6 | ||
| 170 | * 9: 1 0 1 1 1 U1 Y7 | ||
| 171 | * A: 0 1 0 0 0 U2 Y0 | ||
| 172 | * B: 0 1 1 0 0 U2 Y1 | ||
| 173 | * C: 0 1 0 1 0 U2 Y2 | ||
| 174 | * D: 0 1 1 1 0 U2 Y3 | ||
| 175 | * E: 0 1 0 0 1 U2 Y4 | ||
| 176 | * F: 0 1 1 0 1 U2 Y5 | ||
| 177 | * G: 0 1 0 1 1 U2 Y6 | ||
| 178 | * H: 0 1 1 1 1 U2 Y7 | ||
| 179 | * | ||
| 180 | */ | ||
| 181 | static void unselect_cols(void) { | ||
| 182 | DDRB |= 0b01110000; | ||
| 183 | PORTB &= ~0b01110000; | ||
| 184 | |||
| 185 | DDRC |= 0b11000000; | ||
| 186 | PORTC &= ~0b11000000; | ||
| 187 | |||
| 188 | DDRD |= 0b10000000; | ||
| 189 | PORTD &= ~0b10000000; | ||
| 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 | PORTB |= 0b00010000; | ||
| 200 | break; | ||
| 201 | case 1: | ||
| 202 | PORTD |= 0b10000000; | ||
| 203 | break; | ||
| 204 | case 2: // U1 Y0 | ||
| 205 | PORTC |= 0b01000000; | ||
| 206 | break; | ||
| 207 | case 3: // U1 Y1 | ||
| 208 | PORTC |= 0b01000000; | ||
| 209 | PORTF |= 0b00000001; | ||
| 210 | break; | ||
| 211 | case 4: // U1 Y2 | ||
| 212 | PORTC |= 0b01000000; | ||
| 213 | PORTF |= 0b00000010; | ||
| 214 | break; | ||
| 215 | case 5: // U1 Y3 | ||
| 216 | PORTC |= 0b01000000; | ||
| 217 | PORTF |= 0b00000011; | ||
| 218 | break; | ||
| 219 | case 6: // U1 Y4 | ||
| 220 | PORTC |= 0b11000000; | ||
| 221 | break; | ||
| 222 | case 7: // U1 Y5 | ||
| 223 | PORTC |= 0b11000000; | ||
| 224 | PORTF |= 0b00000001; | ||
| 225 | break; | ||
| 226 | case 8: // U1 Y6 | ||
| 227 | PORTC |= 0b11000000; | ||
| 228 | PORTF |= 0b00000010; | ||
| 229 | break; | ||
| 230 | case 9: // U1 Y7 | ||
| 231 | PORTC |= 0b11000000; | ||
| 232 | PORTF |= 0b00000011; | ||
| 233 | break; | ||
| 234 | case 10: // U2 Y0 | ||
| 235 | PORTB |= 0b01000000; | ||
| 236 | break; | ||
| 237 | case 11: // U2 Y1 | ||
| 238 | PORTB |= 0b01000000; | ||
| 239 | PORTF |= 0b00000001; | ||
| 240 | break; | ||
| 241 | case 12: // U2 Y2 | ||
| 242 | PORTB |= 0b01000000; | ||
| 243 | PORTF |= 0b00000010; | ||
| 244 | break; | ||
| 245 | case 13: // U2 Y3 | ||
| 246 | PORTB |= 0b01000000; | ||
| 247 | PORTF |= 0b00000011; | ||
| 248 | break; | ||
| 249 | case 14: // U2 Y4 | ||
| 250 | PORTB |= 0b01000000; | ||
| 251 | PORTC |= 0b10000000; | ||
| 252 | break; | ||
| 253 | case 15: // U2 Y5 | ||
| 254 | PORTB |= 0b01000000; | ||
| 255 | PORTC |= 0b10000000; | ||
| 256 | PORTF |= 0b00000001; | ||
| 257 | break; | ||
| 258 | case 16: // U2 Y6 | ||
| 259 | PORTB |= 0b01000000; | ||
| 260 | PORTC |= 0b10000000; | ||
| 261 | PORTF |= 0b00000010; | ||
| 262 | break; | ||
| 263 | case 17: // U2 Y7 | ||
| 264 | PORTB |= 0b01000000; | ||
| 265 | PORTC |= 0b10000000; | ||
| 266 | PORTF |= 0b00000011; | ||
| 267 | break; | ||
| 268 | case 18: | ||
| 269 | PORTB |= 0b00100000; | ||
| 270 | break; | ||
| 271 | } | ||
| 272 | } | ||
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 | |||
| 3 | Non official firmware for custom Korean keyboard made by Duck. | ||
| 4 | Group 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 | |||
| 10 | Make 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 | |||
| 18 | See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. | ||
| 19 | |||
| 20 | ## Hardware Notes | ||
| 21 | |||
| 22 | The 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..a9d0012c0 --- /dev/null +++ b/keyboards/duck/tcv3/rules.mk | |||
| @@ -0,0 +1,36 @@ | |||
| 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 | # Build Options | ||
| 15 | # change yes to no to disable | ||
| 16 | # | ||
| 17 | BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration | ||
| 18 | MOUSEKEY_ENABLE = no # Mouse keys | ||
| 19 | EXTRAKEY_ENABLE = no # Audio control and System control | ||
| 20 | CONSOLE_ENABLE = no # Console for debug | ||
| 21 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
| 22 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 23 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 24 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 25 | NKRO_ENABLE = yes # USB Nkey Rollover | ||
| 26 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 27 | MIDI_ENABLE = no # MIDI support | ||
| 28 | UNICODE_ENABLE = no # Unicode | ||
| 29 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 30 | AUDIO_ENABLE = no # Audio output on port C6 | ||
| 31 | FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches | ||
| 32 | RGBLIGHT_ENABLE = yes | ||
| 33 | |||
| 34 | CUSTOM_MATRIX = yes | ||
| 35 | SRC += indicator_leds.c \ | ||
| 36 | 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..063f55ad3 --- /dev/null +++ b/keyboards/duck/tcv3/tcv3.c | |||
| @@ -0,0 +1,134 @@ | |||
| 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 "tcv3.h" | ||
| 17 | #include "indicator_leds.h" | ||
| 18 | |||
| 19 | enum 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 | |||
| 95 | void 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 | // bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 119 | // return process_record_user(keycode, record); | ||
| 120 | // } | ||
| 121 | |||
| 122 | // U5 Pin 1, 2, 3 connected to top left LEDs | ||
| 123 | |||
| 124 | // U6 Pin 1, 2, 3 connected to bottom right leds col of 3 | ||
| 125 | // U7 Pin 1 connected to row connected to bottom right leds solo LED | ||
| 126 | // U7 Pin 2, 3 connected to bottom right leds row of 2 | ||
| 127 | // U6 Pin 5 connected to U7 Pin 6 | ||
| 128 | |||
| 129 | // U5 pin 5 connected to U6 Pin 6 | ||
| 130 | |||
| 131 | // U5, U6, U7 Pin 8 VCC | ||
| 132 | // U5, U6, U7 Pin 4 GRND | ||
| 133 | |||
| 134 | // U5 Pin 6 connected to atmega32u4 D4 \ No newline at end of file | ||
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 <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 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 | } | ||
