Skip to content

Instantly share code, notes, and snippets.

@sli
Last active June 8, 2019 23:34
Show Gist options
  • Save sli/12ead96cb90ad595a253ab76e1c2c549 to your computer and use it in GitHub Desktop.
Save sli/12ead96cb90ad595a253ab76e1c2c549 to your computer and use it in GitHub Desktop.
DZ60RGB QMK Keymap
#pragma once
#define sli60
#include QMK_KEYBOARD_H
#define _BASE 0
#define _UTIL 1
#define _LITE 2
// RGB_MATRIX_EFFECT(fps_mode)
// For later.
enum macro_keycodes {
M_1 = SAFE_RANGE,
M_2,
M_3,
M_4,
M_5,
M_6,
M_7,
M_8,
M_9,
M_10,
M_11,
M_12
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT_ANSI(
KC_GESC, 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_BSPC, \
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_BSLASH, \
MO(1), 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_RSFT, \
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), MO(2), KC_RCTL),
[_UTIL] = LAYOUT_ANSI(
KC_GRV, 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_TRNS, KC_MPRV, KC_MPLY, KC_MNXT, KC_TRNS, KC_TRNS, KC_CALC, KC_TRNS, KC_PSCR, KC_INS, KC_PAUS, KC_UP, KC_TRNS, RESET, \
KC_TRNS, KC_VOLU, KC_VOLD, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
[_LITE] = LAYOUT_ANSI(
KC_TRNS, M_1, M_2, M_3, M_4, M_5, M_6, M_7, M_8, M_9, M_10, M_11, M_12, RCTL(KC_GRV), \
RGB_TOG, RGB_MOD, RGB_RMOD, RGB_HUI, RGB_HUD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, \
KC_TRNS, RGB_SPI, RGB_SPD, RGB_SAI, RGB_SAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, RGB_VAI, RGB_VAD, 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),
};
// Empty Layer
/*
[_LAYER] = LAYOUT_ANSI(
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_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)
*/
void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) {
for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {
rgb_matrix_set_color( i, red, green, blue );
}
}
}
// Lights up an LED when CAPSLOCK is on. But I don't use CAPSLOCK.
void rgb_matrix_indicators_user(void) {
uint8_t this_led = host_keyboard_leds();
if (!g_suspend_state) {
switch (biton32(layer_state)) {
case _UTIL:
rgb_matrix_layer_helper(0xFF, 0x00, 0x00, false); break;
case _LITE:
rgb_matrix_layer_helper(0x00, 0xFF, 0x00, false); break;
// case _LAYER3:
// rgb_matrix_layer_helper(0x00, 0x00, 0xFF, false); break;
// case _LAYER4:
// rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, false); break;
}
}
if (this_led & (1<<USB_LED_CAPS_LOCK)) {
rgb_matrix_set_color(40, 0xFF, 0xFF, 0xFF);
}
}
// User initialization
void matrix_init_user(void) {}
// User matrix
void matrix_scan_user(void) {}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// switch (keycode) {
// case M_1:
// break;
// case M_2:
// break;
// case M_3:
// break;
// case M_4:
// break;
// case M_5:
// break;
// case M_6:
// break;
// case M_7:
// break;
// case M_8:
// break;
// case M_9:
// break;
// case M_10:
// break;
// case M_11:
// break;
// case M_12:
// break;
// }
return true;
}
// Custom LED Effects
// #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
//
// static bool fps_mode(effect_params_t* params) {
// RGB_MATRIX_USE_LIMITS(led_min, led_max);
// for (uint8_t i = led_min; i < led_max; i++) {
// rgb_matrix_set_color(i, 0xff, 0xff, 0x00);
// }
//
// return led_max < DRIVER_LED_TOTAL;
// }
//
// #endif
# RGB_MATRIX_CUSTOM_USER = yes
NKRO_ENABLE = yes
{
"keyboard": "dztech/dz60rgb",
"keymap": "sli60",
"layout": "LAYOUT_ANSI",
"layers": [
[
"KC_GESC", "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_BSPC",
"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_BSLS",
"MO(1)", "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_RSFT",
"KC_LCTL", "KC_LGUI", "KC_LALT", "KC_SPC", "KC_RALT", "MO(1)", "MO(2)", "KC_RCTL"
],
[
"KC_GRV", "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_TRNS", "KC_MPRV", "KC_MPLY", "KC_MNXT", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_PSCR", "KC_SLCK", "KC_PAUS", "KC_UP", "KC_INS", "RESET",
"KC_TRNS", "KC_VOLU", "KC_VOLD", "KC_MUTE", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_HOME", "KC_PGUP", "KC_LEFT", "KC_RGHT", "KC_TRNS",
"KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_END", "KC_PGDN", "KC_DOWN", "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", "RCTL(KC_GRV)",
"RGB_TOG", "RGB_MOD", "RGB_RMOD", "RGB_HUI", "RGB_HUD", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS",
"KC_TRNS", "RGB_SPI", "RGB_SPD", "RGB_SAI", "RGB_SAD", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS",
"KC_TRNS", "KC_TRNS", "KC_TRNS", "RGB_VAI", "RGB_VAD", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS",
"KC_TRNS", "EEP_RST", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"
]
],
"author": "sli",
"notes": "We RGB now, boys."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment