From f7caca51f60d8b02a7cdcc16acfaa3d794f70bed Mon Sep 17 00:00:00 2001 From: Erovia Date: Fri, 24 May 2019 02:26:15 +0200 Subject: [PATCH] Add support for Dimple (#5963) Add support for Dimple, a 40% custom keyboard designed and produced by LazyDesigners. --- keyboards/lazydesigners/dimple/config.h | 66 +++++++++ keyboards/lazydesigners/dimple/dimple.c | 24 ++++ keyboards/lazydesigners/dimple/dimple.h | 46 ++++++ keyboards/lazydesigners/dimple/info.json | 56 ++++++++ .../dimple/keymaps/default/keymap.c | 136 ++++++++++++++++++ .../dimple/keymaps/default/readme.md | 60 ++++++++ keyboards/lazydesigners/dimple/readme.md | 17 +++ keyboards/lazydesigners/dimple/rules.mk | 58 ++++++++ 8 files changed, 463 insertions(+) create mode 100644 keyboards/lazydesigners/dimple/config.h create mode 100644 keyboards/lazydesigners/dimple/dimple.c create mode 100644 keyboards/lazydesigners/dimple/dimple.h create mode 100644 keyboards/lazydesigners/dimple/info.json create mode 100644 keyboards/lazydesigners/dimple/keymaps/default/keymap.c create mode 100644 keyboards/lazydesigners/dimple/keymaps/default/readme.md create mode 100644 keyboards/lazydesigners/dimple/readme.md create mode 100644 keyboards/lazydesigners/dimple/rules.mk diff --git a/keyboards/lazydesigners/dimple/config.h b/keyboards/lazydesigners/dimple/config.h new file mode 100644 index 0000000000..0f7a8798eb --- /dev/null +++ b/keyboards/lazydesigners/dimple/config.h @@ -0,0 +1,66 @@ +/* +Copyright 2019 Erovia + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x0040 +#define DEVICE_VER 0x0001 +#define MANUFACTURER LazyDesigners +#define PRODUCT Dimple +#define DESCRIPTION A 40% keyboard + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 12 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { D0, D1, D2, D3 } +#define MATRIX_COL_PINS { B0, B1, B2, B3, D4, D6, D7, B4, B5, B6, C6, C7 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* 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 + +/* RBG underglow */ +#define RGB_DI_PIN B7 +#ifdef RGB_DI_PIN + #define RGBLIGHT_ANIMATIONS + #define RGBLIGHT_SLEEP + #define RGBLED_NUM 50 + /* #define RGBLIGHT_HUE_STEP 8 */ + /* #define RGBLIGHT_SAT_STEP 8 */ + /* #define RGBLIGHT_VAL_STEP 8 */ +#endif + +/* CapsLock LED */ +#define BACKLIGHT_PIN E6 +#ifdef BACKLIGHT_PIN + #define BACKLIGHT_LEVELS 6 +#endif diff --git a/keyboards/lazydesigners/dimple/dimple.c b/keyboards/lazydesigners/dimple/dimple.c new file mode 100644 index 0000000000..5f95716516 --- /dev/null +++ b/keyboards/lazydesigners/dimple/dimple.c @@ -0,0 +1,24 @@ +/* Copyright 2019 Erovia + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "dimple.h" + +void dimple_led_on() { + DDRE |= (1 << 6); PORTE &= ~(1 << 6); +} + +void dimple_led_off() { + DDRE &= ~(1 << 6); PORTE &= ~(1 << 6); +} diff --git a/keyboards/lazydesigners/dimple/dimple.h b/keyboards/lazydesigners/dimple/dimple.h new file mode 100644 index 0000000000..ba8a413ed6 --- /dev/null +++ b/keyboards/lazydesigners/dimple/dimple.h @@ -0,0 +1,46 @@ +/* Copyright 2019 Erovia + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#include "quantum.h" + +/* + * ,---------------------------------------------------------------. + * | | | | | | | | | | | | | + * |---------------------------------------------------------------| + * | | | | | | | | | | | | | + * |---------------------------------------------------------------| + * | | | | | | | | | | | | + * |---------------------------------------------------------------| + * | | | | | | | | | + * `-----------------------------------------------------' + */ + +#define LAYOUT( \ + K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, \ + K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, \ + K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, \ + K300, K302, K303, K304, K306, K307, K308, K309 \ +) { \ + { K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011 }, \ + { K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111 }, \ + { K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, KC_NO }, \ + { K300, KC_NO, K302, K303, K304, KC_NO, K306, K307, K308, K309, KC_NO, KC_NO } \ +} + + +void dimple_led_on(void); +void dimple_led_off(void); diff --git a/keyboards/lazydesigners/dimple/info.json b/keyboards/lazydesigners/dimple/info.json new file mode 100644 index 0000000000..db5137e1f8 --- /dev/null +++ b/keyboards/lazydesigners/dimple/info.json @@ -0,0 +1,56 @@ +{ + "keyboard_name": "Dimple", + "url": "http://lazydesigners.cn", + "maintainer": "Erovia", + "width": 12.5, + "height": 4, + "layouts": { + "LAYOUT": { + "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, "w":1.5}, + {"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":"'", "x":10.25, "y":1}, + {"label":"Enter", "x":11.25, "y":1, "w":1.25}, + {"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":"Up", "x":9.75, "y":2}, + {"label":".", "x":10.75, "y":2, "w":1.75}, + {"label":"Ctrl", "x":0.75, "y":3}, + {"label":"Gui", "x":1.75, "y":3}, + {"label":"Alt", "x":2.75, "y":3}, + {"label":"Space", "x":3.75, "y":3, "w":2.25}, + {"label":"Space", "x":6, "y":3, "w":2.75}, + {"label":"Left", "x":8.75, "y":3}, + {"label":"Down", "x":9.75, "y":3}, + {"label":"Right", "x":10.75, "y":3} + ] + } + } +} diff --git a/keyboards/lazydesigners/dimple/keymaps/default/keymap.c b/keyboards/lazydesigners/dimple/keymaps/default/keymap.c new file mode 100644 index 0000000000..e5a9c8466a --- /dev/null +++ b/keyboards/lazydesigners/dimple/keymaps/default/keymap.c @@ -0,0 +1,136 @@ +/* Copyright 2019 Erovia + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include QMK_KEYBOARD_H + +enum custom_layers { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST +}; + +// Act as Shift on hold and as CapsLock on tap +#define SFT_CPS LSFT_T(KC_CAPS) +// Left space on tap, LOWER on hold +#define SPC_LOW LT(_LOWER, KC_SPC) +// Left space on tap, UPPER on hold +#define SPC_UPR LT(_RAISE, KC_SPC) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* + * ,---------------------------------------------------------------. + * |Esc | Q | W | E | R | T | Y | U | I | O | P | Bspc | + * |---------------------------------------------------------------| + * | Tab | A | S | D | F | G | H | J | K | L | ' |Enter | + * |---------------------------------------------------------------| + * | Shift | Z | X | C | V | B | N | M | , | Up | . | + * |---------------------------------------------------------------| + * |Ctrl|Gui |Alt | Spc/Lwr | Spc/Rse |Left|Down|Rght| + * `-----------------------------------------------------' + */ + + [_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_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, KC_ENT, + SFT_CPS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_UP, KC_DOT, + KC_LCTL, KC_LGUI, KC_LALT, SPC_LOW, SPC_UPR, KC_LEFT, KC_DOWN, KC_RGHT + ), + +/* + * ,---------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | | + * |---------------------------------------------------------------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | + * |---------------------------------------------------------------| + * | | F7 | F8 | F9 |F10 |F11 |F12 | | ; |PgUp| / | + * |---------------------------------------------------------------| + * | | | | | |Home|PgDn|End | + * `-----------------------------------------------------' + */ + + [_LOWER] = LAYOUT( + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_NO, + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, + KC_NO, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_SCLN, KC_PGUP, KC_SLSH, + KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ), + +/* + * ,---------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | | + * |---------------------------------------------------------------| + * | Ins | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |---------------------------------------------------------------| + * | | F7 | F8 | F9 |F10 |F11 |F12 | | | | | + * |---------------------------------------------------------------| + * |VolD|Mute|VolU| | | | | | + * `-----------------------------------------------------' + */ + + [_RAISE] = LAYOUT( + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_NO, + KC_INS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, + KC_NO, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, KC_NO, KC_NO, + KC_VOLD, KC_MUTE, KC_VOLU, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO + ), + +/* + * ,---------------------------------------------------------------. + * |EEPR|RST | | | | | | | | | | | + * |---------------------------------------------------------------| + * | | | | | | | | | | | | | + * |---------------------------------------------------------------| + * | | | | | | | | | | | | + * |---------------------------------------------------------------| + * |RGB-|RGB |RGB+| | | | | | + * `-----------------------------------------------------' + */ + + [_ADJUST] = LAYOUT( + EEP_RST, RESET, 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, 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, KC_NO, + RGB_VAD, RGB_TOG, RGB_VAI, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO + ), +}; + +void led_set_user(uint8_t usb_led) { +if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { + dimple_led_on(); + } else { + dimple_led_off(); + } +} + +uint32_t layer_state_set_user(uint32_t state) { + state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); + switch (biton32(state)) { + case _LOWER: + rgblight_sethsv_noeeprom(HSV_GREEN); + break; + case _RAISE: + rgblight_sethsv_noeeprom(HSV_GOLD); + break; + case _ADJUST: + rgblight_sethsv_noeeprom(HSV_RED); + break; + default: + rgblight_sethsv_noeeprom(HSV_WHITE); + break; + } + return state; +} diff --git a/keyboards/lazydesigners/dimple/keymaps/default/readme.md b/keyboards/lazydesigners/dimple/keymaps/default/readme.md new file mode 100644 index 0000000000..c334b6c367 --- /dev/null +++ b/keyboards/lazydesigners/dimple/keymaps/default/readme.md @@ -0,0 +1,60 @@ +# The default keymap for Dimple + +**Features** + +* Shift acts as CapsLock when tapped +* Left space: space on tap, Lower layer on hold +* Right space: space on tap, Raise layer on hold +* Both space: Adjust layer on hold + +## QWERTY (Normal) Layer +``` + ,---------------------------------------------------------------. + |Esc | Q | W | E | R | T | Y | U | I | O | P | Bspc | + |---------------------------------------------------------------| + | Tab | A | S | D | F | G | H | J | K | L | ' |Enter | + |---------------------------------------------------------------| + | Shift | Z | X | C | V | B | N | M | , | Up | . | + |---------------------------------------------------------------| + |Ctrl|Gui |Alt | Spc/Lwr | Spc/Rse |Left|Down|Rght| + `-----------------------------------------------------' +``` + +## Lower Layer +``` + ,---------------------------------------------------------------. + | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | | + |---------------------------------------------------------------| + | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | + |---------------------------------------------------------------| + | | F7 | F8 | F9 |F10 |F11 |F12 | | ; |PgUp| / | + |---------------------------------------------------------------| + | | | | | |Home|PgDn|End | + `-----------------------------------------------------' +``` + +## Raise Layer +``` + ,---------------------------------------------------------------. + | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | | + |---------------------------------------------------------------| + | Ins | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + |---------------------------------------------------------------| + | | F7 | F8 | F9 |F10 |F11 |F12 | | | | | + |---------------------------------------------------------------| + |VolD|Mute|VolU| | | | | | + `-----------------------------------------------------' +``` + +## Adjust Layer +``` +,---------------------------------------------------------------. + |EEPR|RST | | | | | | | | | | | + |---------------------------------------------------------------| + | | | | | | | | | | | | | + |---------------------------------------------------------------| + | | | | | | | | | | | | + |---------------------------------------------------------------| + |RGB-|RGB |RGB+| | | | | | + `-----------------------------------------------------' +``` diff --git a/keyboards/lazydesigners/dimple/readme.md b/keyboards/lazydesigners/dimple/readme.md new file mode 100644 index 0000000000..04b4b438d6 --- /dev/null +++ b/keyboards/lazydesigners/dimple/readme.md @@ -0,0 +1,17 @@ +# Dimple + +![dimple](https://i.loli.net/2019/03/29/5c9daf903cad9.jpg) + +A 40% custom keyboard designed and produced by [LazyDesigners](http://lazydesigners.cn). + +Keyboard Maintainer: [Erovia](https://github.com/Erovia) +Hardware Supported: Dimple +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/dimple: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/dimple/rules.mk b/keyboards/lazydesigners/dimple/rules.mk new file mode 100644 index 0000000000..a818e871c6 --- /dev/null +++ b/keyboards/lazydesigners/dimple/rules.mk @@ -0,0 +1,58 @@ +# 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 selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# atmega32a bootloadHID +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow