~ruther/qmk_firmware

76bc23550857badaa35ae68c62875dd8b1fad0ce — Keys of Kings 4 years ago fed9c97
[Keyboard] Add keysofkings folder and twokey keyboard (#10754)

* Add keysofkings folder and twokey keyboard

* Update readme.md

* Update readme.md

* Update config.h

* Update config.h

* Update keymap.c

* Update twokey.c

* Update twokey.h

* Update keyboards/keysofkings/twokey/config.h

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/keysofkings/twokey/readme.md

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/keysofkings/twokey/rules.mk

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/keysofkings/twokey/rules.mk

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/keysofkings/twokey/readme.md

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update info.json

* Update keymap.c

* Update keyboards/keysofkings/twokey/info.json

Co-authored-by: Ryan <fauxpark@gmail.com>

Co-authored-by: Ryan <fauxpark@gmail.com>
A keyboards/keysofkings/twokey/config.h => keyboards/keysofkings/twokey/config.h +68 -0
@@ 0,0 1,68 @@
 /* Copyright 2020 Keys of Kings
  * 
  * 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 <http://www.gnu.org/licenses/>. 
  */ 

#pragma once

#include "config_common.h"

/* USB Device descriptor parameter */
#define VENDOR_ID       0xFEED
#define PRODUCT_ID      0xAE12
#define DEVICE_VER      0x0001
#define MANUFACTURER    Keys of Kings
#define PRODUCT         Twokey

/* key matrix size */
#define MATRIX_ROWS 2
#define MATRIX_COLS 2

/* key matrix pins */
#define MATRIX_ROW_PINS { B4, B5 }
#define MATRIX_COL_PINS { B3, B2 }
#define UNUSED_PINS


#define ENCODERS_PAD_A { E6 }
#define ENCODERS_PAD_B { D7 }
#define ENCODER_RESOLUTION 1
#define ENCODER_DIRECTION_FLIP

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW

/* 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

#ifdef RGBLIGHT_ENABLE
#define RGB_DI_PIN D3
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 5
#define RGBLIGHT_HUE_STEP 4
#define RGBLIGHT_SAT_STEP 4
#define RGBLIGHT_VAL_STEP 4
#define B6_AUDIO
#define AUDIO_CLICKY
#endif

#ifdef AUDIO_ENABLE
#define STARTUP_SONG SONG(MAJOR_SOUND)
#endif

A keyboards/keysofkings/twokey/info.json => keyboards/keysofkings/twokey/info.json +16 -0
@@ 0,0 1,16 @@
{
    "keyboard_name": "Twokey",
    "url": "",
    "maintainer": "Keys of Kings",
    "width": 2,
    "height": 2.5,
    "layouts": {
        "LAYOUT": {
            "layout": [
                {"x": 0.5, "y": 0},
                {"x": 0, "y": 1.5},
                {"x": 1, "y": 1.5}
            ]
        }
    }
}

A keyboards/keysofkings/twokey/keymaps/default/keymap.c => keyboards/keysofkings/twokey/keymaps/default/keymap.c +79 -0
@@ 0,0 1,79 @@
 /* Copyright 2020 Keys of Kings
  * 
  * 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 <http://www.gnu.org/licenses/>. 
  */ 

#include QMK_KEYBOARD_H

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
	LAYOUT(
		LT(1, KC_MUTE), 
		LT(4, KC_MPLY), LT(7, KC_MNXT)),		

	LAYOUT(
		KC_TRNS, 
		TO(2), TO(3)),

	LAYOUT(
		TO(0), 
		RGB_TOG, RGB_MOD),

	LAYOUT(
		TO(0), 
		RGB_VAI, RGB_VAD),
    
    LAYOUT(
		TO(0), 
		RGB_HUI, RGB_HUD),

	LAYOUT(
		TO(5), 
		KC_TRNS, TO(6)),

	LAYOUT(
		TO(0), 
		RGB_SAI, RGB_SAD),

	LAYOUT(
		TO(8), 
		TO(9), KC_TRNS),

	LAYOUT(
		TO(0), 
		CK_TOGG, MU_TOG),

	LAYOUT(
		TO(0), 
		RESET, EEPROM_RESET),
};

void matrix_init_user(void) {
  debug_config.matrix = 1;
  debug_config.keyboard = 1;
  debug_config.enable = 1;
}

void encoder_update_user(int8_t index, bool clockwise) {
  if (index == 0) {
    if (clockwise) {
      tap_code(KC_VOLD);
    } else {
      tap_code(KC_VOLU);
    }
    #    ifdef AUDIO_CLICKY
            clockwise ? clicky_freq_up() : clicky_freq_down();
#    endif
  }
}


A keyboards/keysofkings/twokey/readme.md => keyboards/keysofkings/twokey/readme.md +16 -0
@@ 0,0 1,16 @@
# TWOKEY

![Twokey](https://i.imgur.com/UiLwPldl.jpeg)

A Two Key mini keyboard with Rotary Encoder/Switch along with Backlight keys, RGB Underglow, and Piezo Buzzer. Supports Cherry, Choc, Matias switches.

* Keyboard Maintainer: Keys of Kings
* Keyboard Designer: King Icewind
* Hardware Supported: Twokey PCB, Pro Micro
* Hardware Availability: www.keysofkings.com

Make example for this keyboard (after setting up your build environment):

    make keysofkings/twokey:default

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).

A keyboards/keysofkings/twokey/rules.mk => keyboards/keysofkings/twokey/rules.mk +23 -0
@@ 0,0 1,23 @@
# MCU name
MCU = atmega32u4

# Bootloader selection
BOOTLOADER = caterina

# Build Options
#   change yes to no to disable
#
BOOTMAGIC_ENABLE = lite     # Virtual DIP switch configuration
MOUSEKEY_ENABLE = no        # 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 = no            # USB Nkey Rollover
BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = yes       # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no       # Enable Bluetooth
AUDIO_ENABLE = yes          # Audio output
ENCODER_ENABLE = yes

A keyboards/keysofkings/twokey/twokey.c => keyboards/keysofkings/twokey/twokey.c +17 -0
@@ 0,0 1,17 @@
 /* Copyright 2020 Keys of Kings
  * 
  * 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 <http://www.gnu.org/licenses/>. 
  */ 

#include "twokey.h"

A keyboards/keysofkings/twokey/twokey.h => keyboards/keysofkings/twokey/twokey.h +28 -0
@@ 0,0 1,28 @@
 /* Copyright 2020 Keys of Kings
  * 
  * 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 <http://www.gnu.org/licenses/>. 
  */ 

#pragma once

#include "quantum.h"

#define LAYOUT( \
	K00,      \
	K10, K11  \
) { \
	{ K00,   KC_NO }, \
	{ K10,   K11 }  \
}