From 7e0dc5376f2d57a1b24831c4e25699a2cf2326af Mon Sep 17 00:00:00 2001 From: spidey3 Date: Mon, 23 Mar 2020 00:11:41 -0400 Subject: [Keymap] Add spidey3 keymap for 75_ansi, and a spidey3 userspace (#8470) * First cut at Josh Diamond's KBD75 customizations. Includes: * My unique keymap with ChromeOS specific keys * Use RGB underglow to indicate Caps Lock * Some unicode bindings * Some changes to make debugging easier * Updated spidey3 to be applicable to all 75_ansi boards * Sadly, ChromeOS doesn't pay attention to most consumer codes * Add mac layer; fix flakeyness in CAPS_LOCK underglow. * Make layers.json match the keymap (to the extent possible) * Major cleanup; fix broken debug persistence * Cleanup some whitespace issues * Fix incorrect log message. * Rework layer indication to user RGBLIGHT_LAYERS * Update layouts/community/75_ansi/spidey3/keymap.c Co-Authored-By: Drashna Jaelre * Rename users/spidey3/rgblight.c to layer_rgb.c per suggestion * Refactor to use set_single_persistant_default_layer(). * Use dprint/f to make logging more elegant. * Update users/spidey3/config.h Co-Authored-By: Drashna Jaelre * Update users/spidey3/config.h Co-Authored-By: Drashna Jaelre * Update layouts/community/75_ansi/spidey3/rules.mk Co-Authored-By: Ryan * Update users/spidey3/spidey3.c Co-Authored-By: Ryan * Update users/spidey3/layer_rgb.c Co-Authored-By: Ryan * Update users/spidey3/init.c Co-Authored-By: Ryan * Changes from code review Co-authored-by: Joshua Diamond Co-authored-by: Drashna Jaelre Co-authored-by: Ryan --- users/spidey3/layer_rgb.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 users/spidey3/layer_rgb.c (limited to 'users/spidey3/layer_rgb.c') diff --git a/users/spidey3/layer_rgb.c b/users/spidey3/layer_rgb.c new file mode 100644 index 0000000000..d80eb20a31 --- /dev/null +++ b/users/spidey3/layer_rgb.c @@ -0,0 +1,81 @@ +#include QMK_KEYBOARD_H + +#include "spidey3.h" +#include "velocikey.h" + +uint32_t rgb_mode; +uint16_t rgb_hue; +uint8_t rgb_sat; +uint8_t rgb_val; +bool rgb_saved = 0; + +void spidey_swirl(void) { + dprint("SPIDEY3: Setting Spidey Swirl!\n"); + rgblight_enable(); + rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL); + rgblight_sethsv(213, 255, 128); +#ifdef VELOCIKEY_ENABLE + if (!velocikey_enabled()) + velocikey_toggle(); +#endif +} + +void eeconfig_init_user_rgb(void) +{ + spidey_swirl(); +} + +const rgblight_segment_t PROGMEM _capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( {0, 2, HSV_AZURE}, {14, 2, HSV_AZURE} ); +const rgblight_segment_t PROGMEM _layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( {7, 1, HSV_PURPLE} ); +const rgblight_segment_t PROGMEM _layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( {9, 2, HSV_GREEN} ); + +// Now define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM _rgb_layers[] = RGBLIGHT_LAYERS_LIST( _capslock_layer, _layer1_layer, _layer2_layer ); +const uint8_t PROGMEM _n_rgb_layers = sizeof(_rgb_layers) / sizeof(_rgb_layers[0]) - 1; + +void do_rgb_layers(layer_state_t state, uint8_t start, uint8_t end) { + dprint("SPIDEY3: do_rgb_layers()\n"); + for (uint8_t i=start; ievent.pressed) { + spidey_swirl(); + } + break; + } + + return true; +} -- cgit v1.2.3