From ee96b7a89dd2de78b9372d3b8ce899757e3190c4 Mon Sep 17 00:00:00 2001 From: Erovia Date: Mon, 14 Jan 2019 09:49:00 +0100 Subject: [PATCH] [Keyboard] Add support for THE50 (#4844) * Add support for THE50 A 50% custom keyboard designed and produced by LazyDesigners * THE50 code-improvement Implement the changes suggested by noroadsleft. --- keyboards/lazydesigners/the50/config.h | 49 ++++++++++++++ keyboards/lazydesigners/the50/info.json | 67 +++++++++++++++++++ .../the50/keymaps/default/keymap.c | 59 ++++++++++++++++ .../the50/keymaps/default/readme.md | 31 +++++++++ keyboards/lazydesigners/the50/readme.md | 17 +++++ keyboards/lazydesigners/the50/rules.mk | 52 ++++++++++++++ keyboards/lazydesigners/the50/the50.c | 9 +++ keyboards/lazydesigners/the50/the50.h | 32 +++++++++ 8 files changed, 316 insertions(+) create mode 100644 keyboards/lazydesigners/the50/config.h create mode 100644 keyboards/lazydesigners/the50/info.json create mode 100644 keyboards/lazydesigners/the50/keymaps/default/keymap.c create mode 100644 keyboards/lazydesigners/the50/keymaps/default/readme.md create mode 100644 keyboards/lazydesigners/the50/readme.md create mode 100644 keyboards/lazydesigners/the50/rules.mk create mode 100644 keyboards/lazydesigners/the50/the50.c create mode 100644 keyboards/lazydesigners/the50/the50.h diff --git a/keyboards/lazydesigners/the50/config.h b/keyboards/lazydesigners/the50/config.h new file mode 100644 index 0000000000..e4f91f5eef --- /dev/null +++ b/keyboards/lazydesigners/the50/config.h @@ -0,0 +1,49 @@ +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x0050 +#define DEVICE_VER 0x0001 +#define MANUFACTURER LazyDesigners +#define PRODUCT THE50 +#define DESCRIPTION A 50% keyboard + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 15 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { B0, B1, B2, B3 } +#define MATRIX_COL_PINS { B5, D0, D1, D2, D3, D4, D5, D6, D7, C6, C7, F4, F5, F6, F7 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* number of backlight levels */ +#define BACKLIGHT_PIN B6 +#ifdef BACKLIGHT_PIN +#define BACKLIGHT_LEVELS 6 +#endif + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 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 + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +#define RGB_DI_PIN E6 +#ifdef RGB_DI_PIN +#define RGBLED_NUM 1 +#define RGBLIGHT_SLEEP +#endif diff --git a/keyboards/lazydesigners/the50/info.json b/keyboards/lazydesigners/the50/info.json new file mode 100644 index 0000000000..16e751dac3 --- /dev/null +++ b/keyboards/lazydesigners/the50/info.json @@ -0,0 +1,67 @@ +{ + "keyboard_name": "THE50", + "url": "http://lazydesigners.cn", + "maintainer": "qmk", + "width": 15.25, + "height": 4, + "layouts": { + "LAYOUT": { + "key_count": 54, + "layout": [ + {"label":"Esc", "x":0, "y":0}, + {"label":"Q", "x":1, "y":0}, + {"label":"W", "x":2, "y":0}, + {"label":"E", "x":3, "y":0}, + {"label":"R", "x":4, "y":0}, + {"label":"T", "x":5, "y":0}, + {"label":"Y", "x":6, "y":0}, + {"label":"U", "x":7, "y":0}, + {"label":"I", "x":8, "y":0}, + {"label":"O", "x":9, "y":0}, + {"label":"P", "x":10, "y":0}, + {"label":"Back
Space", "x":11, "y":0}, + {"label":"7", "x":12.25, "y":0}, + {"label":"8", "x":13.25, "y":0}, + {"label":"9", "x":14.25, "y":0}, + {"label":"Tab", "x":0, "y":1, "w":1.25}, + {"label":"A", "x":1.25, "y":1}, + {"label":"S", "x":2.25, "y":1}, + {"label":"D", "x":3.25, "y":1}, + {"label":"F", "x":4.25, "y":1}, + {"label":"G", "x":5.25, "y":1}, + {"label":"H", "x":6.25, "y":1}, + {"label":"J", "x":7.25, "y":1}, + {"label":"K", "x":8.25, "y":1}, + {"label":"L", "x":9.25, "y":1}, + {"label":"Enter", "x":10.25, "y":1, "w":1.75}, + {"label":"4", "x":12.25, "y":1}, + {"label":"5", "x":13.25, "y":1}, + {"label":"6", "x":14.25, "y":1}, + {"label":"Shift", "x":0, "y":2, "w":1.75}, + {"label":"Z", "x":1.75, "y":2}, + {"label":"X", "x":2.75, "y":2}, + {"label":"C", "x":3.75, "y":2}, + {"label":"V", "x":4.75, "y":2}, + {"label":"B", "x":5.75, "y":2}, + {"label":"N", "x":6.75, "y":2}, + {"label":"M", "x":7.75, "y":2}, + {"label":"<", "x":8.75, "y":2}, + {"label":">", "x":9.75, "y":2}, + {"label":"Fn", "x":10.75, "y":2, "w":1.25}, + {"label":"1", "x":12.25, "y":2}, + {"label":"2", "x":13.25, "y":2}, + {"label":"3", "x":14.25, "y":2}, + {"label":"Hyper", "x":0, "y":3, "w":1.25}, + {"label":"Super", "x":1.25, "y":3}, + {"label":"Meta", "x":2.25, "y":3, "w":1.25}, + {"label":"Space", "x":3.5, "y":3, "w":2.25}, + {"label":"Space", "x":5.75, "y":3, "w":2.75}, + {"label":"Meta", "x":8.5, "y":3, "w":1.25}, + {"label":"Super", "x":9.75, "y":3}, + {"label":"Hyper", "x":10.75, "y":3, "w":1.25}, + {"label":"0", "x":12.25, "y":3}, + {"label":".", "x":13.25, "y":3}, + {"label":"Enter", "x":14.25, "y":3}] + } + } +} diff --git a/keyboards/lazydesigners/the50/keymaps/default/keymap.c b/keyboards/lazydesigners/the50/keymaps/default/keymap.c new file mode 100644 index 0000000000..cba582cab2 --- /dev/null +++ b/keyboards/lazydesigners/the50/keymaps/default/keymap.c @@ -0,0 +1,59 @@ +#include QMK_KEYBOARD_H + +enum custom_layers { + _QWERTY, + _FN +}; + +// Act as Shift on hold and as CapsLock on tap +#define SFT_CPS LSFT_T(KC_CAPS) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------. ,--------------. + * |Esc | Q | W | E | R | T | Y | U | I | O | P |Bspc| | 7 | 8 | 9 | + * |-----------------------------------------------------------| |--------------| + * | Tab | A | S | D | F | G | H | J | K | L | Enter | | 4 | 5 | 6 | + * |-----------------------------------------------------------| |--------------| + * | Shift | Z | X | C | V | B | N | M | , | . | FN | | 1 | 2 | 3 | + * |-----------------------------------------------------------| |--------------| + * | Ctrl |Gui | Alt | Space | Space | RAlt |RGui|RCtrl| | 0 | . |Entr| + * `-----------------------------------------------------------' `--------------' + */ + +[_QWERTY] = LAYOUT( +KC_GESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, KC_7, KC_8, KC_9, +KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT, KC_4, KC_5, KC_6, +SFT_CPS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, MO(_FN), KC_1, KC_2, KC_3, +KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_0, KC_DOT, KC_ENT +), + +/* FN + * ,-----------------------------------------------------------. ,--------------. + * |RST | | | | | | | | | |Ins |Del | |Home|PgUp| | + * |-----------------------------------------------------------| |--------------| + * | |Prev|Play|Next| | | |VolD|Mute|VolU| | |End |PgDn| | + * |-----------------------------------------------------------| |--------------| + * | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| |--------------| + * |EEPRST| | | | | | | | | | | | + * `-----------------------------------------------------------' `--------------' + */ + +[_FN] = LAYOUT( +RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_DEL, KC_HOME, KC_PGUP, _______, +_______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, KC_VOLD, KC_MUTE, KC_VOLU, _______, KC_END, KC_PGDN, _______, +_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, +EEP_RST, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +) +}; + +void led_set_user(uint8_t usb_led) { + // Turn LED On/Off for Caps Lock + if (host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK)) { + the50_led_on(); + } else { + the50_led_off(); + } +} diff --git a/keyboards/lazydesigners/the50/keymaps/default/readme.md b/keyboards/lazydesigners/the50/keymaps/default/readme.md new file mode 100644 index 0000000000..09b9351f99 --- /dev/null +++ b/keyboards/lazydesigners/the50/keymaps/default/readme.md @@ -0,0 +1,31 @@ +# Default keymap for THE50 + +**Features** + +* Shift acts as CapsLock when tapped + +## QWERTY (Normal) Layer +``` + ,-----------------------------------------------------------. ,--------------. + |Esc | Q | W | E | R | T | Y | U | I | O | P |Bspc| | 7 | 8 | 9 | + |-----------------------------------------------------------| |--------------| + | Tab | A | S | D | F | G | H | J | K | L | Enter | | 4 | 5 | 6 | + |-----------------------------------------------------------| |--------------| + | Shift | Z | X | C | V | B | N | M | , | . | FN | | 1 | 2 | 3 | + |-----------------------------------------------------------| |--------------| + | Ctrl |Gui | Alt | Space | Space | RAlt |RGui|RCtrl| | 0 | . |Entr| + `-----------------------------------------------------------' `--------------' +``` + +## FN Layer +``` + ,-----------------------------------------------------------. ,--------------. + |RST | | | | | | | | | |Ins |Del | |Home|PgUp| | + |-----------------------------------------------------------| |--------------| + | |Prev|Play|Next| | | |VolD|Mute|VolU| | |End |PgDn| | + |-----------------------------------------------------------| |--------------| + | | | | | | | | | | | | | | | | + |-----------------------------------------------------------| |--------------| + |EEPRST| | | | | | | | | | | | + `-----------------------------------------------------------' `--------------' +``` diff --git a/keyboards/lazydesigners/the50/readme.md b/keyboards/lazydesigners/the50/readme.md new file mode 100644 index 0000000000..d90dc59de6 --- /dev/null +++ b/keyboards/lazydesigners/the50/readme.md @@ -0,0 +1,17 @@ +# THE50 + +![THE50](https://i.loli.net/2018/11/13/5beac9464d402.jpg) + +A 50% custom keyboard designed and produced by [LazyDesigners](http://lazydesigners.cn). + +Keyboard Maintainer: QMK Community +Hardware Supported: THE50 +Hardware Availability: Check for GBs on [Geekhack](https://geekhack.org) and on [LazyDesigner's homepage.](http://lazydesigners.cn) + +Make example for this keyboard (after setting up your build environment): + + make lazydesigners/the50:default:dfu + +To enter the bootloader, either short the pins on the PCB or the RESET button on the FN layer. + +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/lazydesigners/the50/rules.mk b/keyboards/lazydesigners/the50/rules.mk new file mode 100644 index 0000000000..ae211ec66e --- /dev/null +++ b/keyboards/lazydesigners/the50/rules.mk @@ -0,0 +1,52 @@ +# MCU name +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + +BOOTLOADER = atmel-dfu + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard underlight functionality diff --git a/keyboards/lazydesigners/the50/the50.c b/keyboards/lazydesigners/the50/the50.c new file mode 100644 index 0000000000..4ceb3da6ab --- /dev/null +++ b/keyboards/lazydesigners/the50/the50.c @@ -0,0 +1,9 @@ +#include "the50.h" + +void the50_led_on() { + DDRB |= (1 << 7); PORTB &= ~(1 << 7); +} + +void the50_led_off() { + DDRB &= ~(1 << 7); PORTB &= ~(1 << 7); +} diff --git a/keyboards/lazydesigners/the50/the50.h b/keyboards/lazydesigners/the50/the50.h new file mode 100644 index 0000000000..1cf613aada --- /dev/null +++ b/keyboards/lazydesigners/the50/the50.h @@ -0,0 +1,32 @@ +#pragma once + +#include "quantum.h" + +#define XXXX KC_NO + +/* + * ,-----------------------------------------------------------. ,--------------. + * | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| |--------------| + * | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| |--------------| + * | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| |--------------| + * | | | | | | | | | | | | | + * `-----------------------------------------------------------' `--------------' + */ + +#define LAYOUT( \ +K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, \ +K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K111, K112, K113, K114, \ +K200, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214, \ +K300, K301, K302, K304, K307, K309, K310, K311, K312, K313, K314 \ +) { \ +{ K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014 }, \ +{ K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, XXXX, K111, K112, K113, K114 }, \ +{ K200, XXXX, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214 }, \ +{ K300, K301, K302, XXXX, K304, XXXX, XXXX, K307, XXXX, K309, K310, K311, K312, K313, K314 } \ +} + +void the50_led_on(void); +void the50_led_off(void);