Skip to content

Commit

Permalink
Merge pull request qmk#16 from sadekbaroudi/fp/rgb_dynamic_base_layer
Browse files Browse the repository at this point in the history
added dynamic base layer support for rgblight and rgb matrix, along w…
  • Loading branch information
sadekbaroudi authored Oct 6, 2022
2 parents 7ac65df + 253ae53 commit 42c905b
Show file tree
Hide file tree
Showing 37 changed files with 373 additions and 163 deletions.
1 change: 1 addition & 0 deletions keyboards/fingerpunch/FP_LIBRARY_SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ That said, if you are looking to leverage the features, you may be able to follo
Note that below is an example. You should check for the latest version of this code block as found in `keyboards/fingerpunch/ffkb_byomcu/rules.mk`

```make
DEFERRED_EXEC_ENABLE = yes
SRC += keyboards/fingerpunch/fp.c \
keyboards/fingerpunch/fp_haptic.c \
keyboards/fingerpunch/fp_keyhandler.c \
Expand Down
71 changes: 41 additions & 30 deletions keyboards/fingerpunch/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# fingerpunch keyboards

## Operating system

| Setting | Description | Default |
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| `FP_MAC_PREFERRED` | (Optional) If you are primarily using a Mac, enable to use Mac specific keycode logic for fingerpunch features | `undefined` |
| Setting | Description | Default |
| --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| `FP_MAC_PREFERRED` | (Optional) If you are primarily using a Mac, enable to use Mac specific logic for fingerpunch features (mostly for keycodes) | `undefined` |

## Keycodes and settings

Expand Down Expand Up @@ -46,6 +45,7 @@ Note: if you are using a userspace, and you have custom keycodes, you will need
|| defined(KEYBOARD_fingerpunch_pinkiesout) \
|| defined(KEYBOARD_fingerpunch_rockon_v1) \
|| defined(KEYBOARD_fingerpunch_rockon_v2) \
|| defined(KEYBOARD_fingerpunch_rockon_v3) \
|| defined(KEYBOARD_fingerpunch_rockon_bp) \
|| defined(KEYBOARD_fingerpunch_sweeeeep) \
|| defined(KEYBOARD_fingerpunch_ximi)
Expand Down Expand Up @@ -115,39 +115,43 @@ void pointing_device_init_user(void) {
## RGB Lighting
Note that unless otherwise specified, features for rgb are supported on both rgblight ( https://github.com/qmk/qmk_firmware/blob/master/docs/feature_rgblight.md ) and rgb matrix ( https://github.com/qmk/qmk_firmware/blob/master/docs/feature_rgb_matrix.md ).
Notes:
* unless otherwise specified, features for rgb are supported on both rgblight ( https://github.com/qmk/qmk_firmware/blob/master/docs/feature_rgblight.md ) and rgb matrix ( https://github.com/qmk/qmk_firmware/blob/master/docs/feature_rgb_matrix.md ).
* the base layer is still configurable using the QMK rgb keycodes ( https://github.com/qmk/qmk_firmware/blob/master/docs/feature_rgblight.md#keycodes ), but you will need to enable the `FP_LAYER_LIGHTING_DYNAMIC_BASE_LAYER`
Some config parameters will depend on which you're using, like `FP_LAYER_LIGHTING_MODE`.
### Layer lighting
If using this feature (`FP_LAYER_LIGHTING_ENABLE`), please note that the `FP_LAYER_LIGHTING_AUTO_MOUSE_ENABLE` will be automatically disabled. Given that this feature will handle the auto mouse layer as well, you don't need to activate the layer lighting twice. Just set the mouse layer lighting to the color you prefer using the `FP_LAYER_LIGHTING_HUE_X` below.
| Setting | Description | Default |
| --------------------------------------- | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| `FP_LAYER_LIGHTING_ENABLE` | (Optional) Define this to enable layer lighting | `undefined` |
| `FP_LAYER_LIGHTING_MODE` | (Required) Set the layer lighting default mode | `RGBLIGHT_MODE_STATIC_LIGHT` or `RGB_MATRIX_SOLID_COLOR` |
| `FP_LAYER_LIGHTING_HUE_0` | (Required) Set the layer lighting hue for layer 0 | `HSV_BLUE` |
| `FP_LAYER_LIGHTING_HUE_1` | (Required) Set the layer lighting hue for layer 1 | `HSV_WHITE` |
| `FP_LAYER_LIGHTING_HUE_2` | (Required) Set the layer lighting hue for layer 2 | `HSV_GREEN` |
| `FP_LAYER_LIGHTING_HUE_3` | (Required) Set the layer lighting hue for layer 3 | `HSV_PURPLE` |
| `FP_LAYER_LIGHTING_HUE_4` | (Required) Set the layer lighting hue for layer 4 | `HSV_YELLOW` |
| `FP_LAYER_LIGHTING_HUE_5` | (Required) Set the layer lighting hue for layer 5 | `HSV_MAGENTA` |
| `FP_LAYER_LIGHTING_HUE_6` | (Required) Set the layer lighting hue for layer 6 | `HSV_CYAN` |
| `FP_LAYER_LIGHTING_HUE_7` | (Required) Set the layer lighting hue for layer 7 | `HSV_SPRINGGREEN` |
| `FP_LAYER_LIGHTING_MODE_0` | (Required) Set the layer lighting mode for layer 0 | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_MODE_1` | (Required) Set the layer lighting mode for layer 1 | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_MODE_2` | (Required) Set the layer lighting mode for layer 2 | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_MODE_3` | (Required) Set the layer lighting mode for layer 3 | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_MODE_4` | (Required) Set the layer lighting mode for layer 4 | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_MODE_5` | (Required) Set the layer lighting mode for layer 5 | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_MODE_6` | (Required) Set the layer lighting mode for layer 6 | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_MODE_7` | (Required) Set the layer lighting mode for layer 7 | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_CAPS_LOCK_HUE` | (Required) Set the layer lighting hue when caps lock is enabled | `HSV_RED` |
| `FP_LAYER_LIGHTING_CAPS_LOCK_MODE` | (Required) Set the layer lighting mode when caps lock is enabled | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_AUTO_MOUSE_ENABLE` | (Optional) If using RGB, set the layer lighting when auto mouse is triggered | `undefined` |
| `FP_LAYER_LIGHTING_AUTO_MOUSE_HUE` | (Required) This is the hue that is used for the auto mouse layer lighting | `HSV_ORANGE` |
| `FP_LAYER_LIGHTING_AUTO_MOUSE_MODE` | (Required) This is the mode that is used for the auto mouse layer lighting | `FP_LAYER_LIGHTING_MODE` |
| Setting | Description | Default |
| --------------------------------------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| `FP_STARTUP_ANIMATION_DISABLE` | (Optional) Define this to disable startup animation | `undefined` |
| `FP_LAYER_LIGHTING_ENABLE` | (Optional) Define this to enable layer lighting | `undefined` |
| `FP_LAYER_LIGHTING_DYNAMIC_BASE_LAYER` | (Optional) While using layer lighting, enable dynamically changing the base layer | `undefined` |
| `FP_LAYER_LIGHTING_MODE` | (Required) Set the layer lighting default mode | `RGBLIGHT_MODE_STATIC_LIGHT` or `RGB_MATRIX_SOLID_COLOR` |
| `FP_LAYER_LIGHTING_HUE_0` | (Required) Set the layer lighting hue for layer 0 | `HSV_BLUE` |
| `FP_LAYER_LIGHTING_HUE_1` | (Required) Set the layer lighting hue for layer 1 | `HSV_WHITE` |
| `FP_LAYER_LIGHTING_HUE_2` | (Required) Set the layer lighting hue for layer 2 | `HSV_GREEN` |
| `FP_LAYER_LIGHTING_HUE_3` | (Required) Set the layer lighting hue for layer 3 | `HSV_PURPLE` |
| `FP_LAYER_LIGHTING_HUE_4` | (Required) Set the layer lighting hue for layer 4 | `HSV_YELLOW` |
| `FP_LAYER_LIGHTING_HUE_5` | (Required) Set the layer lighting hue for layer 5 | `HSV_MAGENTA` |
| `FP_LAYER_LIGHTING_HUE_6` | (Required) Set the layer lighting hue for layer 6 | `HSV_CYAN` |
| `FP_LAYER_LIGHTING_HUE_7` | (Required) Set the layer lighting hue for layer 7 | `HSV_SPRINGGREEN` |
| `FP_LAYER_LIGHTING_MODE_0` | (Required) Set the layer lighting mode for layer 0 | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_MODE_1` | (Required) Set the layer lighting mode for layer 1 | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_MODE_2` | (Required) Set the layer lighting mode for layer 2 | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_MODE_3` | (Required) Set the layer lighting mode for layer 3 | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_MODE_4` | (Required) Set the layer lighting mode for layer 4 | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_MODE_5` | (Required) Set the layer lighting mode for layer 5 | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_MODE_6` | (Required) Set the layer lighting mode for layer 6 | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_MODE_7` | (Required) Set the layer lighting mode for layer 7 | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_CAPS_LOCK_HUE` | (Required) Set the layer lighting hue when caps lock is enabled | `HSV_RED` |
| `FP_LAYER_LIGHTING_CAPS_LOCK_MODE` | (Required) Set the layer lighting mode when caps lock is enabled | `FP_LAYER_LIGHTING_MODE` |
| `FP_LAYER_LIGHTING_AUTO_MOUSE_ENABLE` | (Optional) If using RGB, set the layer lighting when auto mouse is triggered | `undefined` |
| `FP_LAYER_LIGHTING_AUTO_MOUSE_HUE` | (Required) This is the hue that is used for the auto mouse layer lighting | `HSV_ORANGE` |
| `FP_LAYER_LIGHTING_AUTO_MOUSE_MODE` | (Required) This is the mode that is used for the auto mouse layer lighting | `FP_LAYER_LIGHTING_MODE` |
## Haptic Feedback
Expand All @@ -165,3 +169,10 @@ Note that the ctrl-X haptic feedback responses will use control as the modifier,
## Keymap
If you are looking to use process_record_kb() or process_record
## Appreciation
Thank you:
* Drashna - for the great examples in their userspace implementation.
* Wilbatech - for the example of keyboard agnostic code in QMK.
1 change: 1 addition & 0 deletions keyboards/fingerpunch/arachnophobe/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ OLED_ENABLE = no # this can be yes or no depending on if you have an
EXTRAFLAGS += -flto # macros enable or disable
MOUSEKEY_ENABLE = yes

DEFERRED_EXEC_ENABLE = yes
SRC += keyboards/fingerpunch/fp.c \
keyboards/fingerpunch/fp_haptic.c \
keyboards/fingerpunch/fp_keyhandler.c \
Expand Down
4 changes: 2 additions & 2 deletions keyboards/fingerpunch/barobord/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_HUE_STEP 16
#define RGBLIGHT_SAT_STEP 16
#define RGBLIGHT_VAL_STEP 16
#define RGBLIGHT_LIMIT_VAL 60 /* The maximum brightness level for RGBLIGHT_ENABLE */
#define RGBLIGHT_LIMIT_VAL 150 /* The maximum brightness level for RGBLIGHT_ENABLE */
#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
#define RGBLIGHT_EFFECT_ALTERNATING
#define RGBLIGHT_EFFECT_BREATHING
Expand All @@ -66,7 +66,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef RGB_MATRIX_ENABLE
#define DRIVER_LED_TOTAL 40
#define RGB_MATRIX_CENTER {100, 32}
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 60 /* The maximum brightness level for RGB_MATRIX */
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 /* The maximum brightness level for RGB_MATRIX */
#define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set
#define RGB_MATRIX_KEYPRESSES
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
Expand Down
1 change: 1 addition & 0 deletions keyboards/fingerpunch/barobord/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ ifeq ($(strip $(PIMORONI_TRACKBALL_ENABLE)), yes)
OPT_DEFS += -DPIMORONI_TRACKBALL_ENABLE
endif

DEFERRED_EXEC_ENABLE = yes
SRC += keyboards/fingerpunch/fp.c \
keyboards/fingerpunch/fp_haptic.c \
keyboards/fingerpunch/fp_keyhandler.c \
Expand Down
4 changes: 2 additions & 2 deletions keyboards/fingerpunch/barobord_byomcu/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_HUE_STEP 16
#define RGBLIGHT_SAT_STEP 16
#define RGBLIGHT_VAL_STEP 16
#define RGBLIGHT_LIMIT_VAL 60 /* The maximum brightness level for RGBLIGHT_ENABLE */
#define RGBLIGHT_LIMIT_VAL 150 /* The maximum brightness level for RGBLIGHT_ENABLE */
#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
#define RGBLIGHT_EFFECT_ALTERNATING
#define RGBLIGHT_EFFECT_BREATHING
Expand All @@ -66,7 +66,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef RGB_MATRIX_ENABLE
#define DRIVER_LED_TOTAL 40
#define RGB_MATRIX_CENTER {100, 32}
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 60 /* The maximum brightness level for RGB_MATRIX */
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 /* The maximum brightness level for RGB_MATRIX */
#define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set
#define RGB_MATRIX_KEYPRESSES
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
Expand Down
1 change: 1 addition & 0 deletions keyboards/fingerpunch/barobord_byomcu/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ ifeq ($(strip $(PIMORONI_TRACKBALL_ENABLE)), yes)
OPT_DEFS += -DPIMORONI_TRACKBALL_ENABLE
endif

