summaryrefslogtreecommitdiffstats
path: root/keyboards/planck
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-07-07 11:33:32 -0400
committerJack Humbert <jack.humb@gmail.com>2016-07-07 11:33:34 -0400
commit57e08eb8badc5db2fb44d2df684f32ea48cce411 (patch)
tree51eede58af359c5c98a080ae359b545a23dd5ad8 /keyboards/planck
parentad43d450ca1b988d196da80e2a745f45f24068f6 (diff)
updates rgblight implementation, makes non-timer stuff compatible with audio
Diffstat (limited to 'keyboards/planck')
-rw-r--r--keyboards/planck/keymaps/experimental/Makefile6
-rw-r--r--keyboards/planck/keymaps/experimental/config.h8
-rw-r--r--keyboards/planck/keymaps/experimental/keymap.c73
-rw-r--r--keyboards/planck/keymaps/pvc/config.h5
-rw-r--r--keyboards/planck/keymaps/yang/config.h5
5 files changed, 84 insertions, 13 deletions
diff --git a/keyboards/planck/keymaps/experimental/Makefile b/keyboards/planck/keymaps/experimental/Makefile
index 581e08cd02..877c4aed0e 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 985e250ab5..52acd1905e 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 8ec335d7d2..d9303fcae5 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 b648931081..c857a3e89d 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 <http://www.gnu.org/licenses/>.
)
/* 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 5921e9377c..feb5a11901 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