From 57e08eb8badc5db2fb44d2df684f32ea48cce411 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Thu, 7 Jul 2016 11:33:32 -0400 Subject: updates rgblight implementation, makes non-timer stuff compatible with audio --- keyboards/clueboard/rev1/config.h | 5 +- keyboards/clueboard/rev2/config.h | 5 +- keyboards/cluepad/config.h | 13 +++-- keyboards/kc60/keymaps/ws2812/config.h | 5 +- keyboards/lets_split/config.h | 5 +- keyboards/phantom/config.h | 13 +++-- keyboards/planck/keymaps/experimental/Makefile | 6 +-- keyboards/planck/keymaps/experimental/config.h | 8 +++ keyboards/planck/keymaps/experimental/keymap.c | 73 ++++++++++++++++++++++++-- keyboards/planck/keymaps/pvc/config.h | 5 +- keyboards/planck/keymaps/yang/config.h | 5 +- keyboards/preonic/config.h | 5 +- keyboards/satan/config.h | 14 ++--- 13 files changed, 113 insertions(+), 49 deletions(-) (limited to 'keyboards') diff --git a/keyboards/clueboard/rev1/config.h b/keyboards/clueboard/rev1/config.h index 9bb58f56e..8c9497232 100644 --- a/keyboards/clueboard/rev1/config.h +++ b/keyboards/clueboard/rev1/config.h @@ -25,9 +25,8 @@ /* Underlight configuration */ -#define ws2812_PORTREG PORTB -#define ws2812_DDRREG DDRB -#define ws2812_pin 2 +#define RGB_DI_PIN B2 +#define RGBLIGHT_TIMER #define RGBLED_NUM 14 // Number of LEDs #define RGBLIGHT_HUE_STEP 10 #define RGBLIGHT_SAT_STEP 17 diff --git a/keyboards/clueboard/rev2/config.h b/keyboards/clueboard/rev2/config.h index e2f8336be..02982ff29 100644 --- a/keyboards/clueboard/rev2/config.h +++ b/keyboards/clueboard/rev2/config.h @@ -29,9 +29,8 @@ /* Underlight configuration */ -#define ws2812_PORTREG PORTD -#define ws2812_DDRREG DDRD -#define ws2812_pin 7 +#define RGB_DI_PIN D7 +#define RGBLIGHT_TIMER #define RGBLED_NUM 14 // Number of LEDs #define RGBLIGHT_HUE_STEP 10 #define RGBLIGHT_SAT_STEP 17 diff --git a/keyboards/cluepad/config.h b/keyboards/cluepad/config.h index 0955e0f70..bae05fade 100644 --- a/keyboards/cluepad/config.h +++ b/keyboards/cluepad/config.h @@ -69,13 +69,12 @@ along with this program. If not, see . /* Underlight configuration */ - #define ws2812_PORTREG PORTF - #define ws2812_DDRREG DDRF - #define ws2812_pin 6 - #define RGBLED_NUM 4 // Number of LEDs - #define RGBLIGHT_HUE_STEP 10 - #define RGBLIGHT_SAT_STEP 17 - #define RGBLIGHT_VAL_STEP 17 +#define RGB_DI_PIN F6 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 4 // Number of LEDs +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 /* * Feature disable options diff --git a/keyboards/kc60/keymaps/ws2812/config.h b/keyboards/kc60/keymaps/ws2812/config.h index 933bb0d2d..2f39ea8e5 100644 --- a/keyboards/kc60/keymaps/ws2812/config.h +++ b/keyboards/kc60/keymaps/ws2812/config.h @@ -1,9 +1,8 @@ #include "../../config.h" /* WS2812B RGB Underglow LED */ -#define ws2812_PORTREG PORTF -#define ws2812_DDRREG DDRF -#define ws2812_pin PF5 // Based on wiring depicted in ws2812_wiring.jpg +#define RGB_DI_PIN F5 // Based on wiring depicted in ws2812_wiring.jpg +#define RGBLIGHT_TIMER #define RGBLED_NUM 16 // Number of LEDs. Change this to match your use case. #define RGBLIGHT_HUE_STEP 8 #define RGBLIGHT_SAT_STEP 8 diff --git a/keyboards/lets_split/config.h b/keyboards/lets_split/config.h index 6f90997ab..833818ce6 100644 --- a/keyboards/lets_split/config.h +++ b/keyboards/lets_split/config.h @@ -69,9 +69,8 @@ along with this program. If not, see . ) /* ws2812 RGB LED */ -#define ws2812_PORTREG PORTD -#define ws2812_DDRREG DDRD -#define ws2812_pin PD1 +#define RGB_DI_PIN D2 +#define RGBLIGHT_TIMER #define RGBLED_NUM 28 // Number of LEDs #define RGBLIGHT_HUE_STEP 10 #define RGBLIGHT_SAT_STEP 17 diff --git a/keyboards/phantom/config.h b/keyboards/phantom/config.h index d5878766f..983a1d73f 100644 --- a/keyboards/phantom/config.h +++ b/keyboards/phantom/config.h @@ -62,13 +62,12 @@ along with this program. If not, see . /* Underlight configuration */ - #define ws2812_PORTREG PORTE - #define ws2812_DDRREG DDRE - #define ws2812_pin 2 - #define RGBLED_NUM 20 // Number of LEDs - #define RGBLIGHT_HUE_STEP 10 - #define RGBLIGHT_SAT_STEP 17 - #define RGBLIGHT_VAL_STEP 17 +#define RGB_DI_PIN E2 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 20 // Number of LEDs +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 /* * Feature disable options diff --git a/keyboards/planck/keymaps/experimental/Makefile b/keyboards/planck/keymaps/experimental/Makefile index 581e08cd0..877c4aed0 100644 --- a/keyboards/planck/keymaps/experimental/Makefile +++ b/keyboards/planck/keymaps/experimental/Makefile @@ -10,12 +10,12 @@ EXTRAKEY_ENABLE = yes # Audio control and System control(+450) CONSOLE_ENABLE = no # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls -AUDIO_ENABLE = yes # Audio output on port C6 +AUDIO_ENABLE = no # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend diff --git a/keyboards/planck/keymaps/experimental/config.h b/keyboards/planck/keymaps/experimental/config.h index 985e250ab..52acd1905 100644 --- a/keyboards/planck/keymaps/experimental/config.h +++ b/keyboards/planck/keymaps/experimental/config.h @@ -6,4 +6,12 @@ #define LEADER_TIMEOUT 300 #define BACKLIGHT_BREATHING + +/* ws2812 RGB LED */ +#define RGB_DI_PIN B1 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 8 // Number of LEDs +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 + #endif diff --git a/keyboards/planck/keymaps/experimental/keymap.c b/keyboards/planck/keymaps/experimental/keymap.c index 8ec335d7d..d9303fcae 100644 --- a/keyboards/planck/keymaps/experimental/keymap.c +++ b/keyboards/planck/keymaps/experimental/keymap.c @@ -15,7 +15,7 @@ extern keymap_config_t keymap_config; // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QWERTY 0 +#define _QWERTY 10 #define _COLEMAK 1 #define _DVORAK 2 #define _LOWER 3 @@ -31,7 +31,15 @@ enum planck_keycodes { LOWER, RAISE, BACKLIT, - EXT_PLV + EXT_PLV, + RGBLED_TOGGLE, + RGBLED_STEP_MODE, + RGBLED_INCREASE_HUE, + RGBLED_DECREASE_HUE, + RGBLED_INCREASE_SAT, + RGBLED_DECREASE_SAT, + RGBLED_INCREASE_VAL, + RGBLED_DECREASE_VAL, }; // Fillers to make layering more clear @@ -39,14 +47,20 @@ enum planck_keycodes { #define XXXXXXX KC_NO const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { + {KC_NO, KC_NO, KC_NO, KC_NO, RGBLED_TOGGLE, RGBLED_STEP_MODE, RGBLED_INCREASE_HUE, RGBLED_DECREASE_HUE, RGBLED_INCREASE_SAT, RGBLED_DECREASE_SAT, RGBLED_INCREASE_VAL, RGBLED_DECREASE_VAL}, + {KC_NO, KC_NO, KC_NO, KC_NO, RGBLED_TOGGLE, RGBLED_STEP_MODE, RGBLED_INCREASE_HUE, RGBLED_DECREASE_HUE, RGBLED_INCREASE_SAT, RGBLED_DECREASE_SAT, RGBLED_INCREASE_VAL, RGBLED_DECREASE_VAL}, + {KC_NO, KC_NO, KC_NO, KC_NO, RGBLED_TOGGLE, RGBLED_STEP_MODE, RGBLED_INCREASE_HUE, RGBLED_DECREASE_HUE, RGBLED_INCREASE_SAT, RGBLED_DECREASE_SAT, RGBLED_INCREASE_VAL, RGBLED_DECREASE_VAL}, + {KC_NO, KC_NO, KC_NO, KC_NO, RGBLED_TOGGLE, RGBLED_STEP_MODE, RGBLED_INCREASE_HUE, RGBLED_DECREASE_HUE, RGBLED_INCREASE_SAT, RGBLED_DECREASE_SAT, RGBLED_INCREASE_VAL, RGBLED_DECREASE_VAL} +}, /* Qwerty - * ,-----------------------------------------------------------------------------------. + ,-----------------------------------------------------------------------------------. * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | * |------+------+------+------+------+-------------+------+------+------+------+------| * | Esc | A | S | D | F | G | H | J | K | L | ; | " | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * | Shift| Z | X | C | V | B | N | M |, | . | / |Enter | * |------+------+------+------+------+------+------+------+------+------+------+------| * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | * `-----------------------------------------------------------------------------------' @@ -292,6 +306,57 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; return false; + case RGBLED_TOGGLE: + //led operations + if (record->event.pressed) { + rgblight_toggle(); + } + return false; + break; + case RGBLED_INCREASE_HUE: + if (record->event.pressed) { + rgblight_increase_hue(); + } + return false; + break; + case RGBLED_DECREASE_HUE: + if (record->event.pressed) { + rgblight_decrease_hue(); + } + return false; + break; + case RGBLED_INCREASE_SAT: + if (record->event.pressed) { + rgblight_increase_sat(); + } + return false; + break; + case RGBLED_DECREASE_SAT: + if (record->event.pressed) { + rgblight_decrease_sat(); + } + return false; + break; + case RGBLED_INCREASE_VAL: + if (record->event.pressed) { + rgblight_increase_val(); + } + return false; + break; + case RGBLED_DECREASE_VAL: + if (record->event.pressed) { + rgblight_decrease_val(); + } + return false; + break; + case RGBLED_STEP_MODE: + if (record->event.pressed) { + rgblight_step(); + } + return false; + break; + + } return true; }; diff --git a/keyboards/planck/keymaps/pvc/config.h b/keyboards/planck/keymaps/pvc/config.h index b64893108..c857a3e89 100644 --- a/keyboards/planck/keymaps/pvc/config.h +++ b/keyboards/planck/keymaps/pvc/config.h @@ -60,9 +60,8 @@ along with this program. If not, see . ) /* ws2812 RGB LED */ -#define ws2812_PORTREG PORTD -#define ws2812_DDRREG DDRD -#define ws2812_pin PD1 +#define RGB_DI_PIN D1 +#define RGBLIGHT_TIMER #define RGBLED_NUM 28 // Number of LEDs #define RGBLIGHT_HUE_STEP 10 #define RGBLIGHT_SAT_STEP 17 diff --git a/keyboards/planck/keymaps/yang/config.h b/keyboards/planck/keymaps/yang/config.h index 5921e9377..feb5a1190 100644 --- a/keyboards/planck/keymaps/yang/config.h +++ b/keyboards/planck/keymaps/yang/config.h @@ -4,9 +4,8 @@ #include "../../config.h" /* ws2812 RGB LED */ -#define ws2812_PORTREG PORTD -#define ws2812_DDRREG DDRD -#define ws2812_pin PD1 +#define RGB_DI_PIN D1 +#define RGBLIGHT_TIMER #define RGBLED_NUM 28 // Number of LEDs #define RGBLIGHT_HUE_STEP 10 #define RGBLIGHT_SAT_STEP 17 diff --git a/keyboards/preonic/config.h b/keyboards/preonic/config.h index 04946f7fb..3fb978c2f 100644 --- a/keyboards/preonic/config.h +++ b/keyboards/preonic/config.h @@ -62,9 +62,8 @@ along with this program. If not, see . ) /* ws2812 RGB LED */ -#define ws2812_PORTREG PORTD -#define ws2812_DDRREG DDRD -#define ws2812_pin PD1 +#define RGB_DI_PIN D1 +#define RGBLIGHT_TIMER #define RGBLED_NUM 28 // Number of LEDs #define RGBLIGHT_HUE_STEP 10 #define RGBLIGHT_SAT_STEP 17 diff --git a/keyboards/satan/config.h b/keyboards/satan/config.h index a7ea8f904..7e9f91cc8 100644 --- a/keyboards/satan/config.h +++ b/keyboards/satan/config.h @@ -65,13 +65,13 @@ along with this program. If not, see . /* Underlight configuration */ - #define ws2812_PORTREG PORTE - #define ws2812_DDRREG DDRE - #define ws2812_pin 2 - #define RGBLED_NUM 8 // Number of LEDs - #define RGBLIGHT_HUE_STEP 10 - #define RGBLIGHT_SAT_STEP 17 - #define RGBLIGHT_VAL_STEP 17 + +#define RGB_DI_PIN E2 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 8 // Number of LEDs +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 /* * Feature disable options -- cgit v1.2.3