Skip to content

Commit

Permalink
[Keyboard] add kk980 keyboard (qmk#14436)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sets3n authored and sar committed Sep 24, 2021
1 parent cba158a commit b5c069a
Show file tree
Hide file tree
Showing 9 changed files with 505 additions and 0 deletions.
103 changes: 103 additions & 0 deletions keyboards/sets3n/kk980/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/* Copyright 2021 Sets3n
*
* 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 0x404A
#define PRODUCT_ID 0x0002
#define DEVICE_VER 0x0001
#define MANUFACTURER Sets3n
#define PRODUCT kk980

/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 17

/*
* Keyboard Matrix Assignments
*
* Change this to how you wired your keyboard
* COLS: AVR pins used for columns, left to right
* ROWS: AVR pins used for rows, top to bottom
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
*
*/

/* key matrix pins */
#define MATRIX_ROW_PINS { B2, B3, D3, D4, D5, D6 }
#define MATRIX_COL_PINS { E6, F0, F1, F4, F5, F6, F7, C7, C6, B6, B5, B4, D7, B1, B0, D0, D1 }
#define UNUSED_PINS

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW

/* number of backlight levels */

#ifdef BACKLIGHT_PIN
#define BACKLIGHT_LEVELS 8
#endif

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not 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 RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
#define RGBLIGHT_EFFECT_SNAKE
#define RGBLIGHT_EFFECT_KNIGHT
#define RGBLIGHT_EFFECT_CHRISTMAS
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
#define RGBLIGHT_EFFECT_RGB_TEST
#define RGBLIGHT_EFFECT_ALTERNATING
#define RGBLIGHT_EFFECT_TWINKLE

#define RGB_DI_PIN B7
#ifdef RGB_DI_PIN
#define RGBLED_NUM 102
#define RGBLIGHT_LED_MAP { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,\
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, \
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, \
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, \
54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, \
68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, \
82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, \
96, 97, 98, 99, 100, 101, 102 } // 1 --> ScollLock 2 --> CapsLock 3 --> Bluetooth 4 --> NumLock
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
#define RGBLIGHT_LIMIT_VAL 230
#define RGBLIGHT_LAYERS
#define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF
#endif

#ifdef RGB_MATRIX_ENABLE
#define DRIVER_LED_TOTAL RGBLED_NUM
#define RGB_MATRIX_KEYPRESSES
#endif

#define BOOTMAGIC_LITE_ROW 0
#define BOOTMAGIC_LITE_COLUMN 0

