Created
July 1, 2017 22:55
-
-
Save Noxime/1128823c1577b72f04c8a1b0037f5171 to your computer and use it in GitHub Desktop.
Keymap for XD60
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "xd60.h" | |
#include "action_layer.h" | |
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |
// 0: Base Layer | |
KEYMAP( | |
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_RBRC, KC_DEL, KC_PSCR, \ | |
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_NUBS, KC_BSPC, \ | |
F(0), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, \ | |
KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_UP, KC_HOME, KC_END, \ | |
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_LEFT, KC_DOWN, KC_RIGHT, KC_F13), | |
// 1: Function Layer | |
KEYMAP( | |
RESET, 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_INS, KC_NO, \ | |
KC_TAB, KC_HOME, KC_UP, KC_END, KC_PGUP,KC_NO, KC_NO, KC_KP_0,KC_KP_7,KC_KP_8, KC_KP_9, KC_CALC, KC_F14, KC_NO, \ | |
F(0), KC_LEFT, KC_DOWN, KC_RIGHT,KC_PGDN,F(3), F(5), F(7), KC_KP_4,KC_KP_5, KC_KP_6, KC_F15, KC_F16, KC_MPLY, \ | |
KC_LSFT, KC_NO, BL_STEP, F(1), F(2), KC_NO, F(4), F(6), F(8), KC_KP_1,KC_KP_2, KC_KP_3, KC_VOLU, KC_NO, KC_NO, \ | |
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_MPRV, KC_VOLD, KC_MNXT, KC_NO), | |
}; | |
enum function_id { | |
RGBLED_TOGGLE, | |
RGBLED_STEP_MODE, | |
RGBLED_INCREASE_HUE, | |
RGBLED_DECREASE_HUE, | |
RGBLED_INCREASE_SAT, | |
RGBLED_DECREASE_SAT, | |
RGBLED_INCREASE_VAL, | |
RGBLED_DECREASE_VAL, | |
}; | |
// Custom Actions | |
const uint16_t PROGMEM fn_actions[] = { | |
[0] = ACTION_LAYER_MOMENTARY(1), // to Fn overlay | |
[1] = ACTION_FUNCTION(RGBLED_TOGGLE), | |
[2] = ACTION_FUNCTION(RGBLED_STEP_MODE), | |
[3] = ACTION_FUNCTION(RGBLED_INCREASE_HUE), | |
[4] = ACTION_FUNCTION(RGBLED_DECREASE_HUE), | |
[5] = ACTION_FUNCTION(RGBLED_INCREASE_SAT), | |
[6] = ACTION_FUNCTION(RGBLED_DECREASE_SAT), | |
[7] = ACTION_FUNCTION(RGBLED_INCREASE_VAL), | |
[8] = ACTION_FUNCTION(RGBLED_DECREASE_VAL), | |
}; | |
// Macros | |
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { | |
// MACRODOWN only works in this function | |
switch(id) { | |
case 0: | |
if (record->event.pressed) { register_code(KC_RSFT); } | |
else { unregister_code(KC_RSFT); } | |
break; | |
} | |
return MACRO_NONE; | |
}; | |
// Loop | |
void matrix_scan_user(void) { | |
// Empty | |
}; | |
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) | |
{ | |
switch(id) { | |
case RGBLED_TOGGLE: | |
if(record->event.pressed) { | |
rgblight_toggle(); | |
} | |
break; | |
case RGBLED_STEP_MODE: | |
if(record->event.pressed) { | |
rgblight_step(); | |
} | |
break; | |
case RGBLED_INCREASE_HUE: | |
if(record->event.pressed) { | |
rgblight_increase_hue(); | |
} | |
break; | |
case RGBLED_DECREASE_HUE: | |
if(record->event.pressed) { | |
rgblight_decrease_hue(); | |
} | |
break; | |
case RGBLED_INCREASE_SAT: | |
if(record->event.pressed) { | |
rgblight_increase_sat(); | |
} | |
break; | |
case RGBLED_DECREASE_SAT: | |
if(record->event.pressed) { | |
rgblight_decrease_sat(); | |
} | |
break; | |
case RGBLED_INCREASE_VAL: | |
if(record->event.pressed) { | |
rgblight_increase_val(); | |
} | |
break; | |
case RGBLED_DECREASE_VAL: | |
if(record->event.pressed) { | |
rgblight_decrease_val(); | |
} | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment