Enable mouse keys for kemonine and adjust firmware accordingly

This commit is contained in:
kemonine 2020-09-16 20:07:01 -04:00
parent 0cdea783b2
commit 7da34d338d
4 changed files with 67 additions and 4 deletions

View file

@ -1,5 +1,11 @@
#include "debug.h"
#include "action_layer.h"
#include "version.h"
#include QMK_KEYBOARD_H
#define CAPS_LED 30
enum alt_keycodes {
U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active
U_T_AGCR, //USB Toggle Automatic GCR control
@ -11,6 +17,7 @@ enum alt_keycodes {
};
keymap_config_t keymap_config;
rgb_config_t rgb_matrix_config;
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_65_ansi_blocker(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_HOME,
@ -19,14 +26,30 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
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_END,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT),
[1] = LAYOUT_65_ansi_blocker(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_DEL,
KC_CAPS, 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_PSCR,
KC_NO, 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_INS,
KC_CAPS, KC_TRNS, KC_TRNS, KC_MS_UP, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS,
KC_NO, KC_MS_WH_DOWN, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, KC_MS_WH_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MEDIA_PLAY_PAUSE, KC_RSFT, RGB_VAI, KC_MUTE,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_VOLD, RGB_VAD, KC_VOLU)
KC_TRNS, KC_TRNS, KC_MS_BTN2, KC_MS_BTN1, KC_NO, KC_TRNS, KC_VOLD, RGB_VAD, KC_VOLU)
};
const uint8_t PROGMEM layercolors[][2] = {
[0] = {10,255}
};
const uint8_t PROGMEM ledcolors[][DRIVER_LED_TOTAL][3] = {
[1] = {
{128, 255, 255}, {128, 255, 255}, {128, 255, 255}, {128, 255, 255}, {128, 255, 255}, {128, 255, 255}, {128, 255, 255}, {128, 255, 255}, {128, 255, 255}, {128, 255, 255}, {128, 255, 255}, {128, 255, 255}, {128, 255, 255}, {128, 255, 255}, {128, 255, 255},
{128, 255, 255}, {0, 0, 0}, {0, 0, 0}, {128, 255, 255}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {128, 255, 255}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {128, 255, 255},
{0, 0, 0}, {128, 255, 255}, {128, 255, 255}, {128, 255, 255}, {128, 255, 255}, {128, 255, 255}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {128, 255, 255},
{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {128, 255, 255}, {0, 0, 0}, {128, 255, 255}, {128, 255, 255},
{0, 0, 0}, {0, 0, 0}, {128, 255, 255}, {128, 255, 255}, {0, 0, 0}, {0, 0, 0},{128, 255, 255}, {128, 255, 255}, {128, 255, 255}
}
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
rgb_matrix_config.raw = pgm_read_dword(EECONFIG_RGB_MATRIX);
rgb_matrix_enable();
rgb_matrix_sethsv(10, 255, 95);
rgb_matrix_mode(RGB_MATRIX_SOLID_COLOR);
@ -36,6 +59,46 @@ void matrix_init_user(void) {
void matrix_scan_user(void) {
};
void set_leds_color( int layer) {
for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
uint8_t val = pgm_read_byte(&ledcolors[layer][i][2]);
// if the brightness of the led is set to 0 in the map,
// the value is not overriden with global controls, allowing the led
// to appear turned off
HSV hsv = { .h = pgm_read_byte(&ledcolors[layer][i][0]), .s = pgm_read_byte(&ledcolors[layer][i][1]), .v = val == 0 ? 0 : rgb_matrix_config.hsv.v};
RGB rgb = hsv_to_rgb( hsv );
rgb_matrix_set_color( i, rgb.r, rgb.g, rgb.b );
}
}
void set_layer_color( uint8_t layer ) {
HSV hsv = { .h = pgm_read_byte(&layercolors[layer][0]), .s = pgm_read_byte(&layercolors[layer][1]), .v = rgb_matrix_config.hsv.v};
RGB rgb = hsv_to_rgb( hsv );
for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
rgb_matrix_set_color( i, rgb.r, rgb.g, rgb.b );
}
}
void rgb_matrix_indicators_user(void) {
uint32_t mode = rgblight_get_mode();
// assign colors if the matrix is on and the current mode
// is SOLID COLORS => No animations running
if(rgb_matrix_config.enable == 1 && mode == RGB_MATRIX_SOLID_COLOR) {
uint8_t layer = biton32(layer_state);
switch (layer) {
case 0:
set_layer_color(0);
break;
case 1:
set_leds_color(1);
break;
}
}
if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) {
rgb_matrix_set_color(CAPS_LED, 0, 191, 255);
}
}
#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT))
#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL))
#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))

View file

@ -1 +0,0 @@
{"version":1,"notes":"","documentation":"\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n","keyboard":"massdrop/alt","keymap":"massdrop_alt_layout_65_ansi_blocker_kmn","layout":"LAYOUT_65_ansi_blocker","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_HOME","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","KC_PGUP","ANY(LM(LAYER_1, MOD_LALT))","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_PGDN","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_END","KC_LCTL","KC_LGUI","KC_LALT","KC_SPC","MO(1)","KC_RALT","KC_LEFT","KC_DOWN","KC_RGHT"],["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_DEL","KC_CAPS","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_PSCR","KC_NO","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_INS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","ANY(KC_MEDIA_PLAY_PAUSE)","KC_RSFT","RGB_VAI","KC_MUTE","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_NO","KC_TRNS","KC_VOLD","RGB_VAD","KC_VOLU"]],"author":""}

View file

@ -0,0 +1 @@
MOUSEKEY_ENABLE = yes