DEFERRED_EXEC_ENABLE = yes
SRC += keyboards/fingerpunch/fp.c \
keyboards/fingerpunch/fp_haptic.c \
keyboards/fingerpunch/fp_keyhandler.c \
Expand Down
29 changes: 10 additions & 19 deletions keyboards/fingerpunch/bgkeeb/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_HUE_STEP 16
#define RGBLIGHT_SAT_STEP 16
#define RGBLIGHT_VAL_STEP 16
#define RGBLIGHT_LIMIT_VAL 60 /* The maximum brightness level for RGBLIGHT_ENABLE */
#define RGBLIGHT_LIMIT_VAL 150 /* The maximum brightness level for RGBLIGHT_ENABLE */
#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
// /*== all animations enable ==*/
// #define RGBLIGHT_ANIMATIONS
// /*== or choose animations ==*/
// #define RGBLIGHT_EFFECT_BREATHING
// #define RGBLIGHT_EFFECT_RAINBOW_MOOD
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
// #define RGBLIGHT_EFFECT_SNAKE
// #define RGBLIGHT_EFFECT_KNIGHT
// #define RGBLIGHT_EFFECT_CHRISTMAS
// #define RGBLIGHT_EFFECT_STATIC_GRADIENT
// #define RGBLIGHT_EFFECT_RGB_TEST
// #define RGBLIGHT_EFFECT_ALTERNATING
// /*== customize breathing effect ==*/
// /*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
// #define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
// /*==== use exp() and sin() ====*/
// #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
// #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
#define RGBLIGHT_EFFECT_ALTERNATING
#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_CHRISTMAS
#define RGBLIGHT_EFFECT_KNIGHT
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
#define RGBLIGHT_EFFECT_SNAKE
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
#define RGBLIGHT_EFFECT_TWINKLE
#endif

#define ENCODERS_PAD_A {B5}
Expand Down
1 change: 1 addition & 0 deletions keyboards/fingerpunch/bgkeeb/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ SPLIT_KEYBOARD = yes

LAYOUTS = split_3x5_3

DEFERRED_EXEC_ENABLE = yes
SRC += keyboards/fingerpunch/fp.c \
keyboards/fingerpunch/fp_haptic.c \
keyboards/fingerpunch/fp_keyhandler.c \
Expand Down
Loading

0 comments on commit 42c905b

Please sign in to comment.