RGBW lights

This commit is contained in:
Jack Humbert 2016-10-05 20:41:33 -04:00
parent d465e3f0c3
commit b8679bbe04
6 changed files with 39 additions and 5 deletions

View file

@ -1,6 +1,8 @@
#ifndef KEYBOARDS_ERGODOX_CONFIG_H_
#define KEYBOARDS_ERGODOX_CONFIG_H_
#include "config_common.h"
#define MOUSEKEY_DELAY 100
#define MOUSEKEY_INTERVAL 20
#define MOUSEKEY_MAX_SPEED 3

View file

@ -0,0 +1,5 @@
RGBLIGHT_ENABLE = yes
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

View file

@ -0,0 +1,14 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
/* ws2812 RGB LED */
#define RGB_DI_PIN D7
// #define RGBLIGHT_TIMER
#define RGBLED_NUM 20 // Number of LEDs
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
#endif

View file

@ -24,7 +24,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
KC_NO, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_ENT,
MO(1), KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,
KC_NO, KC_NO,
RGB_TOG, RGB_HUI,
KC_PGUP,
KC_PGDN, KC_SPC,KC_SPC
),

View file

@ -50,7 +50,11 @@ const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {100, 50, 20};
rgblight_config_t rgblight_config;
rgblight_config_t inmem_config;
struct cRGB led[RGBLED_NUM];
#ifdef RGBW
struct cRGBW led[RGBLED_NUM];
#else
struct cRGB led[RGBLED_NUM];
#endif
uint8_t rgblight_inited = 0;
@ -334,14 +338,22 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
void rgblight_set(void) {
if (rgblight_config.enable) {
#ifdef RGBW
ws2812_setleds_rgbw(led, RGBLED_NUM);
#else
ws2812_setleds(led, RGBLED_NUM);
#endif
} else {
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
led[i].r = 0;
led[i].g = 0;
led[i].b = 0;
}
#ifdef RGBW
ws2812_setleds_rgbw(led, RGBLED_NUM);
#else
ws2812_setleds(led, RGBLED_NUM);
#endif
}
}

View file

@ -1,6 +1,7 @@
#ifndef RGBLIGHT_H
#define RGBLIGHT_H
#define RGBW 1
#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
#define RGBLIGHT_MODES 23