RGBW lights
This commit is contained in:
parent
d465e3f0c3
commit
b8679bbe04
6 changed files with 39 additions and 5 deletions
|
@ -1,6 +1,8 @@
|
||||||
#ifndef KEYBOARDS_ERGODOX_CONFIG_H_
|
#ifndef KEYBOARDS_ERGODOX_CONFIG_H_
|
||||||
#define KEYBOARDS_ERGODOX_CONFIG_H_
|
#define KEYBOARDS_ERGODOX_CONFIG_H_
|
||||||
|
|
||||||
|
#include "config_common.h"
|
||||||
|
|
||||||
#define MOUSEKEY_DELAY 100
|
#define MOUSEKEY_DELAY 100
|
||||||
#define MOUSEKEY_INTERVAL 20
|
#define MOUSEKEY_INTERVAL 20
|
||||||
#define MOUSEKEY_MAX_SPEED 3
|
#define MOUSEKEY_MAX_SPEED 3
|
||||||
|
|
5
keyboards/ergodox/keymaps/jack/Makefile
Normal file
5
keyboards/ergodox/keymaps/jack/Makefile
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
RGBLIGHT_ENABLE = yes
|
||||||
|
|
||||||
|
ifndef QUANTUM_DIR
|
||||||
|
include ../../../../Makefile
|
||||||
|
endif
|
14
keyboards/ergodox/keymaps/jack/config.h
Normal file
14
keyboards/ergodox/keymaps/jack/config.h
Normal 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
|
|
@ -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_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,
|
KC_NO, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_ENT,
|
||||||
MO(1), KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,
|
MO(1), KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,
|
||||||
KC_NO, KC_NO,
|
RGB_TOG, RGB_HUI,
|
||||||
KC_PGUP,
|
KC_PGUP,
|
||||||
KC_PGDN, KC_SPC,KC_SPC
|
KC_PGDN, KC_SPC,KC_SPC
|
||||||
),
|
),
|
||||||
|
@ -90,7 +90,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||||
|
|
||||||
// Runs just one time when the keyboard initializes.
|
// Runs just one time when the keyboard initializes.
|
||||||
void matrix_init_user(void) {
|
void matrix_init_user(void) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Runs constantly in the background, in a loop.
|
// Runs constantly in the background, in a loop.
|
||||||
|
|
|
@ -50,7 +50,11 @@ const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {100, 50, 20};
|
||||||
|
|
||||||
rgblight_config_t rgblight_config;
|
rgblight_config_t rgblight_config;
|
||||||
rgblight_config_t inmem_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;
|
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) {
|
void rgblight_set(void) {
|
||||||
if (rgblight_config.enable) {
|
if (rgblight_config.enable) {
|
||||||
ws2812_setleds(led, RGBLED_NUM);
|
#ifdef RGBW
|
||||||
|
ws2812_setleds_rgbw(led, RGBLED_NUM);
|
||||||
|
#else
|
||||||
|
ws2812_setleds(led, RGBLED_NUM);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
||||||
led[i].r = 0;
|
led[i].r = 0;
|
||||||
led[i].g = 0;
|
led[i].g = 0;
|
||||||
led[i].b = 0;
|
led[i].b = 0;
|
||||||
}
|
}
|
||||||
ws2812_setleds(led, RGBLED_NUM);
|
#ifdef RGBW
|
||||||
|
ws2812_setleds_rgbw(led, RGBLED_NUM);
|
||||||
|
#else
|
||||||
|
ws2812_setleds(led, RGBLED_NUM);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef RGBLIGHT_H
|
#ifndef RGBLIGHT_H
|
||||||
#define RGBLIGHT_H
|
#define RGBLIGHT_H
|
||||||
|
|
||||||
|
#define RGBW 1
|
||||||
|
|
||||||
#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
|
#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
|
||||||
#define RGBLIGHT_MODES 23
|
#define RGBLIGHT_MODES 23
|
||||||
|
|
Loading…
Reference in a new issue