Fixed indentation and now using quantum keycodes for rgblight

This commit is contained in:
Luiz Ribeiro 2017-07-04 11:12:42 -04:00
parent 60153e7bbc
commit 738b072bb0
4 changed files with 24 additions and 78 deletions

View file

@ -201,11 +201,11 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/rgblight.c SRC += $(QUANTUM_DIR)/rgblight.c
CIE1931_CURVE = yes CIE1931_CURVE = yes
LED_BREATHING_TABLE = yes LED_BREATHING_TABLE = yes
ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes) ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes)
OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER
else else
SRC += $(QUANTUM_DIR)/light_ws2812.c SRC += $(QUANTUM_DIR)/light_ws2812.c
endif endif
endif endif
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)

View file

@ -20,79 +20,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "rgblight.h" #include "rgblight.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_KEYMAP( [0] = KEYMAP(
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,HOME,END, 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_PSCR,KC_HOME,KC_END,
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, DEL, 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_BSPC, KC_DEL,
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BS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, 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,
RGBLED_DECREASE_HUE, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_RGHT
RGBLED_INCREASE_SAT, ),
RGBLED_DECREASE_SAT,
RGBLED_INCREASE_VAL,
RGBLED_DECREASE_VAL,
}; };
const uint16_t PROGMEM fn_actions[] = { const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_FUNCTION(RGBLED_TOGGLE), [0] = ACTION_LAYER_MOMENTARY(1),
[1] = ACTION_FUNCTION(RGBLED_STEP_MODE),
[2] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
[3] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
[4] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
[5] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
[6] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
[7] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
};
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;
}
}; };

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python3 #!/usr/bin/env python
# Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com> # Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify

View file

@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef KEYMAP_COMMON_H #ifndef KEYMAP_COMMON_H
#define KEYMAP_COMMON_H #define KEYMAP_COMMON_H
#include "quantum_keycodes.h"
#include "keycode.h" #include "keycode.h"
#include "action.h" #include "action.h"