116 changes: 116 additions & 0 deletions keyboards/sets3n/kk980/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"keyboard_name": "kk980",
"url": "https://i.imgur.com/MQA6FXb.jpg",
"maintainer": "Sets3n",
"layouts": {
"LAYOUT": {
"layout": [
{"label":"ESC", "x": 0, "y": 0},
{"label":"F1", "x": 2, "y": 0},
{"label":"F2", "x": 3, "y": 0},
{"label":"F3", "x": 4, "y": 0},
{"label":"F4", "x": 5, "y": 0},
{"label":"F5", "x": 6.5, "y": 0},
{"label":"F6", "x": 7.5, "y": 0},
{"label":"F7", "x": 8.5, "y": 0},
{"label":"F8", "x": 9.5, "y": 0},
{"label":"F9", "x": 11, "y": 0},
{"label":"F10", "x": 12, "y": 0},
{"label":"F11", "x": 13, "y": 0},
{"label":"F12", "x": 14, "y": 0},
{"label":"DEL", "x": 15.5, "y": 0},
{"label":"INSERT", "x": 16.5, "y": 0},
{"label":"PGUP", "x": 17.5, "y": 0},
{"label":"PGDN", "x": 18.5, "y": 0},

{"label":"`~", "x": 0, "y": 1.5},
{"label":"1!", "x": 1, "y": 1.5},
{"label":"2@", "x": 2, "y": 1.5},
{"label":"3#", "x": 3, "y": 1.5},
{"label":"4$", "x": 4, "y": 1.5},
{"label":"5%", "x": 5, "y": 1.5},
{"label":"6^", "x": 6, "y": 1.5},
{"label":"7&", "x": 7, "y": 1.5},
{"label":"8*", "x": 8, "y": 1.5},
{"label":"9(", "x": 9, "y": 1.5},
{"label":"0)", "x": 10, "y": 1.5},
{"label":"-_", "x": 11, "y": 1.5},
{"label":"+=", "x": 12, "y": 1.5},
{"label":"BS", "x": 13, "y": 1.5, "w": 2},
{"label":"NUML", "x": 15.5, "y": 1.5},
{"label":"/", "x": 16.5, "y": 1.5},
{"label":"*", "x": 17.5, "y": 1.5},
{"label":"-", "x": 18.5, "y": 1.5},

{"label":"TAB", "x": 0, "y": 2.5, "w": 1.5},
{"label":"Q", "x": 1.5, "y": 2.5},
{"label":"W", "x": 2.5, "y": 2.5},
{"label":"E", "x": 3.5, "y": 2.5},
{"label":"R", "x": 4.5, "y": 2.5},
{"label":"T", "x": 5.5, "y": 2.5},
{"label":"Y", "x": 6.5, "y": 2.5},
{"label":"U", "x": 7.5, "y": 2.5},
{"label":"I", "x": 8.5, "y": 2.5},
{"label":"O", "x": 9.5, "y": 2.5},
{"label":"P", "x": 10.5, "y": 2.5},
{"label":"[{", "x": 11.5, "y": 2.5},
{"label":"]}", "x": 12.5, "y": 2.5},
{"label":"\\|", "x": 13.5, "y": 2.5, "w": 1.5},
{"label":"7", "x": 15.5, "y": 2.5},
{"label":"8", "x": 16.5, "y": 2.5},
{"label":"9", "x": 17.5, "y": 2.5},

{"label":"CAPS", "x": 0, "y": 3.5, "w": 1.75},
{"label":"A", "x": 1.75, "y": 3.5},
{"label":"S", "x": 2.75, "y": 3.5},
{"label":"D", "x": 3.75, "y": 3.5},
{"label":"F", "x": 4.75, "y": 3.5},
{"label":"G", "x": 5.75, "y": 3.5},
{"label":"H", "x": 6.75, "y": 3.5},
{"label":"J", "x": 7.75, "y": 3.5},
{"label":"K", "x": 8.75, "y": 3.5},
{"label":"L", "x": 9.75, "y": 3.5},
{"label":";:", "x": 10.75, "y": 3.5},
{"label":"'\"", "x": 11.75, "y": 3.5},
{"label":"RETURN", "x": 12.75, "y": 3.5, "w": 2.25},
{"label":"4", "x": 15.5, "y": 3.5, "w": 1.5},
{"label":"5", "x": 16.5, "y": 3.5},
{"label":"6", "x": 17.5, "y": 3.5},
{"label":"+", "x": 18.5, "y": 3.5, "h": 2},

{"label":"LSHIFT", "x": 0, "y": 4.5, "w": 2.25},
{"label":"Z", "x": 2.25, "y": 4.5},
{"label":"X", "x": 3.25, "y": 4.5},
{"label":"C", "x": 4.25, "y": 4.5},
{"label":"V", "x": 5.25, "y": 4.5},
{"label":"B", "x": 6.25, "y": 4.5},
{"label":"N", "x": 7.25, "y": 4.5},
{"label":"M", "x": 8.25, "y": 4.5},
{"label":",<", "x": 9.25, "y": 4.5},
{"label":".>", "x": 10.25, "y": 4.5},
{"label":"/?", "x": 11.25, "y": 4.5},
{"label":"RSHIFT", "x": 12.25, "y": 4.5, "w": 1.75},
{"label":"up", "x": 14.25, "y": 4.75},
{"label":"1", "x": 15.5, "y": 4.5},
{"label":"2", "x": 16.5, "y": 4.5},
{"label":"3", "x": 17.5, "y": 4.5},

{"label":"LCTRL", "x": 0, "y": 5.5, "w": 1.25},
{"label":"LWIN", "x": 1.25, "y": 5.5},
{"label":"LALT", "x": 2.25, "y": 5.5, "w": 1.25},
{"label":"SPACE", "x": 3.25, "y": 5.5, "w": 6.25},
{"label":"RALT", "x": 9.5, "y": 5.5},
{"label":"FN", "x": 10.5, "y": 5.5},
{"label":"RCTRL", "x": 11.5, "y": 5.5, "w": 1.25},
{"label":"LEFT", "x": 13, "y": 5.75},
{"label":"DOWN", "x": 14, "y": 5.75},
{"label":"RIGHT", "x": 15, "y": 5.75},
{"label":"0", "x": 16.5, "y": 5.5},
{"label":".DEL", "x": 17.5, "y": 5.5, "w": 2.75},
{"label":"ENTER", "x": 18.5, "y": 5.5, "h": 2}

]
}
}
}

91 changes: 91 additions & 0 deletions keyboards/sets3n/kk980/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/* Copyright 2021 Sets3n
*
* 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] = {

[0] = LAYOUT(
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_DEL, KC_INS, KC_PGDN, KC_PGUP,
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_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
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_P7, KC_P8, KC_P9,
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_P4, KC_P5, KC_P6, KC_PPLS,
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, KC_P1, KC_P2, KC_P3,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_BSPC, KC_BSLS, KC_RALT, KC_RGUI, MO(1), KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT),

[1] = LAYOUT(
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, 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_MUTE, KC_VOLD, KC_VOLU, 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, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, BL_TOGG, BL_DEC, BL_INC, BL_STEP, 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, KC_TRNS, 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),


};


//以下是RGB灯作为层切换指示
const rgblight_segment_t PROGMEM my_scroll_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{1, 1, HSV_CYAN}
);

const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{2, 1, HSV_MAGENTA},
{56, 1, HSV_CYAN}
);


const rgblight_segment_t PROGMEM my_bluetooth_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{3, 1, HSV_WHITE}
);

const rgblight_segment_t PROGMEM my_numlocak_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{4, 1, HSV_GREEN},
{35, 1, HSV_RED}
);

// Define the array of layers. Later layers take precedence
const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
my_scroll_layer,
my_capslock_layer,
my_bluetooth_layer,
my_numlocak_layer
);

void keyboard_post_init_user(void){
//Enable the LED layers
rgblight_layers = my_rgb_layers;
}

// Enabling and disabling lighting layers
layer_state_t layer_state_set_user(layer_state_t state) {
// Both layers will light up if both kb layers are active
rgblight_set_layer_state(0, layer_state_cmp(state, 0));
rgblight_set_layer_state(1, layer_state_cmp(state, 1));
rgblight_set_layer_state(3, layer_state_cmp(state, 3));

return state;
}

bool led_update_user(led_t led_state) {
rgblight_set_layer_state(0, led_state.scroll_lock);
rgblight_set_layer_state(1, led_state.caps_lock);
rgblight_set_layer_state(3, led_state.num_lock);

return true;
}

Loading

0 comments on commit b5c069a

Please sign in to comment.