aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/cluecard/keymaps/default/readme.md4
-rw-r--r--keyboards/cluecard/keymaps/rgb_effects/Makefile21
-rw-r--r--keyboards/cluecard/keymaps/rgb_effects/config.h12
-rw-r--r--keyboards/cluecard/keymaps/rgb_effects/keymap.c28
-rw-r--r--keyboards/cluecard/keymaps/rgb_effects/readme.md7
-rw-r--r--keyboards/planck/keymaps/vifon/Makefile25
-rw-r--r--keyboards/planck/keymaps/vifon/config.h91
-rw-r--r--keyboards/planck/keymaps/vifon/keymap.c187
-rw-r--r--quantum/dynamic_macro.h9
-rw-r--r--quantum/rgblight.c61
-rw-r--r--quantum/rgblight.h6
-rw-r--r--readme.md4
12 files changed, 429 insertions, 26 deletions
diff --git a/keyboards/cluecard/keymaps/default/readme.md b/keyboards/cluecard/keymaps/default/readme.md
index 9e3b97bea..fa4e8ccad 100644
--- a/keyboards/cluecard/keymaps/default/readme.md
+++ b/keyboards/cluecard/keymaps/default/readme.md
@@ -1 +1,5 @@
1# The default keymap for cluecard 1# The default keymap for cluecard
2
3Note that this keymap has audio enabled, so the RGB mode button does not go through the different effects.
4So the LEDs will still show a static light, that is configurable with the hue, staturation and brightness
5buttons. You can of course also turn them on and off with the on/off button.
diff --git a/keyboards/cluecard/keymaps/rgb_effects/Makefile b/keyboards/cluecard/keymaps/rgb_effects/Makefile
new file mode 100644
index 000000000..00670c0cf
--- /dev/null
+++ b/keyboards/cluecard/keymaps/rgb_effects/Makefile
@@ -0,0 +1,21 @@
1# Build Options
2# change to "no" to disable the options, or define them in the Makefile in
3# the appropriate keymap folder that will get included automatically
4#
5BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
6MOUSEKEY_ENABLE = no # Mouse keys(+4700)
7EXTRAKEY_ENABLE = no # Audio control and System control(+450)
8CONSOLE_ENABLE = yes # Console for debug(+400)
9COMMAND_ENABLE = yes # Commands for debug and configuration
10NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
11BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
12MIDI_ENABLE = no # MIDI controls
13AUDIO_ENABLE = no # Audio output on port C6
14UNICODE_ENABLE = no # Unicode
15BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
16RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
17SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
18
19ifndef QUANTUM_DIR
20 include ../../../../Makefile
21endif
diff --git a/keyboards/cluecard/keymaps/rgb_effects/config.h b/keyboards/cluecard/keymaps/rgb_effects/config.h
new file mode 100644
index 000000000..e88847df4
--- /dev/null
+++ b/keyboards/cluecard/keymaps/rgb_effects/config.h
@@ -0,0 +1,12 @@
1#ifndef CONFIG_USER_H
2#define CONFIG_USER_H
3
4#include "../../config.h"
5
6// place overrides here
7#define RGBLIGHT_TIMER
8#define RGBLIGHT_EFFECT_SNAKE_LENGTH 3
9#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2
10#define RGBLIGHT_EFFECT_KNIGHT_OFFSET 2
11
12#endif
diff --git a/keyboards/cluecard/keymaps/rgb_effects/keymap.c b/keyboards/cluecard/keymaps/rgb_effects/keymap.c
new file mode 100644
index 000000000..74c95ce8a
--- /dev/null
+++ b/keyboards/cluecard/keymaps/rgb_effects/keymap.c
@@ -0,0 +1,28 @@
1#include "cluecard.h"
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4 [0] = KEYMAP(
5 RGB_TOG, RGB_SAI, RGB_VAI, \
6 RGB_HUD, RGB_HUI, \
7 RGB_MOD, RGB_SAD, RGB_VAD, \
8 BL_STEP, \
9 KC_NO, KC_NO, KC_NO \
10 )
11};
12
13const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {255, 170, 85};
14const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {255, 170, 85};
15
16void matrix_init_user(void) {
17}
18
19void matrix_scan_user(void) {
20
21}
22
23bool process_record_user(uint16_t keycode, keyrecord_t *record) {
24 return true;
25}
26
27void led_set_user(uint8_t usb_led) {
28}
diff --git a/keyboards/cluecard/keymaps/rgb_effects/readme.md b/keyboards/cluecard/keymaps/rgb_effects/readme.md
new file mode 100644
index 000000000..949cac394
--- /dev/null
+++ b/keyboards/cluecard/keymaps/rgb_effects/readme.md
@@ -0,0 +1,7 @@
1# RGB effect test keymap for cluecard
2
3This keymap is made for testing the RGB effects. Audio is disabled and the mode buttons goes through each
4effect. If you run HID-listen you will be able to see which effect is active. For a list of effects, check
5the `rgblight.c` file.
6
7The hue, saturation and brightness buttons will work depending on which effect is active.
diff --git a/keyboards/planck/keymaps/vifon/Makefile b/keyboards/planck/keymaps/vifon/Makefile
new file mode 100644
index 000000000..838cb4e88
--- /dev/null
+++ b/keyboards/planck/keymaps/vifon/Makefile
@@ -0,0 +1,25 @@
1
2
3# Build Options
4# change to "no" to disable the options, or define them in the Makefile in
5# the appropriate keymap folder that will get included automatically
6#
7BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
8MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
9EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
10CONSOLE_ENABLE = yes # Console for debug(+400)
11COMMAND_ENABLE = yes # Commands for debug and configuration
12NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
13BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
14MIDI_ENABLE = no # MIDI controls
15AUDIO_ENABLE = no # Audio output on port C6
16UNICODE_ENABLE = no # Unicode
17BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
18RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
19
20# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
21SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
22
23ifndef QUANTUM_DIR
24 include ../../../../Makefile
25endif
diff --git a/keyboards/planck/keymaps/vifon/config.h b/keyboards/planck/keymaps/vifon/config.h
new file mode 100644
index 000000000..9cb0634fb
--- /dev/null
+++ b/keyboards/planck/keymaps/vifon/config.h
@@ -0,0 +1,91 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#include "config_common.h"
22
23/* USB Device descriptor parameter */
24#define VENDOR_ID 0xFEED
25#define PRODUCT_ID 0x6060
26#define MANUFACTURER Ortholinear Keyboards
27#define PRODUCT The Planck Keyboard
28#define DESCRIPTION A compact ortholinear keyboard
29
30/* key matrix size */
31#define MATRIX_ROWS 4
32#define MATRIX_COLS 12
33
34/* Planck PCB default pin-out */
35#define MATRIX_ROW_PINS { D0, D5, B5, B6 }
36#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 }
37#define UNUSED_PINS
38
39#define BACKLIGHT_PIN B7
40
41/* COL2ROW or ROW2COL */
42#define DIODE_DIRECTION COL2ROW
43
44/* define if matrix has ghost */
45//#define MATRIX_HAS_GHOST
46
47/* number of backlight levels */
48#define BACKLIGHT_LEVELS 3
49
50/* Set 0 if debouncing isn't needed */
51#define DEBOUNCING_DELAY 5
52
53/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
54#define LOCKING_SUPPORT_ENABLE
55/* Locking resynchronize hack */
56#define LOCKING_RESYNC_ENABLE
57
58/* key combination for command */
59#define IS_COMMAND() ( \
60 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
61)
62
63/*
64 * Feature disable options
65 * These options are also useful to firmware size reduction.
66 */
67
68/* disable debug print */
69//#define NO_DEBUG
70
71/* disable print */
72//#define NO_PRINT
73
74/* disable action features */
75//#define NO_ACTION_LAYER
76//#define NO_ACTION_TAPPING
77//#define NO_ACTION_ONESHOT
78//#define NO_ACTION_MACRO
79//#define NO_ACTION_FUNCTION
80
81/* prevent the modifiers from being stuck, sacrificing some memory */
82#define PREVENT_STUCK_MODIFIERS
83
84#ifdef SUBPROJECT_rev3
85 #include "rev3/config.h"
86#endif
87#ifdef SUBPROJECT_rev4
88 #include "rev4/config.h"
89#endif
90
91#endif
diff --git a/keyboards/planck/keymaps/vifon/keymap.c b/keyboards/planck/keymaps/vifon/keymap.c
new file mode 100644
index 000000000..80c4a516c
--- /dev/null
+++ b/keyboards/planck/keymaps/vifon/keymap.c
@@ -0,0 +1,187 @@
1// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
2// this is the style you want to emulate.
3
4#include "planck.h"
5#ifdef BACKLIGHT_ENABLE
6# include "backlight.h"
7#endif
8#include "timer.h"
9#include <bootloader.h>
10
11// Each layer gets a name for readability, which is then used in the keymap matrix below.
12// The underscores don't mean anything - you can have a layer called STUFF or any other name.
13// Layer names don't all need to be of the same length, obviously, and you can also skip them
14// entirely and just use numbers.
15enum userlayer {
16 _QW = 0,
17 _CM,
18 _PP,
19 _PPG,
20 _NM,
21 _LW,
22 _RS,
23 _DL,
24 _DYN,
25};
26
27enum planck_keycodes {
28 KM_LW = SAFE_RANGE,
29 KM_RS,
30 KM_SHLK, /* ShiftLock */
31 KM_RST, /* Reset */
32 KM_NUM, /* Numeric layer */
33 KM_SLP, /* Sleep 250 ms */
34 KM_PPLR, /* Pure Pro layer */
35 DYNAMIC_MACRO_RANGE,
36};
37
38#include "dynamic_macro.h"
39
40#define _______ KC_TRNS
41#define XXXXXXX KC_NO
42
43const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
44[_QW] = { /* Qwerty */
45 {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
46 {CTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
47 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_FN0 },
48 {KC_LCTL, MO(_DYN),KC_LGUI, KC_LALT, KM_LW, KC_SPC, KC_SPC, KM_RS, KC_RALT, KC_DOWN, KC_UP, KC_RCTL}
49},
50[_CM] = { /* Colemak */
51 {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
52 {CTL_T(KC_ESC), KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
53 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_FN0 },
54 {KC_LCTL, MO(_DYN),KC_LGUI, KC_LALT, KM_LW, KC_SPC, KC_SPC, KM_RS, KC_RALT, KC_DOWN, KC_UP, KC_RCTL}
55},
56[_PP] = { /* Pure Pro */
57 {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
58 {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT },
59 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_RSFT, KC_UP, KC_RCTL},
60 {KC_LCTL, MO(_DYN),KC_LGUI, KC_LALT, KM_LW, KC_SPC, KC_SPC, KM_RS, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT}
61},
62[_PPG] = { /* Pure Pro: Gaming */
63 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
64 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
65 {_______, _______, _______, _______, _______, _______, _______, _______, _______, DF(_RS), _______, _______},
66 {_______, _______, XXXXXXX, _______, KM_RS , _______, _______, KM_LW , _______, _______, _______, _______},
67},
68[_NM] = { /* Numeric */
69 {KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
70 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
71 {KC_LSFT, _______, _______, _______, _______, _______, _______, _______, KC_COMM, KC_DOT, _______, KC_FN0 },
72 {_______, _______, _______, _______, _______, KC_SPC, KC_SPC, _______, _______, _______, _______, _______}
73},
74[_LW]= { /* LOWER */
75 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
76 {KC_ESC, LGUI(KC_1), LGUI(KC_2), LGUI(KC_3), LGUI(KC_4), LGUI(KC_5), KM_NUM, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
77 {_______, LGUI(KC_6), LGUI(KC_7), LGUI(KC_8), LGUI(KC_9), LGUI(KC_0), KM_SLP, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_ENT },
78 {_______, BL_TOGG, _______, _______, _______, KC_BTN1, KC_BTN1, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
79},
80[_RS]= { /* RAISE */
81 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL },
82 {KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
83 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), KM_PPLR, KM_RST, KC_ENT },
84 {_______, BL_STEP, _______, _______, _______, KC_BTN2, KC_BTN2, _______, KC_MPLY, KC_VOLD, KC_VOLU, _______}
85},
86[_DL]= { /* DUAL */
87 {_______, _______, KC_WH_U, KC_MS_U, KC_WH_D, _______, _______, KC_APP, KC_INS, _______, KC_PSCR, _______},
88 {_______, _______, KC_MS_L, KC_MS_D, KC_MS_R, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_ACL0, KC_ACL2},
89 {_______, _______, KC_BTN2, KC_BTN3, KC_BTN1, KC_WWW_BACK, KC_WWW_FORWARD, KC_MUTE, _______, _______, _______, _______},
90 {_______, _______, KC_LGUI, KC_LALT, _______, _______, _______, _______, _______, _______, _______, _______}
91},
92[_DYN]= { /* special */
93 {_______, DYN_REC_START1, DYN_MACRO_PLAY1, _______, _______, _______, _______, _______, KC_INS, _______, KC_PSCR, KC_PAUS},
94 {_______, DYN_REC_START2, DYN_MACRO_PLAY2, _______, _______, _______, _______, _______, _______, KC_CAPS, KC_SLCK, KC_NLCK},
95 {KM_SHLK, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
96 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
97},
98};
99
100#undef _______
101
102const uint16_t PROGMEM fn_actions[] = {
103 ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ENT),
104};
105
106
107bool process_record_user(uint16_t keycode, keyrecord_t *record) {
108 static uint16_t key_timer;
109
110 if (!process_record_dynamic_macro(keycode, record)) {
111 return false;
112 }
113
114 switch (keycode) {
115 case KM_LW:
116 if (record->event.pressed) {
117 layer_on(_LW);
118 } else {
119 layer_off(_LW);
120 }
121 update_tri_layer(_LW, _RS, _DL);
122 return false;
123 break;
124 case KM_RS:
125 if (record->event.pressed) {
126 layer_on(_RS);
127 } else {
128 layer_off(_RS);
129 }
130 update_tri_layer(_LW, _RS, _DL);
131 return false;
132 break;
133 case KM_SHLK:
134 register_code(KC_LSFT);
135 break;
136 case KM_RST:
137 if (record->event.pressed) {
138 key_timer = timer_read();
139 } else {
140 if (timer_elapsed(key_timer) >= 500) {
141 clear_keyboard();
142 backlight_toggle();
143 _delay_ms(250);
144 backlight_toggle();
145 bootloader_jump();
146 }
147 }
148 break;
149 case KM_PPLR:
150 if (record->event.pressed) {
151 key_timer = timer_read();
152 } else {
153 if (timer_elapsed(key_timer) >= 250) {
154 default_layer_set((1UL << _PP) | (1UL << _PPG));
155 backlight_toggle();
156 _delay_ms(100);
157 backlight_toggle();
158 } else {
159 default_layer_set(1UL << _PP);
160 }
161 }
162 break;
163 case KM_NUM:
164 layer_on(_NM);
165 break;
166 case KM_SLP:
167 if (record->event.pressed) {
168 _delay_ms(250);
169 }
170 break;
171 }
172
173
174 if (record->event.pressed
175 && IS_LAYER_ON(_NM)
176 && keymap_key_to_keycode(_NM, record->event.key) == KC_TRNS) {
177
178 layer_off(_NM);
179 }
180
181 return true;
182}
183
184const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
185{
186 return MACRO_NONE;
187}
diff --git a/quantum/dynamic_macro.h b/quantum/dynamic_macro.h
index a3ad61bc7..e6dbc5b9c 100644
--- a/quantum/dynamic_macro.h
+++ b/quantum/dynamic_macro.h
@@ -8,8 +8,13 @@
8/* May be overridden with a custom value. Be aware that the effective 8/* May be overridden with a custom value. Be aware that the effective
9 * macro length is half of this value: each keypress is recorded twice 9 * macro length is half of this value: each keypress is recorded twice
10 * because of the down-event and up-event. This is not a bug, it's the 10 * because of the down-event and up-event. This is not a bug, it's the
11 * intended behavior. */ 11 * intended behavior.
12#define DYNAMIC_MACRO_SIZE 256 12 *
13 * Usually it should be fine to set the macro size to at least 256 but
14 * there have been reports of it being too much in some users' cases,
15 * so 128 is considered a safe default.
16 */
17#define DYNAMIC_MACRO_SIZE 128
13#endif 18#endif
14 19
15/* DYNAMIC_MACRO_RANGE must be set as the last element of user's 20/* DYNAMIC_MACRO_RANGE must be set as the last element of user's
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index f82e3ec55..d550c5866 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -6,24 +6,37 @@
6#include "rgblight.h" 6#include "rgblight.h"
7#include "debug.h" 7#include "debug.h"
8 8
9// Lightness curve using the CIE 1931 lightness formula
10//Generated by the python script provided in http://jared.geek.nz/2013/feb/linear-led-pwm
9const uint8_t DIM_CURVE[] PROGMEM = { 11const uint8_t DIM_CURVE[] PROGMEM = {
10 0, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 12 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
11 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 13 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
12 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 14 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
13 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 15 3, 4, 4, 4, 4, 4, 4, 5, 5, 5,
14 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 16 5, 5, 6, 6, 6, 6, 6, 7, 7, 7,
15 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 17 7, 8, 8, 8, 8, 9, 9, 9, 10, 10,
16 15, 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 18 10, 10, 11, 11, 11, 12, 12, 12, 13, 13,
17 20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26, 26, 19 13, 14, 14, 15, 15, 15, 16, 16, 17, 17,
18 27, 27, 28, 28, 29, 29, 30, 30, 31, 32, 32, 33, 33, 34, 35, 35, 20 17, 18, 18, 19, 19, 20, 20, 21, 21, 22,
19 36, 36, 37, 38, 38, 39, 40, 40, 41, 42, 43, 43, 44, 45, 46, 47, 21 22, 23, 23, 24, 24, 25, 25, 26, 26, 27,
20 48, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 22 28, 28, 29, 29, 30, 31, 31, 32, 32, 33,
21 63, 64, 65, 66, 68, 69, 70, 71, 73, 74, 75, 76, 78, 79, 81, 82, 23 34, 34, 35, 36, 37, 37, 38, 39, 39, 40,
22 83, 85, 86, 88, 90, 91, 93, 94, 96, 98, 99, 101, 103, 105, 107, 109, 24 41, 42, 43, 43, 44, 45, 46, 47, 47, 48,
23 110, 112, 114, 116, 118, 121, 123, 125, 127, 129, 132, 134, 136, 139, 141, 144, 25 49, 50, 51, 52, 53, 54, 54, 55, 56, 57,
24 146, 149, 151, 154, 157, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, 190, 26 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
25 193, 196, 200, 203, 207, 211, 214, 218, 222, 226, 230, 234, 238, 242, 248, 255 27 68, 70, 71, 72, 73, 74, 75, 76, 77, 79,
26}; 28 80, 81, 82, 83, 85, 86, 87, 88, 90, 91,
29 92, 94, 95, 96, 98, 99, 100, 102, 103, 105,
30 106, 108, 109, 110, 112, 113, 115, 116, 118, 120,
31 121, 123, 124, 126, 128, 129, 131, 132, 134, 136,
32 138, 139, 141, 143, 145, 146, 148, 150, 152, 154,
33 155, 157, 159, 161, 163, 165, 167, 169, 171, 173,
34 175, 177, 179, 181, 183, 185, 187, 189, 191, 193,
35 196, 198, 200, 202, 204, 207, 209, 211, 214, 216,
36 218, 220, 223, 225, 228, 230, 232, 235, 237, 240,
37 242, 245, 247, 250, 252, 255,
38 };
39
27const uint8_t RGBLED_BREATHING_TABLE[] PROGMEM = { 40const uint8_t RGBLED_BREATHING_TABLE[] PROGMEM = {
28 0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 7, 9, 41 0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 7, 9,
29 10, 11, 12, 14, 15, 17, 18, 20, 21, 23, 25, 27, 29, 31, 33, 35, 42 10, 11, 12, 14, 15, 17, 18, 20, 21, 23, 25, 27, 29, 31, 33, 35,
@@ -42,10 +55,16 @@ const uint8_t RGBLED_BREATHING_TABLE[] PROGMEM = {
42 37, 35, 33, 31, 29, 27, 25, 23, 21, 20, 18, 17, 15, 14, 12, 11, 55 37, 35, 33, 31, 29, 27, 25, 23, 21, 20, 18, 17, 15, 14, 12, 11,
43 10, 9, 7, 6, 5, 5, 4, 3, 2, 2, 1, 1, 1, 0, 0, 0 56 10, 9, 7, 6, 5, 5, 4, 3, 2, 2, 1, 1, 1, 0, 0, 0
44}; 57};
58
59__attribute__ ((weak))
45const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5}; 60const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5};
61__attribute__ ((weak))
46const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {120, 60, 30}; 62const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {120, 60, 30};
63__attribute__ ((weak))
47const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {100, 50, 20}; 64const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {100, 50, 20};
65__attribute__ ((weak))
48const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 50, 20}; 66const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 50, 20};
67__attribute__ ((weak))
49const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {100, 50, 20}; 68const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {100, 50, 20};
50 69
51rgblight_config_t rgblight_config; 70rgblight_config_t rgblight_config;
@@ -55,13 +74,8 @@ uint8_t rgblight_inited = 0;
55 74
56 75
57void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1) { 76void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1) {
58 // Convert hue, saturation, and value (HSV/HSB) to RGB. DIM_CURVE is used only
59 // on value and saturation (inverted). This looks the most natural.
60 uint8_t r = 0, g = 0, b = 0, base, color; 77 uint8_t r = 0, g = 0, b = 0, base, color;
61 78
62 val = pgm_read_byte(&DIM_CURVE[val]);
63 sat = 255 - pgm_read_byte(&DIM_CURVE[255 - sat]);
64
65 if (sat == 0) { // Acromatic color (gray). Hue doesn't mind. 79 if (sat == 0) { // Acromatic color (gray). Hue doesn't mind.
66 r = val; 80 r = val;
67 g = val; 81 g = val;
@@ -103,6 +117,9 @@ void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1) {
103 break; 117 break;
104 } 118 }
105 } 119 }
120 r = pgm_read_byte(&DIM_CURVE[r]);
121 g = pgm_read_byte(&DIM_CURVE[g]);
122 b = pgm_read_byte(&DIM_CURVE[b]);
106 123
107 setrgb(r, g, b, led1); 124 setrgb(r, g, b, led1);
108} 125}
diff --git a/quantum/rgblight.h b/quantum/rgblight.h
index def26c428..17f04ffcf 100644
--- a/quantum/rgblight.h
+++ b/quantum/rgblight.h
@@ -40,6 +40,12 @@
40#include "eeconfig.h" 40#include "eeconfig.h"
41#include "light_ws2812.h" 41#include "light_ws2812.h"
42 42
43extern const uint8_t RGBLED_BREATHING_INTERVALS[4] PROGMEM;
44extern const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[3] PROGMEM;
45extern const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[3] PROGMEM;
46extern const uint8_t RGBLED_SNAKE_INTERVALS[3] PROGMEM;
47extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM;
48
43typedef union { 49typedef union {
44 uint32_t raw; 50 uint32_t raw;
45 struct { 51 struct {
diff --git a/readme.md b/readme.md
index db118f9a3..f20ab41b1 100644
--- a/readme.md
+++ b/readme.md
@@ -826,7 +826,7 @@ And then, to assign this macro to a key on your keyboard layout, you just use `M
826 826
827## Dynamic macros: record and replay macros in runtime 827## Dynamic macros: record and replay macros in runtime
828 828
829In addition to the static macros described above, you may enable the dynamic macros which you may record while writing. They are forgotten as soon as the keyboard is unplugged. Only two such macros may be stored at the same time, with the total length of 128 keypresses. 829In addition to the static macros described above, you may enable the dynamic macros which you may record while writing. They are forgotten as soon as the keyboard is unplugged. Only two such macros may be stored at the same time, with the total length of 64 keypresses (by default).
830 830
831To enable them, first add a new element to the `planck_keycodes` enum -- `DYNAMIC_MACRO_RANGE`: 831To enable them, first add a new element to the `planck_keycodes` enum -- `DYNAMIC_MACRO_RANGE`:
832 832
@@ -867,7 +867,7 @@ Add the following code to the very beginning of your `process_record_user()` fun
867 867
868To start recording the macro, press either `DYN_REC_START1` or `DYN_REC_START2`. To finish the recording, press the `_DYN` layer button. The handler awaits specifically for the `MO(_DYN)` keycode as the "stop signal" so please don't use any fancy ways to access this layer, use the regular `MO()` modifier. To replay the macro, press either `DYN_MACRO_PLAY1` or `DYN_MACRO_PLAY2`. 868To start recording the macro, press either `DYN_REC_START1` or `DYN_REC_START2`. To finish the recording, press the `_DYN` layer button. The handler awaits specifically for the `MO(_DYN)` keycode as the "stop signal" so please don't use any fancy ways to access this layer, use the regular `MO()` modifier. To replay the macro, press either `DYN_MACRO_PLAY1` or `DYN_MACRO_PLAY2`.
869 869
870If the LED-s start blinking during the recording with each keypress, it means there is no more space for the macro in the macro buffer. To fit the macro in, either make the other macro shorter (they share the same buffer) or increase the buffer size by setting the `DYNAMIC_MACRO_SIZE` preprocessor macro (default value: 256; please read the comments for it in the header). 870If the LED-s start blinking during the recording with each keypress, it means there is no more space for the macro in the macro buffer. To fit the macro in, either make the other macro shorter (they share the same buffer) or increase the buffer size by setting the `DYNAMIC_MACRO_SIZE` preprocessor macro (default value: 128; please read the comments for it in the header).
871 871
872For the details about the internals of the dynamic macros, please read the comments in the `dynamic_macro.h` header. 872For the details about the internals of the dynamic macros, please read the comments in the `dynamic_macro.h` header.
873 873