From 680924777be7739b249bf0dc3b60a3185134bc94 Mon Sep 17 00:00:00 2001 From: Joule-Flow Date: Mon, 2 Dec 2019 20:47:55 +0100 Subject: [PATCH] [Keyboard] Added tr60w keyboard (#7450) * Added tr60w configurations. I based these files on the fox-lab/qmk_firmware repository. After checking both licenses, which are identical, I added those files into this feature branch. For transparency reasons I'll add the url to the fox-lab repository. https://github.com/fox-lab/qmk_firmware * Using #pragma once in config.h. * Removed '#define CCONFIG_H' from config.h. * Changed PRODUCT_ID to '0x4140'. * Renamed setting to 'DEBOUNCE'. * Removed key combination, due to already default implementation. * Removed 'PREVENT_STUCK_MODIFIERS', defaulted by QMK. * Removed not uneccessary '#endif' statement. * Renamed include to 'QMK_KEYBOARD_H'. * Changed keymap structure according to pull request suggestion. * Removed 'void matrix_init_user(void)'. * Removed 'void matrix_scan_user(void)'. * Removed 'bool process_record_user(...)'. * Removed non-standard configuration in favor for 'led_update_kb'. * Using default setup based on 'MCU' setting. * Replaced Build Option configuration with suggested information. * Fixed include statements as requested. * Changed 'KEYMAP' to suggestion. * Removed obsolete '#endif' statement. * Added readme.md file. * Updated readme.md with further information. * Reverted include statement, to check if this caused ci error. * Revert "Reverted include statement." This reverts commit ebd992dc01133169be38ae7201bb00b4d01cc737. * Fixed wrong mapped key * Fixed include as per suggestion. * Replaced 'KC_TRNS' with '_______'for readability. * Added personal keymap.c file. * Updated the readme.md file according to template/avr/readme.md. * Fixed Link to Image. * Updated readme.md as per request. * Updated rules.mk, as per suggestion. Set 'BOOTMAGIC_ENABLE = lite'. --- keyboards/tr60w/config.h | 47 +++++++++++++++++++++ keyboards/tr60w/keymaps/default/keymap.c | 20 +++++++++ keyboards/tr60w/keymaps/joule-flow/keymap.c | 21 +++++++++ keyboards/tr60w/readme.md | 19 +++++++++ keyboards/tr60w/rules.mk | 32 ++++++++++++++ keyboards/tr60w/tr60w.c | 11 +++++ keyboards/tr60w/tr60w.h | 18 ++++++++ 7 files changed, 168 insertions(+) create mode 100644 keyboards/tr60w/config.h create mode 100644 keyboards/tr60w/keymaps/default/keymap.c create mode 100644 keyboards/tr60w/keymaps/joule-flow/keymap.c create mode 100644 keyboards/tr60w/readme.md create mode 100644 keyboards/tr60w/rules.mk create mode 100644 keyboards/tr60w/tr60w.c create mode 100644 keyboards/tr60w/tr60w.h diff --git a/keyboards/tr60w/config.h b/keyboards/tr60w/config.h new file mode 100644 index 000000000..2196e6c53 --- /dev/null +++ b/keyboards/tr60w/config.h @@ -0,0 +1,47 @@ +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x4140 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Triangle_Lab +#define PRODUCT TR60W +#define DESCRIPTION Keyboard + +/* key matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 14 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { D0, D1, B1, B2, E6, B3 } +#define MATRIX_COL_PINS { F5, F4, F1, F0, B0, D5, D3, D6, D7, B4, B5, B6, C6, D2 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* number of backlight levels */ +#define BACKLIGHT_PIN B7 +#ifdef BACKLIGHT_PIN +#define BACKLIGHT_LEVELS 3 +#endif + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE + +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +#define RGB_DI_PIN F7 +#ifdef RGB_DI_PIN +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 4 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 +#endif diff --git a/keyboards/tr60w/keymaps/default/keymap.c b/keyboards/tr60w/keymaps/default/keymap.c new file mode 100644 index 000000000..86bfbb566 --- /dev/null +++ b/keyboards/tr60w/keymaps/default/keymap.c @@ -0,0 +1,20 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + LAYOUT_60_tsangan_hhkb( + KC_ESC, 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_BSLS, KC_GRV, + 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_BSPC, + 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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_LSFT, LT(1,KC_GRV), + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL + ), + + LAYOUT_60_tsangan_hhkb( + RESET, 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_UP, _______, KC_DEL, + _______, _______, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, KC_LEFT, KC_RGHT, _______, + _______, _______, _______, BL_TOGG, BL_DEC, BL_INC, BL_STEP, _______, _______, _______, KC_DOWN, _______, _______, + _______, _______, _______, _______, _______, _______, _______ + ) +}; diff --git a/keyboards/tr60w/keymaps/joule-flow/keymap.c b/keyboards/tr60w/keymaps/joule-flow/keymap.c new file mode 100644 index 000000000..bfe0db0d5 --- /dev/null +++ b/keyboards/tr60w/keymaps/joule-flow/keymap.c @@ -0,0 +1,21 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + LAYOUT_60_tsangan_hhkb( + KC_ESC, 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_BSLS, KC_GRV, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Z, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, + 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_LSFT, KC_Y, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_MINS, KC_LSFT, TG(1), + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_F12, KC_RCTL + ), + + LAYOUT_60_tsangan_hhkb( + RESET, 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_NUHS, KC_NUBS, + _______, KC_BSPC, KC_UP, KC_ENT, _______, _______, _______, KC_WH_U, KC_BTN1 , KC_MS_U , KC_BTN2, KC_WH_L, _______, KC_DEL, + _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, _______, KC_WH_D, KC_MS_L , KC_MS_D , KC_MS_R, KC_WH_R, _______, + _______, RCTL(KC_Y), RCTL(KC_X), RCTL(KC_C), RCTL(KC_V), _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______ + ) + +}; diff --git a/keyboards/tr60w/readme.md b/keyboards/tr60w/readme.md new file mode 100644 index 000000000..9053b4db6 --- /dev/null +++ b/keyboards/tr60w/readme.md @@ -0,0 +1,19 @@ +# TR60W + +![TR60W](https://i.imgur.com/Ez2T2Te.jpg) + +This is the hotswap PCB supplied by Triangle Labs with their TR60 case, featuring four RGB LEDs around the Escape key, USB-C, and SMD single-color backlighting. + +* Keyboard Maintainer: [Joule-Flow](https://github.com/Joule-Flow) +* Hardware Supported: TR60W PCB, ATmega32U4 +* Hardware Availability: Group-buy by [Triangle Labs](https://geekhack.org/index.php?topic=96378.0) + +Make example for this keyboard (after setting up your build environment): + + make tr60w:default + +Or use my personal settings: + + make tr60w:joule-flow + +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/tr60w/rules.mk b/keyboards/tr60w/rules.mk new file mode 100644 index 000000000..4b68e6c7f --- /dev/null +++ b/keyboards/tr60w/rules.mk @@ -0,0 +1,32 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +MIDI_ENABLE = no # MIDI support +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 +FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches +HD44780_ENABLE = no # Enable support for HD44780 based LCDs diff --git a/keyboards/tr60w/tr60w.c b/keyboards/tr60w/tr60w.c new file mode 100644 index 000000000..83547a886 --- /dev/null +++ b/keyboards/tr60w/tr60w.c @@ -0,0 +1,11 @@ +#include "tr60w.h" + +bool led_update_kb(led_t led_state) { + bool runDefault = led_update_user(led_state); + if (runDefault) { + writePin(B1, !led_state.num_lock); + writePin(B2, !led_state.caps_lock); + writePin(B3, !led_state.scroll_lock); + } + return runDefault; +} diff --git a/keyboards/tr60w/tr60w.h b/keyboards/tr60w/tr60w.h new file mode 100644 index 000000000..9fa5d5b61 --- /dev/null +++ b/keyboards/tr60w/tr60w.h @@ -0,0 +1,18 @@ +#pragma once + +#include "quantum.h" + +#define LAYOUT_60_tsangan_hhkb( \ + K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K113, \ + K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K213, \ + K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, \ + K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, \ + K400, K401, K402, K505, K510, K511, K512 \ +) { \ + { K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013 }, \ + { K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113 }, \ + { K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213 }, \ + { K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, KC_NO }, \ + { K400, K401, K402, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K505, KC_NO, KC_NO, KC_NO, KC_NO, K510, K511, K512, KC_NO } \ +}