1
0
Fork 0

RGB improvements (#1684)

* Allow the knight animation to be restricted to a portion of the LED strip

* Add keys for jumping directly to particular animation modes

* Remove orphaned break statements

* Tweak the `RGB_MODE` buttons so they cycle through the same mode.

* small indentation fix
This commit is contained in:
skullydazed 2017-09-06 14:49:19 -07:00 committed by GitHub
parent 0ce45eb0b7
commit 4580d3a730
8 changed files with 699 additions and 95 deletions

View File

@ -1,8 +1,107 @@
# RGB Lighting # RGB Lighting
<!-- FIXME: Describe how to use RGB Lighting here. --> If you've installed addressable RGB lights on your keyboard you can control them with QMK. Currently we support the following addressable LEDs on Atmel AVR processors:
## RGB Under Glow Mod * WS2811 and variants (WS2812, WS2812B, WS2812C, etc)
* SK6812RGBW
Some keyboards come with RGB LEDs pre-installed. Others have to have LEDs installed after the fact. See below for information on modifying your keyboard.
## Selecting Colors
QMK uses Hue, Saturation, and Value to set color rather than using RGB. You can use the color wheel below to see how this works. Changing the Hue will cycle around the circle. Saturation will affect the intensity of the color, which you can see as you move from the inner part to the outer part of the wheel. Value sets the overall brightness.
![gitbook/images/color-wheel.svg]
If you would like to learn more about HSV you can start with the [wikipedia article](https://en.wikipedia.org/wiki/HSL_and_HSV).
## Configuration
Before RGB Lighting can be used you have to enable it in `rules.mk`:
RGBLIGHT_ENABLE = yes
You can configure the behavior of the RGB lighting by defining values inside `config.h`.
### Required Configuration
At minimum you have to define the pin your LED strip is connected to and the number of LEDs connected.
```c
#define RGB_DI_PIN D7 // The pin the LED strip is connected to
#define RGBLED_NUM 14 // Number of LEDs in your strip
```
### Optional Configuration
You can change the behavior of the RGB Lighting by setting these configuration values. Use `#define <Option> <Value>` in a `config.h` at the keyboard, revision, or keymap level.
| Option | Default Value | Description |
|--------|---------------|-------------|
| `RGBLIGHT_HUE_STEP` | 10 | How many hues you want to have available. |
| `RGBLIGHT_SAT_STEP` | 17 | How many steps of saturation you'd like. |
| `RGBLIGHT_VAL_STEP` | 17 | The number of levels of brightness you want. |
### Animations
If you have `#define RGBLIGHT_ANIMATIONS` in your `config.h` you will have a number of animation modes you can cycle through using the `RGB_MOD` key. You can also `#define` other options to tweak certain animations.
| Option | Default Value | Description |
|--------|---------------|-------------|
| `RGBLIGHT_ANIMATIONS` | | `#define` this to enable animation modes. |
| `RGBLIGHT_EFFECT_SNAKE_LENGTH` | 4 | The number of LEDs to light up for the "snake" mode. |
| `RGBLIGHT_EFFECT_KNIGHT_LENGTH` | 3 | The number of LEDs to light up for the "knight" mode. |
| `RGBLIGHT_EFFECT_KNIGHT_OFFSET` | 0 | Start the knight animation this many LEDs from the start of the strip. |
| `RGBLIGHT_EFFECT_KNIGHT_LED_NUM` | RGBLED_NUM | The number of LEDs to have the "knight" animation travel. |
| `RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL` | 1000 | How long to wait between light changes for the "christmas" animation. Specified in ms. |
| `RGBLIGHT_EFFECT_CHRISTMAS_STEP` | 2 | How many LED's to group the red/green colors by for the christmas mode. |
You can also tweak the behavior of the animations by defining these consts in your `keymap.c`. These mostly affect the speed different modes animate at.
```c
// How long (in ms) to wait between animation steps for the breathing mode
const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5};
// How long (in ms) to wait between animation steps for the rainbow mode
const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {120, 60, 30};
// How long (in ms) to wait between animation steps for the swirl mode
const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {100, 50, 20};
// How long (in ms) to wait between animation steps for the snake mode
const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 50, 20};
// How long (in ms) to wait between animation steps for the knight modes
const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {127, 63, 31};
// These control which colors are selected for the gradient mode
const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90};
```
## RGB Lighting Keycodes
These control the RGB Lighting functionality.
| Long Name | Short Name | Description |
|-----------|------------|-------------|
||`RGB_TOG`|toggle on/off|
||`RGB_MOD`|cycle through modes|
||`RGB_HUI`|hue increase|
||`RGB_HUD`|hue decrease|
||`RGB_SAI`|saturation increase|
||`RGB_SAD`|saturation decrease|
||`RGB_VAI`|value (brightness) increase|
||`RGB_VAD`|value (brightness) decrease|
|`RGB_MODE_PLAIN`|`RGB_M_P `| Switch to the static no animation mode |
|`RGB_MODE_BREATHE`|`RGB_M_B`| Switch to the breathing mode |
|`RGB_MODE_RAINBOW`|`RGB_M_R`| Switch to the rainbow mode ||
|`RGB_MODE_SWIRL`|`RGB_M_SW`| Switch to the swirl mode |
|`RGB_MODE_SNAKE`|`RGB_M_SN`| Switch to the snake mode |
|`RGB_MODE_KNIGHT`|`RGB_M_K`| Switch to the knight animation |
|`RGB_MODE_XMAS`|`RGB_M_X`| Switch to the Christmas animation |
|`RGB_MODE_GRADIENT`|`RGB_M_G`| Switch to the static gradient mode |
## Hardware Modification
![Planck with RGB Underglow](https://raw.githubusercontent.com/qmk/qmk_firmware/master/keyboards/planck/keymaps/yang/planck-with-rgb-underglow.jpg) ![Planck with RGB Underglow](https://raw.githubusercontent.com/qmk/qmk_firmware/master/keyboards/planck/keymaps/yang/planck-with-rgb-underglow.jpg)
@ -17,33 +116,6 @@ In order to use the underglow animation functions, you need to have `#define RGB
Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the `F4` pin by default: Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the `F4` pin by default:
#define RGB_DI_PIN F4 // The pin your RGB strip is wired to #define RGB_DI_PIN F4 // The pin your RGB strip is wired to
#define RGBLIGHT_ANIMATIONS // Require for fancier stuff (not compatible with audio)
#define RGBLED_NUM 14 // Number of LEDs #define RGBLED_NUM 14 // Number of LEDs
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17
You'll need to edit `RGB_DI_PIN` to the pin you have your `DI` on your RGB strip wired to. You'll need to edit `RGB_DI_PIN` to the pin you have your `DI` on your RGB strip wired to.
The firmware supports 5 different light effects, and the color (hue, saturation, brightness) can be customized in most effects. To control the underglow, you need to modify your keymap file to assign those functions to some keys/key combinations. For details, please check this keymap. `keyboards/planck/keymaps/yang/keymap.c`
### WS2812 Wiring
![WS2812 Wiring](https://raw.githubusercontent.com/qmk/qmk_firmware/master/keyboards/planck/keymaps/yang/WS2812-wiring.jpg)
Please note the USB port can only supply a limited amount of power to the keyboard (500mA by standard, however, modern computer and most usb hubs can provide 700+mA.). According to the data of NeoPixel from Adafruit, 30 WS2812 LEDs require a 5V 1A power supply, LEDs used in this mod should not more than 20.
## RGB Lighting Keycodes
This controls the RGB Lighting functionality. Most keyboards use WS2812 (and compatible) LEDs for underlight or case lighting.
|Name|Description|
|----|-----------|
|`RGB_TOG`|toggle on/off|
|`RGB_MOD`|cycle through modes|
|`RGB_HUI`|hue increase|
|`RGB_HUD`|hue decrease|
|`RGB_SAI`|saturation increase|
|`RGB_SAD`|saturation decrease|
|`RGB_VAI`|value increase|
|`RGB_VAD`|value decrease|

View File

@ -0,0 +1,441 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2000/svg"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:ns1="http://sozi.baierouge.fr"
xmlns:cc="http://web.resource.org/cc/"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
id="Layer_1"
enable-background="new 0 0 360 360"
xml:space="preserve"
viewBox="0 0 360 360"
version="1.1"
y="0px"
x="0px"
>
<g
>
</g
>
<g
>
<g
>
<path
d="m193.8 167.46l113.52-113.89c-23.457-23.36-50.2-38.727-82.193-47.23l-41.313 155.45c3.15 0.84 7.66 3.37 9.98 5.67z"
fill="#E0C3D3"
/>
<path
d="m209.95 151.26l97.367-97.688c-23.457-23.36-50.2-38.727-82.193-47.23l-35.43 133.29c7.71 1.86 14.76 5.91 20.25 11.63z"
fill="#E0A0C3"
/>
<path
d="m225.94 135.21l81.375-81.643c-23.457-23.36-50.2-38.727-82.193-47.23l-29.61 111.4c11.55 2.89 22.11 8.95 30.42 17.47z"
fill="#E080B5"
/>
<path
d="m241.95 119.15l65.369-65.585c-23.457-23.36-50.2-38.727-82.193-47.23l-23.784 89.491c15.38 3.919 29.46 12.004 40.6 23.324z"
fill="#E061A7"
/>
<path
d="m257.95 103.1l49.371-49.533c-23.457-23.36-50.2-38.727-82.193-47.23l-17.962 67.589c19.22 4.944 36.82 15.052 50.78 29.174z"
fill="#E04198"
/>
<path
d="m273.95 87.05l33.373-33.482c-23.457-23.36-50.2-38.727-82.193-47.23l-12.142 45.687c23.07 5.968 44.18 18.099 60.96 35.025z"
fill="#E0228B"
/>
<path
d="m289.94 70.999l17.375-17.431c-23.457-23.36-50.2-38.728-82.193-47.231l-6.321 23.784c26.91 6.994 51.54 21.148 71.13 40.878z"
fill="#E10071"
/>
</g
>
<g
>
<path
d="m174.73 162.13c2.934-0.792 6.094-0.876 8.876-0.292l41-155.36c-31.994-8.502-61.625-8.332-93.483 0.274l42.101 155.85c-0.01-0.02 1.13-0.37 1.5-0.47z"
fill="#FFD9D9"
/>
<path
d="m168.93 139.99c6.926-1.871 14.036-1.906 20.556-0.349l35.12-133.16c-31.994-8.502-61.625-8.332-93.483 0.274l36.127 133.73c0.95-0.27 1.19-0.36 1.67-0.49z"
fill="#FFB6B6"
/>
<path
d="m163.03 118.12c10.904-2.946 22.03-2.917 32.267-0.373l29.31-111.27c-31.994-8.502-61.625-8.332-93.483 0.274l30.218 111.86c0.96-0.27 1.19-0.36 1.68-0.49z"
fill="#FF8F8F"
/>
<path
d="m157.12 96.243c14.884-4.021 30.029-3.944 43.982-0.413l23.51-89.354c-31.994-8.502-61.625-8.332-93.483 0.274l24.304 89.968c0.96-0.268 1.2-0.344 1.69-0.475z"
fill="#FF6E6E"
/>
<path
d="m151.21 74.369c18.863-5.096 38.024-4.964 55.695-0.446l17.71-67.447c-31.994-8.502-61.625-8.332-93.483 0.274l18.395 68.094c0.96-0.267 1.2-0.344 1.69-0.475z"
fill="#FF4848"
/>
<path
d="m145.06 52.56c22.919-6.191 46.298-6.016 67.745-0.456l11.81-45.628c-31.994-8.502-61.625-8.332-93.483 0.274l12.484 46.214c0.97-0.263 1.13-0.317 1.45-0.404z"
fill="#FF2424"
/>
<path
d="m139.15 30.685c26.906-7.269 54.312-7.036 79.48-0.483l5.978-23.726c-31.994-8.502-61.625-8.332-93.483 0.274l6.575 24.34c0.97-0.262 1.13-0.318 1.45-0.405z"
fill="#FF0000"
/>
</g
>
<g
>
<path
d="m173.23 162.6l-42.1-155.85c-31.858 8.606-56.824 23.185-80.185 46.64l114.57 114.36c2.08-2.33 4.86-4.17 7.71-5.15z"
fill="#FFEBD9"
/>
<path
d="m167.25 140.48l-36.12-133.73c-31.858 8.606-56.824 23.185-80.185 46.64l98.442 98.288c4.77-5.09 11.17-9.11 17.86-11.2z"
fill="#FFD7B3"
/>
<path
d="m161.34 118.61l-30.21-111.86c-31.858 8.606-56.824 23.185-80.185 46.64l82.386 82.283c7.49-7.82 17.47-13.93 28.01-17.06z"
fill="#FFC48F"
/>
<path
d="m155.43 96.719l-24.3-89.969c-31.858 8.606-56.824 23.185-80.185 46.64l66.336 66.282c10.2-10.55 23.74-18.78 38.15-22.951z"
fill="#FFB26C"
/>
<path
d="m149.52 74.845l-18.39-68.095c-31.858 8.606-56.824 23.185-80.185 46.64l50.287 50.283c12.91-13.273 30.02-23.612 48.29-28.825z"
fill="#FF9F48"
/>
<path
d="m143.61 52.964l-12.48-46.214c-31.858 8.606-56.824 23.185-80.185 46.64l34.05 34.204c15.705-16.028 35.495-28.198 58.615-34.63z"
fill="#FF8C24"
/>
<path
d="m137.7 31.091l-6.575-24.34c-31.858 8.606-56.824 23.185-80.185 46.64l17.99 18.216c18.435-18.762 41.795-33.041 68.775-40.516z"
fill="#FF8000"
/>
</g
>
<g
>
<path
d="m166.24 167.56l-114.82-114.3c-23.36 23.457-36.884 48.514-45.386 80.507l155.98 41.453c0.85-3.15 1.92-5.35 4.23-7.66z"
fill="#FFFED9"
/>
<path
d="m149.96 151.35l-98.535-98.09c-23.36 23.457-36.884 48.514-45.386 80.507l133.85 35.573c1.8-6.74 5.26-12.94 10.07-17.99z"
fill="#FFFDB3"
/>
<path
d="m133.9 135.37l-82.475-82.11c-23.36 23.457-36.884 48.514-45.386 80.507l111.95 29.753c2.82-10.58 8.31-20.29 15.91-28.15z"
fill="#FFFC8F"
/>
<path
d="m117.84 119.37l-66.415-66.11c-23.36 23.457-36.884 48.514-45.386 80.507l90.037 23.929c3.845-14.42 11.364-27.64 21.764-38.33z"
fill="#FFFB6C"
/>
<path
d="m101.78 103.39l-50.355-50.13c-23.36 23.457-36.884 48.514-45.386 80.507l68.136 18.108c4.869-18.26 14.403-34.99 27.605-48.49z"
fill="#FFFA48"
/>
<path
d="m85.716 87.398l-34.291-34.138c-23.36 23.457-36.884 48.514-45.386 80.507l46.235 12.288c5.893-22.09 17.445-42.34 33.442-58.662z"
fill="#FFF924"
/>
<path
d="m69.657 71.411l-18.232-18.151c-23.36 23.457-36.884 48.514-45.386 80.507l24.334 6.468c6.917-25.93 20.488-49.694 39.284-68.829z"
fill="#FFFF00"
/>
</g
>
<g
>
<path
d="m162.13 185.27c-0.792-2.934-0.647-7.06-0.061-9.842l-155.89-41.15c-8.503 31.994-8.034 62.733 0.572 94.591l155.85-42.1c-0.02 0.01-0.37-1.13-0.47-1.5z"
fill="#EBFFD9"
/>
<path
d="m139.99 191.07c-1.963-7.268-1.891-14.725-0.095-21.517l-133.72-35.27c-8.503 31.994-8.034 62.733 0.572 94.591l133.73-36.127c-0.27-0.96-0.36-1.19-0.49-1.67z"
fill="#D8FFB6"
/>
<path
d="m118.12 196.98c-3.039-11.249-2.905-22.722-0.121-33.231l-111.82-29.47c-8.503 31.994-8.034 62.733 0.572 94.591l111.86-30.218c-0.27-0.96-0.36-1.19-0.49-1.67z"
fill="#C5FF92"
/>
<path
d="m96.244 202.89c-4.114-15.228-3.942-30.725-0.169-44.949l-89.897-23.66c-8.503 31.994-8.034 62.733 0.572 94.591l89.968-24.304c-0.268-0.97-0.343-1.2-0.474-1.68z"
fill="#B1FF6C"
/>
<path
d="m74.371 208.8c-5.189-19.208-4.962-38.724-0.201-56.666l-67.992-17.85c-8.503 31.994-8.034 62.733 0.572 94.591l68.094-18.395c-0.267-0.96-0.343-1.2-0.473-1.68z"
fill="#9DFF48"
/>
<path
d="m52.563 214.95c-6.285-23.265-6.011-46.996-0.205-68.714l-46.18-11.96c-8.503 31.994-8.034 62.733 0.572 94.591l46.214-12.484c-0.263-0.97-0.315-1.12-0.401-1.44z"
fill="#8AFF24"
/>
<path
d="m30.688 220.86c-7.362-27.251-7.029-55.011-0.229-80.452l-24.28-6.125c-8.503 31.994-8.034 62.733 0.572 94.591l24.34-6.575c-0.264-0.97-0.317-1.12-0.403-1.44z"
fill="#71FF00"
/>
</g
>
<g
>
<path
d="m162.6 186.77l-155.85 42.1c8.606 31.857 23.185 56.824 46.641 80.185l114.36-114.57c-2.33-2.09-4.17-4.87-5.15-7.72z"
fill="#DCFFDC"
/>
<path
d="m140.48 192.75l-133.73 36.12c8.606 31.857 23.185 56.824 46.641 80.185l98.286-98.442c-5.1-4.78-9.11-11.18-11.2-17.87z"
fill="#B6FFB6"
/>
<path
d="m118.61 198.66l-111.86 30.21c8.606 31.857 23.185 56.824 46.641 80.185l82.281-82.387c-7.82-7.49-13.93-17.47-17.06-28.01z"
fill="#92FF92"
/>
<path
d="m96.719 204.57l-89.969 24.3c8.606 31.857 23.185 56.824 46.641 80.185l66.28-66.336c-10.55-10.2-18.78-23.74-22.951-38.15z"
fill="#6EFF6E"
/>
<path
d="m74.845 210.48l-68.095 18.39c8.606 31.857 23.185 56.824 46.641 80.185l50.281-50.287c-13.274-12.92-23.614-30.02-28.825-48.29z"
fill="#4AFF4A"
/>
<path
d="m52.964 216.39l-46.214 12.48c8.606 31.857 23.185 56.824 46.641 80.185l34.202-34.049c-16.028-15.71-28.198-35.5-34.629-58.62z"
fill="#27FF27"
/>
<path
d="m31.091 222.3l-24.34 6.575c8.606 31.857 23.185 56.824 46.641 80.185l18.214-17.989c-18.763-18.43-33.043-41.79-40.515-68.77z"
fill="#00FF00"
/>
</g
>
<g
>
<path
d="m167.59 193.87l-114.31 114.78c23.455 23.359 47.388 37.112 79.381 45.616l41.606-156.55c-3.16-0.85-4.37-1.55-6.68-3.85z"
fill="#DCFFED"
/>
<path
d="m151.42 210.11l-98.14 98.54c23.455 23.359 47.388 37.112 79.381 45.616l35.721-134.41c-6.34-1.86-12.17-5.21-16.96-9.75z"
fill="#B6FFD9"
/>
<path
d="m135.43 226.16l-82.15 82.49c23.455 23.359 47.388 37.112 79.381 45.616l29.9-112.51c-10.18-2.89-19.52-8.26-27.13-15.6z"
fill="#92FFC6"
/>
<path
d="m119.43 242.22l-66.15 66.43c23.456 23.359 47.388 37.112 79.381 45.616l24.079-90.603c-14.02-3.92-26.87-11.31-37.31-21.45z"
fill="#6EFFB3"
/>
<path
d="m103.44 258.28l-50.16 50.37c23.455 23.359 47.388 37.112 79.381 45.616l18.258-68.701c-17.86-4.95-34.22-14.35-47.48-27.29z"
fill="#4AFFA0"
/>
<path
d="m87.451 274.34l-34.17 34.31c23.455 23.359 47.388 37.112 79.381 45.616l12.438-46.801c-21.69-5.97-41.58-17.4-57.649-33.13z"
fill="#27FF8D"
/>
<path
d="m71.459 290.39l-18.179 18.26c23.455 23.359 47.388 37.112 79.381 45.616l6.618-24.9c-25.53-6.99-48.93-20.44-67.821-38.98z"
fill="#00FF80"
/>
</g
>
<g
>
<path
d="m173.85 197.82l-41.812 156.61c31.993 8.501 61.11 8.47 92.969-0.136l-42.101-155.85c-2.95 0.59-6.08 0.35-9.06-0.62z"
fill="#DCFFFE"
/>
<path
d="m167.98 219.87l-35.941 134.56c31.993 8.501 61.11 8.47 92.969-0.136l-36.127-133.73c-6.82 1.57-14.22 1.29-20.9-0.69z"
fill="#B6FFFD"
/>
<path
d="m162.15 241.77l-30.107 112.65c31.993 8.501 61.11 8.47 92.969-0.136l-30.219-111.86c-10.69 2.62-22.24 2.33-32.64-0.65z"
fill="#92FFFC"
/>
<path
d="m156.32 263.68l-24.276 90.754c31.993 8.501 61.11 8.47 92.969-0.136l-24.305-89.969c-14.54 3.66-30.26 3.33-44.38-0.64z"
fill="#6EFFFB"
/>
<path
d="m150.49 285.57l-18.446 68.856c31.993 8.501 61.11 8.47 92.969-0.136l-18.396-68.095c-18.41 4.7-38.28 4.34-56.12-0.63z"
fill="#4AFFFA"
/>
<path
d="m144.7 307.61l-12.655 46.815c31.993 8.501 61.11 8.47 92.969-0.136l-12.484-46.215c-23.22 6.1-46.19 5.49-67.83-0.45z"
fill="#27FFF9"
/>
<path
d="m138.88 329.52l-6.839 24.913c31.994 8.501 61.11 8.47 92.969-0.136l-6.575-24.341c-27.08 7.13-54.2 6.49-79.56-0.43z"
fill="#00FFFF"
/>
</g
>
<g
>
<path
d="m192.47 193.82c-2.109 1.906-5.088 3.48-8.022 4.273-0.373 0.101-1.527 0.377-1.533 0.354l42.101 155.85c31.857-8.606 57.647-23.407 81.009-46.862l-113.56-113.61z"
fill="#DCEFFF"
/>
<path
d="m208.69 210.01c-4.857 4.652-11.156 8.255-18.107 10.133-0.485 0.131-0.729 0.176-1.699 0.42l36.127 133.73c31.857-8.606 57.647-23.407 81.009-46.862l-97.33-97.42z"
fill="#B6DEFF"
/>
<path
d="m224.73 226.01c-7.572 7.374-17.307 13.052-28.233 16.004-0.486 0.131-0.732 0.17-1.701 0.42l30.219 111.86c31.857-8.606 57.647-23.407 81.009-46.862l-81.3-81.42z"
fill="#92CEFF"
/>
<path
d="m240.78 242.02c-10.285 10.097-23.467 17.838-38.372 21.864-0.484 0.131-0.729 0.186-1.696 0.438l24.305 89.969c31.857-8.606 57.647-23.407 81.009-46.862l-65.25-65.41z"
fill="#6EBEFF"
/>
<path
d="m208.31 285.76c-0.485 0.132-0.731 0.185-1.698 0.439l18.396 68.095c31.857-8.606 57.647-23.407 81.009-46.862l-49.444-49.336c-13 12.81-29.38 22.56-48.27 27.66z"
fill="#4AADFF"
/>
<path
d="m213.98 307.7c-0.324 0.088-0.49 0.122-1.456 0.38l12.484 46.215c31.857-8.606 57.647-23.407 81.009-46.862l-33.533-33.371c-15.72 15.59-35.58 27.44-58.5 33.63z"
fill="#279EFF"
/>
<path
d="m219.89 329.57c-0.325 0.088-0.491 0.121-1.457 0.38l6.575 24.341c31.857-8.606 57.647-23.407 81.009-46.862l-17.47-17.385c-18.43 18.34-41.75 32.27-68.65 39.53z"
fill="#0080FF"
/>
</g
>
<g
>
<path
d="m197.71 185.73c-0.843 3.153-2.941 5.768-5.242 8.083l113.97 113.5c23.359-23.456 39.325-47.987 47.829-79.98l-156.56-41.6z"
fill="#DCDCFF"
/>
<path
d="m219.85 191.62c-2.041 6.976-5.889 13.329-11.148 18.372l97.727 97.328c23.359-23.456 39.325-47.987 47.829-79.98l-134.41-35.72z"
fill="#B6B6FF"
/>
<path
d="m241.75 197.44c-3.064 10.814-8.936 20.677-16.995 28.538l81.675 81.342c23.359-23.456 39.325-47.987 47.829-79.98l-112.52-29.9z"
fill="#9292FF"
/>
<path
d="m263.66 203.26c-4.089 14.652-11.976 28.037-22.837 38.716l65.61 65.343c23.359-23.456 39.325-47.987 47.829-79.98l-90.6-24.08z"
fill="#6E6EFF"
/>
<path
d="m285.56 209.08c-5.112 18.491-15.019 35.392-28.682 48.887l49.554 49.352c23.359-23.456 39.325-47.987 47.829-79.98l-68.7-18.26z"
fill="#4A4AFF"
/>
<path
d="m307.46 214.9c-6.137 22.329-18.063 42.745-34.525 59.06l33.496 33.358c23.359-23.456 39.325-47.987 47.829-79.98l-46.81-12.44z"
fill="#2727FF"
/>
<path
d="m329.36 220.72c-7.161 26.167-21.104 50.1-40.368 69.23l17.438 17.366c23.359-23.456 39.325-47.987 47.829-79.98l-24.9-6.62z"
fill="#0000FF"
/>
</g
>
<g
>
<path
d="m198.44 177.09c0.588 2.949 0.342 6.08-0.624 9.056l156.61 41.813c8.501-31.994 8.47-61.111-0.136-92.969l-155.85 42.1z"
fill="#ECDCFF"
/>
<path
d="m220.56 171.12c1.57 6.827 1.293 14.228-0.688 20.901l134.56 35.941c8.501-31.994 8.47-61.111-0.136-92.969l-133.73 36.13z"
fill="#D8B6FF"
/>
<path
d="m242.43 165.21c2.612 10.689 2.32 22.245-0.657 32.643l112.65 30.108c8.501-31.994 8.47-61.111-0.136-92.969l-111.85 30.22z"
fill="#C492FF"
/>
<path
d="m264.32 159.29c3.655 14.55 3.324 30.265-0.649 44.388l90.754 24.277c8.501-31.994 8.47-61.111-0.136-92.969l-89.96 24.3z"
fill="#B16EFF"
/>
<path
d="m286.2 153.38c4.699 18.412 4.345 38.281-0.625 56.128l68.855 18.446c8.501-31.994 8.47-61.111-0.136-92.969l-68.1 18.39z"
fill="#9E4AFF"
/>
<path
d="m308.08 147.47c6.088 23.216 5.471 46.185-0.464 67.83l46.814 12.655c8.501-31.994 8.47-61.111-0.136-92.969l-46.21 12.48z"
fill="#8B27FF"
/>
<path
d="m329.95 141.56c7.131 27.078 6.49 54.192-0.435 79.554l24.911 6.84c8.501-31.994 8.47-61.111-0.136-92.969l-24.34 6.58z"
fill="#8000FF"
/>
</g
>
<g
>
<path
d="m198.09 175.56c0.101 0.374 0.377 1.528 0.354 1.534l155.85-42.101c-8.606-31.858-23.408-57.649-46.862-81.009l-113.63 113.48c1.9 2.11 3.5 5.16 4.29 8.1z"
fill="#FEDCFF"
/>
<path
d="m220.14 169.42c0.131 0.486 0.176 0.729 0.42 1.699l133.73-36.126c-8.606-31.858-23.407-57.648-46.862-81.009l-97.479 97.275c4.61 4.84 8.32 11.25 10.19 18.16z"
fill="#FDB6FF"
/>
<path
d="m242.01 163.51c0.131 0.484 0.169 0.729 0.419 1.697l111.86-30.218c-8.606-31.858-23.408-57.649-46.862-81.009l-81.486 81.231c7.34 7.56 13.13 17.41 16.07 28.3z"
fill="#FC92FF"
/>
<path
d="m263.89 157.6c0.13 0.484 0.185 0.725 0.438 1.692l89.969-24.304c-8.606-31.858-23.408-57.649-46.862-81.009l-65.48 65.173c10.06 10.28 17.91 23.57 21.93 38.45z"
fill="#FB6EFF"
/>
<path
d="m285.76 151.69c0.131 0.483 0.183 0.724 0.438 1.69l68.095-18.395c-8.606-31.858-23.408-57.649-46.862-81.009l-49.482 49.121c12.79 13 22.71 29.74 27.8 48.6z"
fill="#FA4AFF"
/>
<path
d="m307.7 146.03c0.087 0.321 0.12 0.48 0.378 1.447l46.215-12.484c-8.606-31.858-23.408-57.649-46.862-81.009l-33.484 33.07c15.59 15.719 27.55 36.039 33.74 58.969z"
fill="#F927FF"
/>
<path
d="m329.58 140.12c0.086 0.321 0.118 0.48 0.377 1.446l24.341-6.575c-8.606-31.858-23.52-58.061-46.974-81.421l-17.375 17.432c18.32 18.435 32.35 42.199 39.62 69.109z"
fill="#FF00FF"
/>
</g
>
</g
>
<metadata
><rdf:RDF
><cc:Work
><dc:format
>image/svg+xml</dc:format
><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage"
/><cc:license
rdf:resource="http://creativecommons.org/licenses/publicdomain/"
/><dc:publisher
><cc:Agent
rdf:about="http://openclipart.org/"
><dc:title
>Openclipart</dc:title
></cc:Agent
></dc:publisher
></cc:Work
><cc:License
rdf:about="http://creativecommons.org/licenses/publicdomain/"
><cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction"
/><cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution"
/><cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks"
/></cc:License
></rdf:RDF
></metadata
></svg
>

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -5,8 +5,6 @@
// Each layer gets a name for readability, which is then used in the keymap matrix below. // Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name. // 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 _BL 0 #define _BL 0
#define _FL 1 #define _FL 1
#define _CL 2 #define _CL 2
@ -33,7 +31,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap _CL: Control layer /* Keymap _CL: Control layer
*/ */
[_CL] = KEYMAP( [_CL] = KEYMAP(
BL_STEP,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,RGB_TOG, RGB_VAI, \ BL_STEP,RGB_M_P,RGB_M_B,RGB_M_R,RGB_M_SW,RGB_M_SN,RGB_M_K,RGB_M_X,RGB_M_G,_______,_______,_______,_______,_______,RGB_TOG, RGB_VAI, \
_______,_______,_______,_______,RESET, _______,_______,_______,_______,_______,_______,_______,_______,_______, RGB_VAD, \ _______,_______,_______,_______,RESET, _______,_______,_______,_______,_______,_______,_______,_______,_______, RGB_VAD, \
_______,_______,MO(_CL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \ _______,_______,MO(_CL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \
MO(_FL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, RGB_SAI, \ MO(_FL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, RGB_SAI, \

View File

@ -30,10 +30,17 @@
/* Underlight configuration /* Underlight configuration
*/ */
#define RGB_DI_PIN D7 #define RGB_DI_PIN D7
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 14 // Number of LEDs #define RGBLED_NUM 14 // Number of LEDs
#define RGBLIGHT_HUE_STEP 10 #define RGBLIGHT_HUE_STEP 32
#define RGBLIGHT_SAT_STEP 17 #define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17 #define RGBLIGHT_VAL_STEP 17
#define RGBLIGHT_ANIMATIONS
#define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 666*2
#define RGBLIGHT_EFFECT_CHRISTMAS_STEP 1
#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3 // How many LEDs wide to light up
#define RGBLIGHT_EFFECT_KNIGHT_OFFSET 1 // The led to start at
#define RGBLIGHT_EFFECT_KNIGHT_LED_NUM 5 // How many LEDs to travel
#define RGBLIGHT_EFFECT_SNAKE_LENGTH 4 // How many LEDs wide to light up
#endif #endif

View File

@ -249,105 +249,153 @@ bool process_record_quantum(keyrecord_t *record) {
if (record->event.pressed) { if (record->event.pressed) {
reset_keyboard(); reset_keyboard();
} }
return false; return false;
break;
case DEBUG: case DEBUG:
if (record->event.pressed) { if (record->event.pressed) {
debug_enable = true; debug_enable = true;
print("DEBUG: enabled.\n"); print("DEBUG: enabled.\n");
} }
return false; return false;
break;
#ifdef FAUXCLICKY_ENABLE #ifdef FAUXCLICKY_ENABLE
case FC_TOG: case FC_TOG:
if (record->event.pressed) { if (record->event.pressed) {
FAUXCLICKY_TOGGLE; FAUXCLICKY_TOGGLE;
} }
return false; return false;
break;
case FC_ON: case FC_ON:
if (record->event.pressed) { if (record->event.pressed) {
FAUXCLICKY_ON; FAUXCLICKY_ON;
} }
return false; return false;
break;
case FC_OFF: case FC_OFF:
if (record->event.pressed) { if (record->event.pressed) {
FAUXCLICKY_OFF; FAUXCLICKY_OFF;
} }
return false; return false;
break;
#endif #endif
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
case RGB_TOG: case RGB_TOG:
if (record->event.pressed) { if (record->event.pressed) {
rgblight_toggle(); rgblight_toggle();
}
return false;
case RGB_MOD:
if (record->event.pressed) {
rgblight_step();
}
return false;
case RGB_HUI:
if (record->event.pressed) {
rgblight_increase_hue();
}
return false;
case RGB_HUD:
if (record->event.pressed) {
rgblight_decrease_hue();
}
return false;
case RGB_SAI:
if (record->event.pressed) {
rgblight_increase_sat();
}
return false;
case RGB_SAD:
if (record->event.pressed) {
rgblight_decrease_sat();
}
return false;
case RGB_VAI:
if (record->event.pressed) {
rgblight_increase_val();
}
return false;
case RGB_VAD:
if (record->event.pressed) {
rgblight_decrease_val();
}
return false;
case RGB_MODE_PLAIN:
if (record->event.pressed) {
rgblight_mode(1);
}
return false;
case RGB_MODE_BREATHE:
if (record->event.pressed) {
if ((2 <= rgblight_get_mode()) && (rgblight_get_mode() < 5)) {
rgblight_step();
} else {
rgblight_mode(2);
} }
return false; }
break; return false;
case RGB_MOD: case RGB_MODE_RAINBOW:
if (record->event.pressed) { if (record->event.pressed) {
rgblight_step(); if ((6 <= rgblight_get_mode()) && (rgblight_get_mode() < 8)) {
rgblight_step();
} else {
rgblight_mode(6);
} }
return false; }
break; return false;
case RGB_HUI: case RGB_MODE_SWIRL:
if (record->event.pressed) { if (record->event.pressed) {
rgblight_increase_hue(); if ((9 <= rgblight_get_mode()) && (rgblight_get_mode() < 14)) {
rgblight_step();
} else {
rgblight_mode(9);
} }
return false; }
break; return false;
case RGB_HUD: case RGB_MODE_SNAKE:
if (record->event.pressed) { if (record->event.pressed) {
rgblight_decrease_hue(); if ((15 <= rgblight_get_mode()) && (rgblight_get_mode() < 20)) {
rgblight_step();
} else {
rgblight_mode(15);
} }
return false; }
break; return false;
case RGB_SAI: case RGB_MODE_KNIGHT:
if (record->event.pressed) { if (record->event.pressed) {
rgblight_increase_sat(); if ((21 <= rgblight_get_mode()) && (rgblight_get_mode() < 23)) {
rgblight_step();
} else {
rgblight_mode(21);
} }
return false; }
break; return false;
case RGB_SAD: case RGB_MODE_XMAS:
if (record->event.pressed) { if (record->event.pressed) {
rgblight_decrease_sat(); rgblight_mode(24);
}
return false;
case RGB_MODE_GRADIENT:
if (record->event.pressed) {
if ((25 <= rgblight_get_mode()) && (rgblight_get_mode() < 34)) {
rgblight_step();
} else {
rgblight_mode(25);
} }
return false; }
break; return false;
case RGB_VAI: #endif
if (record->event.pressed) {
rgblight_increase_val();
}
return false;
break;
case RGB_VAD:
if (record->event.pressed) {
rgblight_decrease_val();
}
return false;
break;
#endif
#ifdef PROTOCOL_LUFA #ifdef PROTOCOL_LUFA
case OUT_AUTO: case OUT_AUTO:
if (record->event.pressed) { if (record->event.pressed) {
set_output(OUTPUT_AUTO); set_output(OUTPUT_AUTO);
} }
return false; return false;
break;
case OUT_USB: case OUT_USB:
if (record->event.pressed) { if (record->event.pressed) {
set_output(OUTPUT_USB); set_output(OUTPUT_USB);
} }
return false; return false;
break;
#ifdef BLUETOOTH_ENABLE #ifdef BLUETOOTH_ENABLE
case OUT_BT: case OUT_BT:
if (record->event.pressed) { if (record->event.pressed) {
set_output(OUTPUT_BLUETOOTH); set_output(OUTPUT_BLUETOOTH);
} }
return false; return false;
break;
#endif #endif
#endif #endif
case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_NKRO: case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_NKRO:
@ -454,7 +502,6 @@ bool process_record_quantum(keyrecord_t *record) {
unregister_mods(MOD_BIT(KC_LSFT)); unregister_mods(MOD_BIT(KC_LSFT));
} }
return false; return false;
// break;
} }
case KC_RSPC: { case KC_RSPC: {
@ -477,7 +524,6 @@ bool process_record_quantum(keyrecord_t *record) {
unregister_mods(MOD_BIT(KC_RSFT)); unregister_mods(MOD_BIT(KC_RSFT));
} }
return false; return false;
// break;
} }
case GRAVE_ESC: { case GRAVE_ESC: {
uint8_t shifted = get_mods() & ((MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT) uint8_t shifted = get_mods() & ((MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)

View File

@ -401,6 +401,14 @@ enum quantum_keycodes {
RGB_SAD, RGB_SAD,
RGB_VAI, RGB_VAI,
RGB_VAD, RGB_VAD,
RGB_MODE_PLAIN,
RGB_MODE_BREATHE,
RGB_MODE_RAINBOW,
RGB_MODE_SWIRL,
RGB_MODE_SNAKE,
RGB_MODE_KNIGHT,
RGB_MODE_XMAS,
RGB_MODE_GRADIENT,
// Left shift, open paren // Left shift, open paren
KC_LSPO, KC_LSPO,
@ -534,6 +542,14 @@ enum quantum_keycodes {
#define KC_GESC GRAVE_ESC #define KC_GESC GRAVE_ESC
#define RGB_M_P RGB_MODE_PLAIN
#define RGB_M_B RGB_MODE_BREATHE
#define RGB_M_R RGB_MODE_RAINBOW
#define RGB_M_SW RGB_MODE_SWIRL
#define RGB_M_SN RGB_MODE_SNAKE
#define RGB_M_K RGB_MODE_KNIGHT
#define RGB_M_X RGB_MODE_XMAS
#define RGB_M_G RGB_MODE_GRADIENT
// L-ayer, T-ap - 256 keycode max, 16 layer max // L-ayer, T-ap - 256 keycode max, 16 layer max
#define LT(layer, kc) (kc | QK_LAYER_TAP | ((layer & 0xF) << 8)) #define LT(layer, kc) (kc | QK_LAYER_TAP | ((layer & 0xF) << 8))

View File

@ -22,7 +22,6 @@
#include "debug.h" #include "debug.h"
#include "led_tables.h" #include "led_tables.h"
__attribute__ ((weak)) __attribute__ ((weak))
const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5}; const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5};
__attribute__ ((weak)) __attribute__ ((weak))
@ -32,7 +31,7 @@ const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {100, 50, 20};
__attribute__ ((weak)) __attribute__ ((weak))
const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 50, 20}; const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 50, 20};
__attribute__ ((weak)) __attribute__ ((weak))
const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {100, 50, 20}; const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {127, 63, 31};
__attribute__ ((weak)) __attribute__ ((weak))
const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90}; const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90};
@ -197,6 +196,14 @@ void rgblight_step_reverse(void) {
rgblight_mode(mode); rgblight_mode(mode);
} }
uint32_t rgblight_get_mode(void) {
if (!rgblight_config.enable) {
return false;
}
return rgblight_config.mode;
}
void rgblight_mode(uint8_t mode) { void rgblight_mode(uint8_t mode) {
if (!rgblight_config.enable) { if (!rgblight_config.enable) {
return; return;
@ -220,6 +227,8 @@ void rgblight_mode(uint8_t mode) {
// MODE 9-14, rainbow swirl // MODE 9-14, rainbow swirl
// MODE 15-20, snake // MODE 15-20, snake
// MODE 21-23, knight // MODE 21-23, knight
// MODE 24, xmas
// MODE 25-34, static rainbow
#ifdef RGBLIGHT_ANIMATIONS #ifdef RGBLIGHT_ANIMATIONS
rgblight_timer_enable(); rgblight_timer_enable();
@ -550,7 +559,14 @@ void rgblight_effect_knight(uint8_t interval) {
static int8_t increment = 1; static int8_t increment = 1;
uint8_t i, cur; uint8_t i, cur;
// Set all the LEDs to 0
for (i = 0; i < RGBLED_NUM; i++) { for (i = 0; i < RGBLED_NUM; i++) {
led[i].r = 0;
led[i].g = 0;
led[i].b = 0;
}
// Determine which LEDs should be lit up
for (i = 0; i < RGBLIGHT_EFFECT_KNIGHT_LED_NUM; i++) {
cur = (i + RGBLIGHT_EFFECT_KNIGHT_OFFSET) % RGBLED_NUM; cur = (i + RGBLIGHT_EFFECT_KNIGHT_OFFSET) % RGBLED_NUM;
if (i >= low_bound && i <= high_bound) { if (i >= low_bound && i <= high_bound) {
@ -563,10 +579,12 @@ void rgblight_effect_knight(uint8_t interval) {
} }
rgblight_set(); rgblight_set();
// Move from low_bound to high_bound changing the direction we increment each
// time a boundary is hit.
low_bound += increment; low_bound += increment;
high_bound += increment; high_bound += increment;
if (high_bound <= 0 || low_bound >= RGBLED_NUM - 1) { if (high_bound <= 0 || low_bound >= RGBLIGHT_EFFECT_KNIGHT_LED_NUM - 1) {
increment = -increment; increment = -increment;
} }
} }

View File

@ -23,16 +23,21 @@
#endif #endif
#ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH #ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH
#define RGBLIGHT_EFFECT_SNAKE_LENGTH 7 #define RGBLIGHT_EFFECT_SNAKE_LENGTH 4
#endif #endif
#ifndef RGBLIGHT_EFFECT_KNIGHT_LENGTH #ifndef RGBLIGHT_EFFECT_KNIGHT_LENGTH
#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 7 #define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3
#endif #endif
#ifndef RGBLIGHT_EFFECT_KNIGHT_OFFSET #ifndef RGBLIGHT_EFFECT_KNIGHT_OFFSET
#define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0 #define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0
#endif #endif
#ifndef RGBLIGHT_EFFECT_KNIGHT_LED_NUM
#define RGBLIGHT_EFFECT_KNIGHT_LED_NUM RGBLED_NUM
#endif
#ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL #ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL
#define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 1000 #define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 1000
#endif #endif
@ -85,6 +90,7 @@ void rgblight_toggle(void);
void rgblight_enable(void); void rgblight_enable(void);
void rgblight_step(void); void rgblight_step(void);
void rgblight_step_reverse(void); void rgblight_step_reverse(void);
uint32_t rgblight_get_mode(void);
void rgblight_mode(uint8_t mode); void rgblight_mode(uint8_t mode);
void rgblight_set(void); void rgblight_set(void);
void rgblight_update_dword(uint32_t dword); void rgblight_update_dword(uint32_t dword);