1
0
tmk_keyboard/keyboard/luddite/keymap_luddite.c

109 lines
4.0 KiB
C
Raw Normal View History

2018-04-12 00:49:34 +00:00
#include "keymap_common.h"
#include "rgblight.h"
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,
};
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
/* 0: qwerty
* ,-----------------------------------------------------------.
* |` | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Bsp |
* |-----------------------------------------------------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |
* |-----------------------------------------------------------|
* |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter |
* |-----------------------------------------------------------|
* | Shft | Z| X| C| V| B| N| M| ,| .| /| Shift |
* |-----------------------------------------------------------'
* |Ctrl|Gui |Alt | Space |Alt |App |Ctrl| FN |
* `-----------------------------------------------------------'
*/
[0] = KEYMAP( \
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
FN2, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT, \
LCTL,LGUI,LALT, SPC, RALT, APP,RCTL,FN0),
[1] = KEYMAP( \
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS,BSPC, \
TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,PENT, \
TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS,TRNS, \
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS),
[2] = KEYMAP( \
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
TRNS,FN12,FN13,FN4, FN5, FN6, FN7, FN8, FN9, FN10,FN11,TRNS, \
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS),
};
const action_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1),
[1] = ACTION_LAYER_MOMENTARY(2),
[2] = ACTION_LAYER_TAP_KEY(2, KC_TAB),
[3] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ENT),
[4] = ACTION_FUNCTION(RGBLED_TOGGLE),
[5] = ACTION_FUNCTION(RGBLED_STEP_MODE),
[6] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
[7] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
[8] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
[9] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
[10] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
[11] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
[12] = ACTION_BACKLIGHT_DECREASE(),
[13] = ACTION_BACKLIGHT_INCREASE(),
};
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_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;
case RGBLED_STEP_MODE:
if (record->event.pressed) {
rgblight_step();
}
break;
}
}