diff options
| author | Joel Challis <git@zvecr.com> | 2021-10-20 21:27:46 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-20 21:27:46 +0100 |
| commit | 1816006121de991581d50d0bc6b5a653e2b3ccd2 (patch) | |
| tree | 3de083612fba22f40b6f899e35e085b797fc51d0 | |
| parent | d4be4b67a251ecc046d857c5cd00cfb37c394ab7 (diff) | |
| download | qmk_firmware-1816006121de991581d50d0bc6b5a653e2b3ccd2.tar.gz qmk_firmware-1816006121de991581d50d0bc6b5a653e2b3ccd2.zip | |
Tidy up LCD_ENABLE/visualizer references (#14855)
* Tidy up LCD_ENABLE/visualizer references
* Fix up my (333fred) ergodox keymap with new LCD driver
Co-authored-by: Fredric Silberberg <fred@silberberg.xyz>
19 files changed, 57 insertions, 1107 deletions
diff --git a/common_features.mk b/common_features.mk index 083aa4aaa..af538b696 100644 --- a/common_features.mk +++ b/common_features.mk | |||
| @@ -326,10 +326,6 @@ ifneq ($(strip $(VARIABLE_TRACE)),no) | |||
| 326 | endif | 326 | endif |
| 327 | endif | 327 | endif |
| 328 | 328 | ||
| 329 | ifeq ($(strip $(LCD_ENABLE)), yes) | ||
| 330 | CIE1931_CURVE := yes | ||
| 331 | endif | ||
| 332 | |||
| 333 | VALID_BACKLIGHT_TYPES := pwm timer software custom | 329 | VALID_BACKLIGHT_TYPES := pwm timer software custom |
| 334 | 330 | ||
| 335 | BACKLIGHT_ENABLE ?= no | 331 | BACKLIGHT_ENABLE ?= no |
diff --git a/keyboards/ergodox_infinity/keymaps/dudeofawesome/config.h b/keyboards/ergodox_infinity/keymaps/dudeofawesome/config.h index 161958233..9dcf8a7f4 100644 --- a/keyboards/ergodox_infinity/keymaps/dudeofawesome/config.h +++ b/keyboards/ergodox_infinity/keymaps/dudeofawesome/config.h | |||
| @@ -6,6 +6,4 @@ | |||
| 6 | #include "../../config.h" | 6 | #include "../../config.h" |
| 7 | #include "dudeofawesome.h" | 7 | #include "dudeofawesome.h" |
| 8 | 8 | ||
| 9 | #include "./visualizer.h" | ||
| 10 | |||
| 11 | #endif | 9 | #endif |
diff --git a/keyboards/ergodox_infinity/keymaps/dudeofawesome/keymap.c b/keyboards/ergodox_infinity/keymaps/dudeofawesome/keymap.c index c3ea48654..675b56ede 100644 --- a/keyboards/ergodox_infinity/keymaps/dudeofawesome/keymap.c +++ b/keyboards/ergodox_infinity/keymaps/dudeofawesome/keymap.c | |||
| @@ -471,8 +471,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 471 | }; | 471 | }; |
| 472 | 472 | ||
| 473 | void matrix_init_user() { | 473 | void matrix_init_user() { |
| 474 | backlight_enable(); | 474 | led_matrix_enable_noeeprom(); |
| 475 | backlight_level(BACKLIGHT_LEVELS); | 475 | led_matrix_set_val_noeeprom(UINT8_MAX); |
| 476 | } | 476 | } |
| 477 | 477 | ||
| 478 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 478 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
diff --git a/keyboards/ergodox_infinity/keymaps/dudeofawesome/simple_visualizer.h b/keyboards/ergodox_infinity/keymaps/dudeofawesome/simple_visualizer.h deleted file mode 100644 index 9213e99f4..000000000 --- a/keyboards/ergodox_infinity/keymaps/dudeofawesome/simple_visualizer.h +++ /dev/null | |||
| @@ -1,123 +0,0 @@ | |||
| 1 | /* Copyright 2017 Fred Sundvik | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef KEYBOARDS_ERGODOX_INFINITY_SIMPLE_VISUALIZER_H_ | ||
| 18 | #define KEYBOARDS_ERGODOX_INFINITY_SIMPLE_VISUALIZER_H_ | ||
| 19 | |||
| 20 | // Currently we are assuming that both the backlight and LCD are enabled | ||
| 21 | // But it's entirely possible to write a custom visualizer that use only | ||
| 22 | // one of them | ||
| 23 | #ifndef LCD_BACKLIGHT_ENABLE | ||
| 24 | #error This visualizer needs that LCD backlight is enabled | ||
| 25 | #endif | ||
| 26 | |||
| 27 | #ifndef LCD_ENABLE | ||
| 28 | #error This visualizer needs that LCD is enabled | ||
| 29 | #endif | ||
| 30 | |||
| 31 | #include "visualizer.h" | ||
| 32 | #include "visualizer_keyframes.h" | ||
| 33 | #include "lcd_keyframes.h" | ||
| 34 | #include "lcd_backlight_keyframes.h" | ||
| 35 | #include "system/serial_link.h" | ||
| 36 | #include "led.h" | ||
| 37 | #include "default_animations.h" | ||
| 38 | |||
| 39 | static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); | ||
| 40 | static const uint32_t initial_color = LCD_COLOR(0, 0, 0); | ||
| 41 | |||
| 42 | static bool initial_update = true; | ||
| 43 | |||
| 44 | // Feel free to modify the animations below, or even add new ones if needed | ||
| 45 | |||
| 46 | static keyframe_animation_t lcd_layer_display = { | ||
| 47 | .num_frames = 1, | ||
| 48 | .loop = false, | ||
| 49 | .frame_lengths = {gfxMillisecondsToTicks(0)}, | ||
| 50 | .frame_functions = {lcd_keyframe_display_layer_and_led_states} | ||
| 51 | }; | ||
| 52 | |||
| 53 | // The color animation animates the LCD color when you change layers | ||
| 54 | static keyframe_animation_t color_animation = { | ||
| 55 | .num_frames = 2, | ||
| 56 | .loop = false, | ||
| 57 | // Note that there's a 200 ms no-operation frame, | ||
| 58 | // this prevents the color from changing when activating the layer | ||
| 59 | // momentarily | ||
| 60 | .frame_lengths = {gfxMillisecondsToTicks(1), gfxMillisecondsToTicks(5)}, | ||
| 61 | .frame_functions = {keyframe_no_operation, lcd_backlight_keyframe_animate_color}, | ||
| 62 | }; | ||
| 63 | |||
| 64 | void initialize_user_visualizer(visualizer_state_t* state) { | ||
| 65 | // The brightness will be dynamically adjustable in the future | ||
| 66 | // But for now, change it here. | ||
| 67 | lcd_backlight_brightness(130); | ||
| 68 | state->current_lcd_color = initial_color; | ||
| 69 | state->target_lcd_color = logo_background_color; | ||
| 70 | initial_update = true; | ||
| 71 | start_keyframe_animation(&default_startup_animation); | ||
| 72 | } | ||
| 73 | |||
| 74 | |||
| 75 | // This function should be implemented by the keymap visualizer | ||
| 76 | // Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing | ||
| 77 | // that the simple_visualizer assumes that you are updating | ||
| 78 | // Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is | ||
| 79 | // stopped. This can be done by either double buffering it or by using constant strings | ||
| 80 | static void get_visualizer_layer_and_color(visualizer_state_t* state); | ||
| 81 | |||
| 82 | void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) { | ||
| 83 | // Add more tests, change the colors and layer texts here | ||
| 84 | // Usually you want to check the high bits (higher layers first) | ||
| 85 | // because that's the order layers are processed for keypresses | ||
| 86 | // You can for check for example: | ||
| 87 | // state->status.layer | ||
| 88 | // state->status.default_layer | ||
| 89 | // state->status.leds (see led.h for available statuses) | ||
| 90 | |||
| 91 | uint32_t prev_color = state->target_lcd_color; | ||
| 92 | const char* prev_layer_text = state->layer_text; | ||
| 93 | |||
| 94 | get_visualizer_layer_and_color(state); | ||
| 95 | |||
| 96 | if (initial_update || prev_color != state->target_lcd_color) { | ||
| 97 | start_keyframe_animation(&color_animation); | ||
| 98 | } | ||
| 99 | |||
| 100 | if (initial_update || prev_layer_text != state->layer_text) { | ||
| 101 | start_keyframe_animation(&lcd_layer_display); | ||
| 102 | } | ||
| 103 | // You can also stop existing animations, and start your custom ones here | ||
| 104 | // remember that you should normally have only one animation for the LCD | ||
| 105 | // and one for the background. But you can also combine them if you want. | ||
| 106 | } | ||
| 107 | |||
| 108 | void user_visualizer_suspend(visualizer_state_t* state) { | ||
| 109 | state->layer_text = "Suspending..."; | ||
| 110 | uint8_t hue = LCD_HUE(state->current_lcd_color); | ||
| 111 | uint8_t sat = LCD_SAT(state->current_lcd_color); | ||
| 112 | state->target_lcd_color = LCD_COLOR(hue, sat, 0); | ||
| 113 | start_keyframe_animation(&default_suspend_animation); | ||
| 114 | } | ||
| 115 | |||
| 116 | void user_visualizer_resume(visualizer_state_t* state) { | ||
| 117 | state->current_lcd_color = initial_color; | ||
| 118 | state->target_lcd_color = logo_background_color; | ||
| 119 | initial_update = true; | ||
| 120 | start_keyframe_animation(&default_startup_animation); | ||
| 121 | } | ||
| 122 | |||
| 123 | #endif /* KEYBOARDS_ERGODOX_INFINITY_SIMPLE_VISUALIZER_H_ */ | ||
diff --git a/keyboards/ergodox_infinity/keymaps/dudeofawesome/visualizer.c b/keyboards/ergodox_infinity/keymaps/dudeofawesome/visualizer.c deleted file mode 100644 index 54fc2363c..000000000 --- a/keyboards/ergodox_infinity/keymaps/dudeofawesome/visualizer.c +++ /dev/null | |||
| @@ -1,79 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2017 Fred Sundvik | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "./simple_visualizer.h" | ||
| 19 | #include "util.h" | ||
| 20 | #include "layers.h" | ||
| 21 | |||
| 22 | // This function should be implemented by the keymap visualizer | ||
| 23 | // Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing | ||
| 24 | // that the simple_visualizer assumes that you are updating | ||
| 25 | // Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is | ||
| 26 | // stopped. This can be done by either double buffering it or by using constant strings | ||
| 27 | static void get_visualizer_layer_and_color(visualizer_state_t* state) { | ||
| 28 | switch(biton32(default_layer_state)) { | ||
| 29 | case _QWERTY: | ||
| 30 | state->layer_text = "QWERTY"; | ||
| 31 | state->target_lcd_color = LCD_COLOR(0, 255, 128); | ||
| 32 | break; | ||
| 33 | case _WORKMAN: | ||
| 34 | state->layer_text = "Workman"; | ||
| 35 | state->target_lcd_color = LCD_COLOR(80, 255, 128); | ||
| 36 | break; | ||
| 37 | case _DVORAK: | ||
| 38 | state->layer_text = "Dvorak"; | ||
| 39 | state->target_lcd_color = LCD_COLOR(194, 255, 128); | ||
| 40 | break; | ||
| 41 | case _COLEMAK: | ||
| 42 | state->layer_text = "Colemak"; | ||
| 43 | state->target_lcd_color = LCD_COLOR(18, 255, 128); | ||
| 44 | break; | ||
| 45 | } | ||
| 46 | |||
| 47 | switch(biton32(state->status.layer)) { | ||
| 48 | case _LOWER: | ||
| 49 | state->layer_text = "Lower"; | ||
| 50 | state->target_lcd_color = LCD_COLOR(141, 255, 255); | ||
| 51 | break; | ||
| 52 | case _RAISE: | ||
| 53 | state->layer_text = "Raise"; | ||
| 54 | state->target_lcd_color = LCD_COLOR(18, 255, 255); | ||
| 55 | break; | ||
| 56 | case _ADJUST: | ||
| 57 | state->layer_text = "Adjust"; | ||
| 58 | state->target_lcd_color = LCD_COLOR(194, 255, 255); | ||
| 59 | break; | ||
| 60 | case _NUM: | ||
| 61 | state->layer_text = "Numpad"; | ||
| 62 | state->target_lcd_color = LCD_COLOR(80, 255, 255); | ||
| 63 | break; | ||
| 64 | case _MOUSE: | ||
| 65 | state->layer_text = "Mouse"; | ||
| 66 | state->target_lcd_color = LCD_COLOR(300, 255, 255); | ||
| 67 | break; | ||
| 68 | case _GAME: | ||
| 69 | state->layer_text = "Game"; | ||
| 70 | state->target_lcd_color = LCD_COLOR(300, 255, 255); | ||
| 71 | break; | ||
| 72 | case _QWERTY: case _WORKMAN: case _DVORAK: case _COLEMAK: | ||
| 73 | break; | ||
| 74 | default: | ||
| 75 | state->layer_text = "NONE"; | ||
| 76 | state->target_lcd_color = LCD_COLOR(0, 255, 255); | ||
| 77 | break; | ||
| 78 | } | ||
| 79 | } | ||
diff --git a/keyboards/ergodox_infinity/keymaps/dudeofawesome/visualizer.h b/keyboards/ergodox_infinity/keymaps/dudeofawesome/visualizer.h deleted file mode 100644 index 740a951ec..000000000 --- a/keyboards/ergodox_infinity/keymaps/dudeofawesome/visualizer.h +++ /dev/null | |||
| @@ -1,35 +0,0 @@ | |||
| 1 | /* Copyright 2017 Fred Sundvik | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef VISUALIZER_H_ | ||
| 18 | #define VISUALIZER_H_ | ||
| 19 | |||
| 20 | #include "visualizer.h" | ||
| 21 | #include "led.h" | ||
| 22 | |||
| 23 | void ergodox_led_lower_on (void); | ||
| 24 | void ergodox_led_raise_on (void); | ||
| 25 | void ergodox_led_adjust_on (void); | ||
| 26 | |||
| 27 | void ergodox_led_lower_off (void); | ||
| 28 | void ergodox_led_raise_off (void); | ||
| 29 | void ergodox_led_adjust_off (void); | ||
| 30 | |||
| 31 | void ergodox_led_lower_set (uint8_t n); | ||
| 32 | void ergodox_led_raise_set (uint8_t n); | ||
| 33 | void ergodox_led_adjust_set (uint8_t n); | ||
| 34 | |||
| 35 | #endif /* VISUALIZER_H_ */ | ||
diff --git a/keyboards/ergodox_infinity/keymaps/halfkeyboard/visualizer.c b/keyboards/ergodox_infinity/keymaps/halfkeyboard/visualizer.c deleted file mode 100644 index 61a724c63..000000000 --- a/keyboards/ergodox_infinity/keymaps/halfkeyboard/visualizer.c +++ /dev/null | |||
| @@ -1,384 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2017 Fred Sundvik | ||
| 3 | This program is free software: you can redistribute it and/or modify | ||
| 4 | it under the terms of the GNU General Public License as published by | ||
| 5 | the Free Software Foundation, either version 2 of the License, or | ||
| 6 | (at your option) any later version. | ||
| 7 | This program is distributed in the hope that it will be useful, | ||
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 10 | GNU General Public License for more details. | ||
| 11 | You should have received a copy of the GNU General Public License | ||
| 12 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #include "visualizer.h" | ||
| 16 | #include "gfx.h" | ||
| 17 | #include "math.h" | ||
| 18 | #include "default_animations.h" | ||
| 19 | #include "led_backlight_keyframes.h" | ||
| 20 | |||
| 21 | #define NUM_ROWS LED_HEIGHT | ||
| 22 | #define NUM_COLS LED_WIDTH | ||
| 23 | |||
| 24 | #define ONESIDESCAN 10 | ||
| 25 | #define BOTHSIDESCAN 20 | ||
| 26 | #define FULL_ON LUMA2COLOR(255) | ||
| 27 | #define THREE_QUARTER LUMA2COLOR(200) | ||
| 28 | #define HALF_ON LUMA2COLOR(150) | ||
| 29 | #define ONE_QUARTER LUMA2COLOR(50) | ||
| 30 | |||
| 31 | #define CROSSFADE_TIME 500 | ||
| 32 | #define GRADIENT_TIME 3000 | ||
| 33 | bool led_backlight_keyframe_one_period_sweep(keyframe_animation_t* animation, visualizer_state_t* state); | ||
| 34 | bool led_backlight_keyframe_half_period_sweep_to_on(keyframe_animation_t* animation, visualizer_state_t* state); | ||
| 35 | bool led_backlight_keyframe_half_period_sweep_to_off(keyframe_animation_t* animation, visualizer_state_t* state); | ||
| 36 | keyframe_animation_t Fade_in_all_leds = { | ||
| 37 | .num_frames = 1, | ||
| 38 | .loop = false, | ||
| 39 | .frame_lengths = { | ||
| 40 | CROSSFADE_TIME, | ||
| 41 | }, | ||
| 42 | .frame_functions = { | ||
| 43 | led_backlight_keyframe_fade_in_all, | ||
| 44 | }, | ||
| 45 | }; | ||
| 46 | keyframe_animation_t decreasing_gradient = { | ||
| 47 | .num_frames = 8, | ||
| 48 | .loop = true, | ||
| 49 | .frame_lengths = { | ||
| 50 | gfxMillisecondsToTicks(GRADIENT_TIME), // left to rigt (outside in) | ||
| 51 | 0, // mirror leds | ||
| 52 | gfxMillisecondsToTicks(GRADIENT_TIME), // left_to_right (mirrored, so inside out) | ||
| 53 | 0, // normal leds | ||
| 54 | gfxMillisecondsToTicks(GRADIENT_TIME), // left to rigt (outside in) | ||
| 55 | 0, // mirror leds | ||
| 56 | gfxMillisecondsToTicks(GRADIENT_TIME), // left_to_right (mirrored, so inside out) | ||
| 57 | 0, // normal leds | ||
| 58 | }, | ||
| 59 | .frame_functions = { | ||
| 60 | led_backlight_keyframe_one_period_sweep, | ||
| 61 | led_backlight_keyframe_mirror_orientation, | ||
| 62 | keyframe_no_operation, | ||
| 63 | keyframe_no_operation, | ||
| 64 | keyframe_no_operation, | ||
| 65 | keyframe_no_operation, | ||
| 66 | led_backlight_keyframe_one_period_sweep, | ||
| 67 | led_backlight_keyframe_normal_orientation, | ||
| 68 | |||
| 69 | }, | ||
| 70 | }; | ||
| 71 | |||
| 72 | |||
| 73 | |||
| 74 | static uint8_t off_on_off_gradient(float t, float index, float num) { | ||
| 75 | const float two_pi = M_PI * 2.0f; | ||
| 76 | float normalized_index = (1.0f - index / (num - 1.0f)) * two_pi; | ||
| 77 | float x = t * two_pi + normalized_index-M_PI; | ||
| 78 | if((1*M_PI) < x && x < (3*M_PI)) | ||
| 79 | { | ||
| 80 | float v = 0.5 * (cosf(x) + 1.0f); | ||
| 81 | return (uint8_t)(255.0f * v); | ||
| 82 | } | ||
| 83 | else | ||
| 84 | { | ||
| 85 | return 0; | ||
| 86 | } | ||
| 87 | } | ||
| 88 | static uint8_t off_on_gradient(float t, float index, float num) { | ||
| 89 | const float two_pi = M_PI * 2.0f; | ||
| 90 | float normalized_index = (1.0f - index / (num - 1.0f)) * two_pi; | ||
| 91 | float x = t * two_pi + normalized_index-M_PI; | ||
| 92 | float v; | ||
| 93 | if((1*M_PI) < x && x < (2*M_PI)) | ||
| 94 | { | ||
| 95 | v = 0.5 * (cosf(x) + 1.0f); | ||
| 96 | } | ||
| 97 | else if(x >= (2*M_PI)) | ||
| 98 | { | ||
| 99 | v = 1; | ||
| 100 | } | ||
| 101 | else | ||
| 102 | { | ||
| 103 | v = 0; | ||
| 104 | } | ||
| 105 | return (uint8_t)(255.0f * v); | ||
| 106 | } | ||
| 107 | static uint8_t on_off_gradient(float t, float index, float num) { | ||
| 108 | const float two_pi = M_PI * 2.0f; | ||
| 109 | float normalized_index = (1.0f - index / (num - 1.0f)) * two_pi; | ||
| 110 | float x = t * two_pi + normalized_index-M_PI; | ||
| 111 | float v; | ||
| 112 | if((2*M_PI) < x && x < (3*M_PI)) | ||
| 113 | { | ||
| 114 | v = 0.5 * (cosf(x) + 1.0f); | ||
| 115 | |||
| 116 | } | ||
| 117 | else if(x >= (3*M_PI)) | ||
| 118 | { | ||
| 119 | v = 0; | ||
| 120 | } | ||
| 121 | else | ||
| 122 | { | ||
| 123 | v = 1; | ||
| 124 | } | ||
| 125 | return (uint8_t)(255.0f * v); | ||
| 126 | } | ||
| 127 | |||
| 128 | bool led_backlight_keyframe_one_period_sweep(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 129 | (void)state; | ||
| 130 | float frame_length = animation->frame_lengths[animation->current_frame]; | ||
| 131 | float current_pos = frame_length - animation->time_left_in_frame; | ||
| 132 | float t = current_pos / frame_length; | ||
| 133 | for (int i=0; i< NUM_COLS; i++) { | ||
| 134 | uint8_t color = off_on_off_gradient(t*2, i, NUM_COLS); | ||
| 135 | gdispGDrawLine(LED_DISPLAY, i, 0, i, NUM_ROWS - 1, LUMA2COLOR(color)); | ||
| 136 | } | ||
| 137 | return true; | ||
| 138 | } | ||
| 139 | |||
| 140 | bool led_backlight_keyframe_half_period_sweep_to_on(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 141 | (void)state; | ||
| 142 | float frame_length = animation->frame_lengths[animation->current_frame]; | ||
| 143 | float current_pos = frame_length - animation->time_left_in_frame; | ||
| 144 | float t = current_pos / frame_length; | ||
| 145 | for (int i=0; i< NUM_COLS; i++) { | ||
| 146 | uint8_t color = off_on_gradient(t*2, i, NUM_COLS); | ||
| 147 | gdispGDrawLine(LED_DISPLAY, i, 0, i, NUM_ROWS - 1, LUMA2COLOR(color)); | ||
| 148 | } | ||
| 149 | return true; | ||
| 150 | } | ||
| 151 | bool led_backlight_keyframe_half_period_sweep_to_off(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 152 | (void)state; | ||
| 153 | float frame_length = animation->frame_lengths[animation->current_frame]; | ||
| 154 | float current_pos = frame_length - animation->time_left_in_frame; | ||
| 155 | float t = current_pos / frame_length; | ||
| 156 | for (int i=0; i< NUM_COLS; i++) { | ||
| 157 | uint8_t color = on_off_gradient(t*2, i, NUM_COLS); | ||
| 158 | gdispGDrawLine(LED_DISPLAY, i, 0, i, NUM_ROWS - 1, LUMA2COLOR(color)); | ||
| 159 | } | ||
| 160 | return true; | ||
| 161 | } | ||
| 162 | |||
| 163 | |||
| 164 | /* | ||
| 165 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+ | ||
| 166 | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | phase | | ||
| 167 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+ | ||
| 168 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | ||
| 169 | | 6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | | ||
| 170 | | 5 | 6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | | ||
| 171 | | 4 | 5 | 6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | | ||
| 172 | | 3 | 4 | 5 | 6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | | ||
| 173 | | 2 | 3 | 4 | 5 | 6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | | ||
| 174 | | 1 | 2 | 3 | 4 | 5 | 6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | | ||
| 175 | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | | ||
| 176 | | 0 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | | ||
| 177 | | 0 | 0 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 0 | 0 | 0 | 0 | 0 | 9 | | ||
| 178 | | 0 | 0 | 0 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 0 | 0 | 0 | 0 | 10 | | ||
| 179 | | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 0 | 0 | 0 | 11 | | ||
| 180 | | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 0 | 0 | 12 | | ||
| 181 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 0 | 13 | | ||
| 182 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 14 | | ||
| 183 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 3 | 4 | 5 | 15 | | ||
| 184 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 3 | 4 | 16 | | ||
| 185 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 3 | 17 | | ||
| 186 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 18 | | ||
| 187 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 19 | | ||
| 188 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 20 | | ||
| 189 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+ | ||
| 190 | */ | ||
| 191 | |||
| 192 | #ifdef MASTER_IS_ON_RIGHT /*right side*/ | ||
| 193 | keyframe_animation_t sweep_on_sweep_off_left_and_right = { | ||
| 194 | .num_frames = 12, | ||
| 195 | .loop = true, | ||
| 196 | .frame_lengths = { | ||
| 197 | 0, | ||
| 198 | 1, | ||
| 199 | gfxMillisecondsToTicks(GRADIENT_TIME), // left on | ||
| 200 | gfxMillisecondsToTicks(GRADIENT_TIME), // right on | ||
| 201 | gfxMillisecondsToTicks(GRADIENT_TIME), // left off | ||
| 202 | gfxMillisecondsToTicks(GRADIENT_TIME), // right off | ||
| 203 | 0, // mirror leds | ||
| 204 | gfxMillisecondsToTicks(GRADIENT_TIME), // right on | ||
| 205 | gfxMillisecondsToTicks(GRADIENT_TIME), // left on | ||
| 206 | gfxMillisecondsToTicks(GRADIENT_TIME), // right off | ||
| 207 | gfxMillisecondsToTicks(GRADIENT_TIME), // left off | ||
| 208 | 0, // normal leds | ||
| 209 | }, | ||
| 210 | .frame_functions = { | ||
| 211 | led_backlight_keyframe_mirror_orientation, | ||
| 212 | led_backlight_keyframe_fade_out_all, | ||
| 213 | keyframe_no_operation, | ||
| 214 | led_backlight_keyframe_half_period_sweep_to_on, | ||
| 215 | keyframe_no_operation, | ||
| 216 | led_backlight_keyframe_half_period_sweep_to_off, | ||
| 217 | led_backlight_keyframe_normal_orientation, | ||
| 218 | led_backlight_keyframe_half_period_sweep_to_on, | ||
| 219 | keyframe_no_operation, | ||
| 220 | led_backlight_keyframe_half_period_sweep_to_off, | ||
| 221 | keyframe_no_operation, | ||
| 222 | led_backlight_keyframe_mirror_orientation, | ||
| 223 | |||
| 224 | }, | ||
| 225 | }; | ||
| 226 | keyframe_animation_t both_sides_fade_across = { | ||
| 227 | .num_frames = 10, | ||
| 228 | .loop = true, | ||
| 229 | .frame_lengths = { | ||
| 230 | 0, | ||
| 231 | 1, | ||
| 232 | gfxMillisecondsToTicks(GRADIENT_TIME), // left to rigt (outside in) | ||
| 233 | 0, // mirror leds | ||
| 234 | gfxMillisecondsToTicks(GRADIENT_TIME), // left_to_right (mirrored, so inside out) | ||
| 235 | 0, // normal leds | ||
| 236 | gfxMillisecondsToTicks(GRADIENT_TIME), // left to rigt (outside in) | ||
| 237 | 0, // mirror leds | ||
| 238 | gfxMillisecondsToTicks(GRADIENT_TIME), // left_to_right (mirrored, so inside out) | ||
| 239 | 0, // normal leds | ||
| 240 | }, | ||
| 241 | .frame_functions = { | ||
| 242 | led_backlight_keyframe_mirror_orientation, | ||
| 243 | led_backlight_keyframe_fade_out_all, | ||
| 244 | keyframe_no_operation, | ||
| 245 | keyframe_no_operation, | ||
| 246 | led_backlight_keyframe_one_period_sweep, | ||
| 247 | led_backlight_keyframe_normal_orientation, | ||
| 248 | led_backlight_keyframe_one_period_sweep, | ||
| 249 | led_backlight_keyframe_mirror_orientation, | ||
| 250 | keyframe_no_operation, | ||
| 251 | keyframe_no_operation, | ||
| 252 | }, | ||
| 253 | }; | ||
| 254 | |||
| 255 | #else /*left side*/ | ||
| 256 | keyframe_animation_t sweep_on_sweep_off_left_and_right = { | ||
| 257 | .num_frames = 10, | ||
| 258 | .loop = true, | ||
| 259 | .frame_lengths = { | ||
| 260 | gfxMillisecondsToTicks(GRADIENT_TIME), // left on | ||
| 261 | gfxMillisecondsToTicks(GRADIENT_TIME), // right on | ||
| 262 | gfxMillisecondsToTicks(GRADIENT_TIME), // left off | ||
| 263 | gfxMillisecondsToTicks(GRADIENT_TIME), // right off | ||
| 264 | 0, // mirror leds | ||
| 265 | gfxMillisecondsToTicks(GRADIENT_TIME), // right on | ||
| 266 | gfxMillisecondsToTicks(GRADIENT_TIME), // left on | ||
| 267 | gfxMillisecondsToTicks(GRADIENT_TIME), // right off | ||
| 268 | gfxMillisecondsToTicks(GRADIENT_TIME), // left off | ||
| 269 | 0, // normal leds | ||
| 270 | }, | ||
| 271 | .frame_functions = { | ||
| 272 | led_backlight_keyframe_half_period_sweep_to_on, | ||
| 273 | keyframe_no_operation, | ||
| 274 | led_backlight_keyframe_half_period_sweep_to_off, | ||
| 275 | keyframe_no_operation, | ||
| 276 | led_backlight_keyframe_mirror_orientation, | ||
| 277 | keyframe_no_operation, | ||
| 278 | led_backlight_keyframe_half_period_sweep_to_on, | ||
| 279 | keyframe_no_operation, | ||
| 280 | led_backlight_keyframe_half_period_sweep_to_off, | ||
| 281 | led_backlight_keyframe_normal_orientation, | ||
| 282 | |||
| 283 | }, | ||
| 284 | }; | ||
| 285 | keyframe_animation_t both_sides_fade_across = { | ||
| 286 | .num_frames = 8, | ||
| 287 | .loop = true, | ||
| 288 | .frame_lengths = { | ||
| 289 | gfxMillisecondsToTicks(GRADIENT_TIME), // left to rigt (outside in) | ||
| 290 | 0, // mirror leds | ||
| 291 | gfxMillisecondsToTicks(GRADIENT_TIME), // left_to_right (mirrored, so inside out) | ||
| 292 | 0, // normal leds | ||
| 293 | gfxMillisecondsToTicks(GRADIENT_TIME), // left to rigt (outside in) | ||
| 294 | 0, // mirror leds | ||
| 295 | gfxMillisecondsToTicks(GRADIENT_TIME), // left_to_right (mirrored, so inside out) | ||
| 296 | 0, // normal leds | ||
| 297 | }, | ||
| 298 | .frame_functions = { | ||
| 299 | led_backlight_keyframe_one_period_sweep, | ||
| 300 | led_backlight_keyframe_mirror_orientation, | ||
| 301 | keyframe_no_operation, | ||
| 302 | keyframe_no_operation, | ||
| 303 | keyframe_no_operation, | ||
| 304 | keyframe_no_operation, | ||
| 305 | led_backlight_keyframe_one_period_sweep, | ||
| 306 | led_backlight_keyframe_normal_orientation, | ||
| 307 | |||
| 308 | }, | ||
| 309 | }; | ||
| 310 | |||
| 311 | |||
| 312 | #endif | ||
| 313 | |||
| 314 | #define RED 0 | ||
| 315 | #define ORANGE 21 | ||
| 316 | #define YELLOW 42 | ||
| 317 | #define SPRING_GREEN 64 | ||
| 318 | #define GREEN 85 | ||
| 319 | #define TURQUOISE 107 | ||
| 320 | #define CYAN 127 | ||
| 321 | #define OCEAN 149 | ||
| 322 | #define BLUE 170 | ||
| 323 | #define VIOLET 192 | ||
| 324 | #define MAGENTA 212 | ||
| 325 | #define RASPBERRY 234 | ||
| 326 | |||
| 327 | // This function should be implemented by the keymap visualizer | ||
| 328 | // Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing | ||
| 329 | // that the simple_visualizer assumes that you are updating | ||
| 330 | // Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is | ||
| 331 | // stopped. This can be done by either double buffering it or by using constant strings | ||
| 332 | static void get_visualizer_layer_and_color(visualizer_state_t* state) { | ||
| 333 | uint8_t saturation = 255; | ||
| 334 | /* if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) { | ||
| 335 | saturation = 255; | ||
| 336 | } */ | ||
| 337 | |||
| 338 | if (state->status.layer & 0x400) { | ||
| 339 | state->target_lcd_color = LCD_COLOR(OCEAN, saturation, 0xFF); | ||
| 340 | state->layer_text = "STENOGRAPHY"; | ||
| 341 | } | ||
| 342 | else if (state->status.layer & 0x200) { | ||
| 343 | state->target_lcd_color = LCD_COLOR(GREEN, saturation, 0xFF); | ||
| 344 | state->layer_text = "FUNCTION"; | ||
| 345 | } | ||
| 346 | else if (state->status.layer & 0x100) { | ||
| 347 | state->target_lcd_color = LCD_COLOR(MAGENTA, saturation, 0xFF); | ||
| 348 | state->layer_text = "Shortcuts Layer"; | ||
| 349 | stop_keyframe_animation(&sweep_on_sweep_off_left_and_right); | ||
| 350 | start_keyframe_animation(&led_test_animation); | ||
| 351 | } | ||
| 352 | else if (state->status.layer & 0x80) { | ||
| 353 | state->target_lcd_color = LCD_COLOR(VIOLET, saturation, 0xFF); | ||
| 354 | state->layer_text = "Plover"; | ||
| 355 | } | ||
| 356 | else if (state->status.layer & 0x40) { | ||
| 357 | state->target_lcd_color = LCD_COLOR(RASPBERRY, saturation, 0xFF); | ||
| 358 | state->layer_text = "Mirrored Symbols"; | ||
| 359 | } | ||
| 360 | else if (state->status.layer & 0x20) { | ||
| 361 | state->target_lcd_color = LCD_COLOR(RED, saturation, 0xFF); | ||
| 362 | state->layer_text = "Symbols"; | ||
| 363 | } | ||
| 364 | else if (state->status.layer & 0x8) { | ||
| 365 | state->target_lcd_color = LCD_COLOR(OCEAN, saturation, 0xFF); | ||
| 366 | state->layer_text = "Mirrored Dvorak"; | ||
| 367 | } | ||
| 368 | else if (state->status.layer & 0x4) { | ||
| 369 | state->target_lcd_color = LCD_COLOR(BLUE, saturation, 0xFF); | ||
| 370 | state->layer_text = "Dvorak"; | ||
| 371 | stop_keyframe_animation(&led_test_animation); | ||
| 372 | start_keyframe_animation(&sweep_on_sweep_off_left_and_right); | ||
| 373 | } | ||
| 374 | else if (state->status.layer & 0x2) { | ||
| 375 | state->target_lcd_color = LCD_COLOR(ORANGE, saturation, 0xFF); | ||
| 376 | state->layer_text = "Mirrored Qwerty"; | ||
| 377 | } | ||
| 378 | else { | ||
| 379 | state->target_lcd_color = LCD_COLOR(YELLOW, saturation, 0xFF); | ||
| 380 | state->layer_text = "Qwerty"; | ||
| 381 | stop_keyframe_animation(&led_test_animation); | ||
| 382 | start_keyframe_animation(&Fade_in_all_leds); | ||
| 383 | } | ||
| 384 | } | ||
diff --git a/keyboards/ergodox_infinity/keymaps/halfkeyboard/visualizer.h b/keyboards/ergodox_infinity/keymaps/halfkeyboard/visualizer.h deleted file mode 100644 index c97a7a22a..000000000 --- a/keyboards/ergodox_infinity/keymaps/halfkeyboard/visualizer.h +++ /dev/null | |||
| @@ -1,125 +0,0 @@ | |||
| 1 | /* Copyright 2017 Fred Sundvik | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef VISUALIZER_H_ | ||
| 18 | #define VISUALIZER_H_ | ||
| 19 | |||
| 20 | // Currently we are assuming that both the backlight and LCD are enabled | ||
| 21 | // But it's entirely possible to write a custom visualizer that use only | ||
| 22 | // one of them | ||
| 23 | #ifndef LCD_BACKLIGHT_ENABLE | ||
| 24 | #error This visualizer needs that LCD backlight is enabled | ||
| 25 | #endif | ||
| 26 | |||
| 27 | #ifndef LCD_ENABLE | ||
| 28 | #error This visualizer needs that LCD is enabled | ||
| 29 | #endif | ||
| 30 | |||
| 31 | #include "visualizer.h" | ||
| 32 | #include "visualizer_keyframes.h" | ||
| 33 | #include "lcd_keyframes.h" | ||
| 34 | #include "lcd_backlight_keyframes.h" | ||
| 35 | #include "system/serial_link.h" | ||
| 36 | #include "led.h" | ||
| 37 | #include "default_animations.h" | ||
| 38 | |||
| 39 | static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); | ||
| 40 | static const uint32_t initial_color = LCD_COLOR(0, 0, 0); | ||
| 41 | |||
| 42 | static bool initial_update = true; | ||
| 43 | |||
| 44 | // Feel free to modify the animations below, or even add new ones if needed | ||
| 45 | extern keyframe_animation_t KITT_Scanner_animation; | ||
| 46 | |||
| 47 | static keyframe_animation_t lcd_layer_display = { | ||
| 48 | .num_frames = 1, | ||
| 49 | .loop = false, | ||
| 50 | .frame_lengths = {gfxMillisecondsToTicks(0)}, | ||
| 51 | .frame_functions = {lcd_keyframe_display_layer_and_led_states} | ||
| 52 | }; | ||
| 53 | |||
| 54 | // The color animation animates the LCD color when you change layers | ||
| 55 | static keyframe_animation_t color_animation = { | ||
| 56 | .num_frames = 2, | ||
| 57 | .loop = false, | ||
| 58 | // Note that there's a 200 ms no-operation frame, | ||
| 59 | // this prevents the color from changing when activating the layer | ||
| 60 | // momentarily | ||
| 61 | .frame_lengths = {gfxMillisecondsToTicks(200), gfxMillisecondsToTicks(500)}, | ||
| 62 | .frame_functions = {keyframe_no_operation, lcd_backlight_keyframe_animate_color}, | ||
| 63 | }; | ||
| 64 | |||
| 65 | void initialize_user_visualizer(visualizer_state_t* state) { | ||
| 66 | // The brightness will be dynamically adjustable in the future | ||
| 67 | // But for now, change it here. | ||
| 68 | lcd_backlight_brightness(130); | ||
| 69 | state->current_lcd_color = initial_color; | ||
| 70 | state->target_lcd_color = logo_background_color; | ||
| 71 | initial_update = true; | ||
| 72 | start_keyframe_animation(&default_startup_animation); | ||
| 73 | } | ||
| 74 | |||
| 75 | |||
| 76 | // This function should be implemented by the keymap visualizer | ||
| 77 | // Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing | ||
| 78 | // that the simple_visualizer assumes that you are updating | ||
| 79 | // Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is | ||
| 80 | // stopped. This can be done by either double buffering it or by using constant strings | ||
| 81 | static void get_visualizer_layer_and_color(visualizer_state_t* state); | ||
| 82 | |||
| 83 | void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) { | ||
| 84 | // Add more tests, change the colors and layer texts here | ||
| 85 | // Usually you want to check the high bits (higher layers first) | ||
| 86 | // because that's the order layers are processed for keypresses | ||
| 87 | // You can for check for example: | ||
| 88 | // state->status.layer | ||
| 89 | // state->status.default_layer | ||
| 90 | // state->status.leds (see led.h for available statuses) | ||
| 91 | |||
| 92 | uint32_t prev_color = state->target_lcd_color; | ||
| 93 | const char* prev_layer_text = state->layer_text; | ||
| 94 | |||
| 95 | get_visualizer_layer_and_color(state); | ||
| 96 | |||
| 97 | if (initial_update || prev_color != state->target_lcd_color) { | ||
| 98 | start_keyframe_animation(&color_animation); | ||
| 99 | } | ||
| 100 | |||
| 101 | if (initial_update || prev_layer_text != state->layer_text) { | ||
| 102 | start_keyframe_animation(&lcd_layer_display); | ||
| 103 | } | ||
| 104 | // You can also stop existing animations, and start your custom ones here | ||
| 105 | // remember that you should normally have only one animation for the LCD | ||
| 106 | // and one for the background. But you can also combine them if you want. | ||
| 107 | |||
| 108 | } | ||
| 109 | |||
| 110 | void user_visualizer_suspend(visualizer_state_t* state) { | ||
| 111 | state->layer_text = "Suspending..."; | ||
| 112 | uint8_t hue = LCD_HUE(state->current_lcd_color); | ||
| 113 | uint8_t sat = LCD_SAT(state->current_lcd_color); | ||
| 114 | state->target_lcd_color = LCD_COLOR(hue, sat, 0); | ||
| 115 | start_keyframe_animation(&default_suspend_animation); | ||
| 116 | } | ||
| 117 | |||
| 118 | void user_visualizer_resume(visualizer_state_t* state) { | ||
| 119 | state->current_lcd_color = initial_color; | ||
| 120 | state->target_lcd_color = logo_background_color; | ||
| 121 | initial_update = true; | ||
| 122 | start_keyframe_animation(&default_startup_animation); | ||
| 123 | } | ||
| 124 | |||
| 125 | #endif /* VISUALIZER_H_ */ | ||
diff --git a/layouts/community/ergodox/333fred/keymap.c b/layouts/community/ergodox/333fred/keymap.c index b9aefd929..5dee9a1e3 100644 --- a/layouts/community/ergodox/333fred/keymap.c +++ b/layouts/community/ergodox/333fred/keymap.c | |||
| @@ -272,3 +272,43 @@ void matrix_scan_user(void) { | |||
| 272 | ergodox_led_all_on(); | 272 | ergodox_led_all_on(); |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | #ifdef ST7565_ENABLE | ||
| 276 | |||
| 277 | void st7565_task_user(void) { | ||
| 278 | // The colors will need to be ported over to the quantum painter API when | ||
| 279 | // https://github.com/qmk/qmk_firmware/pull/10174 is merged. | ||
| 280 | |||
| 281 | st7565_clear(); | ||
| 282 | switch (get_highest_layer(layer_state)) { | ||
| 283 | case BASE: | ||
| 284 | //state->target_lcd_color = LCD_COLOR(84, saturation, 0xFF); | ||
| 285 | st7565_write_P(PSTR("Default\n"), false); | ||
| 286 | break; | ||
| 287 | case CODEFLOW: | ||
| 288 | //state->target_lcd_color = LCD_COLOR(216, 90, 0xFF); | ||
| 289 | st7565_write_P(PSTR("Code\n"), false); | ||
| 290 | break; | ||
| 291 | case SYMB: | ||
| 292 | //state->target_lcd_color = LCD_COLOR(168, saturation, 0xFF); | ||
| 293 | st7565_write_P(PSTR("Symbol\n"), false); | ||
| 294 | break; | ||
| 295 | case MDIA: | ||
| 296 | //state->target_lcd_color = LCD_COLOR(0, saturation, 0xFF); | ||
| 297 | st7565_write_P(PSTR("Media\n"), false); | ||
| 298 | break; | ||
| 299 | case VIM: | ||
| 300 | //state->target_lcd_color = LCD_COLOR(140, 100, 60); | ||
| 301 | st7565_write_P(PSTR("Movement\n"), false); | ||
| 302 | break; | ||
| 303 | case GAME: | ||
| 304 | //state->target_lcd_color = LCD_COLOR(0, 255, 60); | ||
| 305 | st7565_write_P(PSTR("Game\n"), false); | ||
| 306 | break; | ||
| 307 | case GAME_ARROW: | ||
| 308 | //state->target_lcd_color = LCD_COLOR(0, 255, 60); | ||
| 309 | st7565_write_P(PSTR("Game Arrow\n"), false); | ||
| 310 | break; | ||
| 311 | } | ||
| 312 | } | ||
| 313 | |||
| 314 | #endif | ||
diff --git a/layouts/community/ergodox/333fred/rules.mk b/layouts/community/ergodox/333fred/rules.mk index f6c71feb4..9a3e2b97e 100644 --- a/layouts/community/ergodox/333fred/rules.mk +++ b/layouts/community/ergodox/333fred/rules.mk | |||
| @@ -1,5 +1,2 @@ | |||
| 1 | LCD_BACKLIGHT_ENABLE = yes | ||
| 2 | LCD_ENABLE = yes | ||
| 3 | BACKLIGHT_ENABLE = yes | ||
| 4 | KEY_LOCK_ENABLE = yes | 1 | KEY_LOCK_ENABLE = yes |
| 5 | CONSOLE_ENABLE = no | 2 | CONSOLE_ENABLE = no |
diff --git a/layouts/community/ergodox/333fred/visualizer.c b/layouts/community/ergodox/333fred/visualizer.c deleted file mode 100644 index d13b3cd79..000000000 --- a/layouts/community/ergodox/333fred/visualizer.c +++ /dev/null | |||
| @@ -1,39 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Note: this is a modified copy of ../default/visualizer.c, originally licensed GPL. | ||
| 3 | */ | ||
| 4 | |||
| 5 | #include "simple_visualizer.h" | ||
| 6 | |||
| 7 | // This function should be implemented by the keymap visualizer | ||
| 8 | // Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing | ||
| 9 | // that the simple_visualizer assumes that you are updating | ||
| 10 | // Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is | ||
| 11 | // stopped. This can be done by either double buffering it or by using constant strings | ||
| 12 | static void get_visualizer_layer_and_color(visualizer_state_t* state) { | ||
| 13 | uint8_t saturation = 60; | ||
| 14 | if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) { | ||
| 15 | saturation = 255; | ||
| 16 | } | ||
| 17 | if (state->status.layer & 0x80) { | ||
| 18 | state->target_lcd_color = LCD_COLOR(0, 255, 60); | ||
| 19 | state->layer_text = "Game Arrow"; | ||
| 20 | } else if (state->status.layer & 0x40) { | ||
| 21 | state->target_lcd_color = LCD_COLOR(0, 255, 60); | ||
| 22 | state->layer_text = "Game"; | ||
| 23 | } else if (state->status.layer & 0x20) { | ||
| 24 | state->target_lcd_color = LCD_COLOR(140, 100, 60); | ||
| 25 | state->layer_text = "Movement"; | ||
| 26 | } else if (state->status.layer & 0x10) { | ||
| 27 | state->target_lcd_color = LCD_COLOR(0, saturation, 0xFF); | ||
| 28 | state->layer_text = "Media"; | ||
| 29 | } else if (state->status.layer & 0x8) { | ||
| 30 | state->target_lcd_color = LCD_COLOR(168, saturation, 0xFF); | ||
| 31 | state->layer_text = "Symbol"; | ||
| 32 | } else if (state->status.layer & 0x2 || state->status.layer & 0x4) { | ||
| 33 | state->target_lcd_color = LCD_COLOR(216, 90, 0xFF); | ||
| 34 | state->layer_text = "Code"; | ||
| 35 | } else { | ||
| 36 | state->target_lcd_color = LCD_COLOR(84, saturation, 0xFF); | ||
| 37 | state->layer_text = "Default"; | ||
| 38 | } | ||
| 39 | } | ||
diff --git a/layouts/community/ergodox/adnw_p_u_q/visualizer.c b/layouts/community/ergodox/adnw_p_u_q/visualizer.c deleted file mode 100644 index 9a4d48538..000000000 --- a/layouts/community/ergodox/adnw_p_u_q/visualizer.c +++ /dev/null | |||
| @@ -1,34 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Note: this is a modified copy of ../default/visualizer.c, originally licensed GPL. | ||
| 3 | */ | ||
| 4 | |||
| 5 | #include "simple_visualizer.h" | ||
| 6 | |||
| 7 | // This function should be implemented by the keymap visualizer | ||
| 8 | // Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing | ||
| 9 | // that the simple_visualizer assumes that you are updating | ||
| 10 | // Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is | ||
| 11 | // stopped. This can be done by either double buffering it or by using constant strings | ||
| 12 | static void get_visualizer_layer_and_color(visualizer_state_t* state) { | ||
| 13 | |||
| 14 | if (state->status.layer & 0x20) { | ||
| 15 | state->target_lcd_color = LCD_COLOR(127, 0xFF, 0xFF); | ||
| 16 | state->layer_text = "Mouse"; | ||
| 17 | } else if (state->status.layer & 0x10) { | ||
| 18 | state->target_lcd_color = LCD_COLOR(85, 0xFF, 0xFF); | ||
| 19 | state->layer_text = "Symbol"; | ||
| 20 | } else if (state->status.layer & 0x8) { | ||
| 21 | state->target_lcd_color = LCD_COLOR(64, 0xFF, 0xFF); | ||
| 22 | state->layer_text = "Brackets"; | ||
| 23 | } else if (state->status.layer & 0x4) { | ||
| 24 | state->target_lcd_color = LCD_COLOR(42, 0xFF, 0xFF); | ||
| 25 | state->layer_text = "Diak"; | ||
| 26 | } else if (state->status.layer & 0x2) { | ||
| 27 | state->target_lcd_color = LCD_COLOR(21, 0xFF, 0xFF); | ||
| 28 | state->layer_text = "Terminal"; | ||
| 29 | } else { | ||
| 30 | state->target_lcd_color = LCD_COLOR(192, 0xFF, 0xFF); | ||
| 31 | state->layer_text = "Vim"; | ||
| 32 | } | ||
| 33 | } | ||
| 34 | |||
diff --git a/layouts/community/ergodox/belak/keymap.c b/layouts/community/ergodox/belak/keymap.c index bca0dec91..de0fe1b1a 100644 --- a/layouts/community/ergodox/belak/keymap.c +++ b/layouts/community/ergodox/belak/keymap.c | |||
| @@ -33,11 +33,6 @@ enum belak_keycodes { | |||
| 33 | E_TSET, | 33 | E_TSET, |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | inline void tap(uint16_t keycode) { | ||
| 37 | register_code(keycode); | ||
| 38 | unregister_code(keycode); | ||
| 39 | }; | ||
| 40 | |||
| 41 | // TODO: Add LED support to the tap dance by using the advanced macro | 36 | // TODO: Add LED support to the tap dance by using the advanced macro |
| 42 | #define LTOGGLE TD(TD_LAYER_TOGGLE) | 37 | #define LTOGGLE TD(TD_LAYER_TOGGLE) |
| 43 | 38 | ||
| @@ -273,17 +268,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 273 | case E_SHRUG: // ¯\_(ツ)_/¯ | 268 | case E_SHRUG: // ¯\_(ツ)_/¯ |
| 274 | if (record->event.pressed) { | 269 | if (record->event.pressed) { |
| 275 | process_unicode((0x00AF|QK_UNICODE), record); // Hand | 270 | process_unicode((0x00AF|QK_UNICODE), record); // Hand |
| 276 | tap(KC_BSLS); // Arm | 271 | tap_code16(KC_BSLS); // Arm |
| 277 | register_code(KC_RSFT); | 272 | register_code(KC_RSFT); |
| 278 | tap(KC_UNDS); // Arm | 273 | tap_code16(KC_UNDS); // Arm |
| 279 | tap(KC_LPRN); // Head | 274 | tap_code16(KC_LPRN); // Head |
| 280 | unregister_code(KC_RSFT); | 275 | unregister_code(KC_RSFT); |
| 281 | process_unicode((0x30C4|QK_UNICODE), record); // Face | 276 | process_unicode((0x30C4|QK_UNICODE), record); // Face |
| 282 | register_code(KC_RSFT); | 277 | register_code(KC_RSFT); |
| 283 | tap(KC_RPRN); // Head | 278 | tap_code16(KC_RPRN); // Head |
| 284 | tap(KC_UNDS); // Arm | 279 | tap_code16(KC_UNDS); // Arm |
| 285 | unregister_code(KC_RSFT); | 280 | unregister_code(KC_RSFT); |
| 286 | tap(KC_SLSH); // Arm | 281 | tap_code16(KC_SLSH); // Arm |
| 287 | process_unicode((0x00AF|QK_UNICODE), record); // Hand | 282 | process_unicode((0x00AF|QK_UNICODE), record); // Hand |
| 288 | } | 283 | } |
| 289 | return false; | 284 | return false; |
| @@ -291,19 +286,19 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 291 | case E_TFLIP: // (╯°□°)╯ ︵ ┻━┻ | 286 | case E_TFLIP: // (╯°□°)╯ ︵ ┻━┻ |
| 292 | if (record->event.pressed) { | 287 | if (record->event.pressed) { |
| 293 | register_code(KC_RSFT); | 288 | register_code(KC_RSFT); |
| 294 | tap(KC_9); | 289 | tap_code16(KC_9); |
| 295 | unregister_code(KC_RSFT); | 290 | unregister_code(KC_RSFT); |
| 296 | process_unicode((0x256F|QK_UNICODE), record); // Arm | 291 | process_unicode((0x256F|QK_UNICODE), record); // Arm |
| 297 | process_unicode((0x00B0|QK_UNICODE), record); // Eye | 292 | process_unicode((0x00B0|QK_UNICODE), record); // Eye |
| 298 | process_unicode((0x25A1|QK_UNICODE), record); // Mouth | 293 | process_unicode((0x25A1|QK_UNICODE), record); // Mouth |
| 299 | process_unicode((0x00B0|QK_UNICODE), record); // Eye | 294 | process_unicode((0x00B0|QK_UNICODE), record); // Eye |
| 300 | register_code(KC_RSFT); | 295 | register_code(KC_RSFT); |
| 301 | tap(KC_0); | 296 | tap_code16(KC_0); |
| 302 | unregister_code(KC_RSFT); | 297 | unregister_code(KC_RSFT); |
| 303 | process_unicode((0x256F|QK_UNICODE), record); // Arm | 298 | process_unicode((0x256F|QK_UNICODE), record); // Arm |
| 304 | tap(KC_SPC); | 299 | tap_code16(KC_SPC); |
| 305 | process_unicode((0x0361|QK_UNICODE), record); // Flippy | 300 | process_unicode((0x0361|QK_UNICODE), record); // Flippy |
| 306 | tap(KC_SPC); | 301 | tap_code16(KC_SPC); |
| 307 | process_unicode((0x253B|QK_UNICODE), record); // Table | 302 | process_unicode((0x253B|QK_UNICODE), record); // Table |
| 308 | process_unicode((0x2501|QK_UNICODE), record); // Table | 303 | process_unicode((0x2501|QK_UNICODE), record); // Table |
| 309 | process_unicode((0x253B|QK_UNICODE), record); // Table | 304 | process_unicode((0x253B|QK_UNICODE), record); // Table |
| @@ -316,18 +311,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 316 | process_unicode((0x2500|QK_UNICODE), record); // Table | 311 | process_unicode((0x2500|QK_UNICODE), record); // Table |
| 317 | process_unicode((0x2500|QK_UNICODE), record); // Table | 312 | process_unicode((0x2500|QK_UNICODE), record); // Table |
| 318 | process_unicode((0x252C|QK_UNICODE), record); // Table | 313 | process_unicode((0x252C|QK_UNICODE), record); // Table |
| 319 | tap(KC_SPC); | 314 | tap_code16(KC_SPC); |
| 320 | process_unicode((0x30CE|QK_UNICODE), record); // Arm | 315 | process_unicode((0x30CE|QK_UNICODE), record); // Arm |
| 321 | register_code(KC_RSFT); | 316 | register_code(KC_RSFT); |
| 322 | tap(KC_9); | 317 | tap_code16(KC_9); |
| 323 | unregister_code(KC_RSFT); | 318 | unregister_code(KC_RSFT); |
| 324 | tap(KC_SPC); | 319 | tap_code16(KC_SPC); |
| 325 | process_unicode((0x309C|QK_UNICODE), record); // Eye | 320 | process_unicode((0x309C|QK_UNICODE), record); // Eye |
| 326 | tap(KC_MINS); | 321 | tap_code16(KC_MINS); |
| 327 | process_unicode((0x309C|QK_UNICODE), record); // Eye | 322 | process_unicode((0x309C|QK_UNICODE), record); // Eye |
| 328 | process_unicode((0x30CE|QK_UNICODE), record); // Arm | 323 | process_unicode((0x30CE|QK_UNICODE), record); // Arm |
| 329 | register_code(KC_RSFT); | 324 | register_code(KC_RSFT); |
| 330 | tap(KC_0); | 325 | tap_code16(KC_0); |
| 331 | unregister_code(KC_RSFT); | 326 | unregister_code(KC_RSFT); |
| 332 | } | 327 | } |
| 333 | return false; | 328 | return false; |
diff --git a/layouts/community/ergodox/belak/visualizer.c b/layouts/community/ergodox/belak/visualizer.c deleted file mode 100644 index b92890a66..000000000 --- a/layouts/community/ergodox/belak/visualizer.c +++ /dev/null | |||
| @@ -1,49 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2017 Fred Sundvik | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | // Currently we are assuming that both the backlight and LCD are enabled | ||
| 19 | // But it's entirely possible to write a custom visualizer that use only | ||
| 20 | // one of them | ||
| 21 | #ifndef LCD_BACKLIGHT_ENABLE | ||
| 22 | #error This visualizer needs that LCD backlight is enabled | ||
| 23 | #endif | ||
| 24 | |||
| 25 | #ifndef LCD_ENABLE | ||
| 26 | #error This visualizer needs that LCD is enabled | ||
| 27 | #endif | ||
| 28 | |||
| 29 | #include "simple_visualizer.h" | ||
| 30 | |||
| 31 | static void get_visualizer_layer_and_color(visualizer_state_t* state) { | ||
| 32 | uint8_t saturation = 60; | ||
| 33 | if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) { | ||
| 34 | saturation = 255; | ||
| 35 | } | ||
| 36 | |||
| 37 | if (state->status.layer & 0x4) { | ||
| 38 | state->target_lcd_color = LCD_COLOR(0, saturation, 0xFF); | ||
| 39 | state->layer_text = "Media"; | ||
| 40 | } | ||
| 41 | else if (state->status.layer & 0x2) { | ||
| 42 | state->target_lcd_color = LCD_COLOR(168, saturation, 0xFF); | ||
| 43 | state->layer_text = "Symbols"; | ||
| 44 | } | ||
| 45 | else { | ||
| 46 | state->target_lcd_color = LCD_COLOR(84, saturation, 0xFF); | ||
| 47 | state->layer_text = "Base"; | ||
| 48 | } | ||
| 49 | } | ||
diff --git a/layouts/community/ergodox/choromanski/visualizer.c b/layouts/community/ergodox/choromanski/visualizer.c deleted file mode 100644 index e207c6682..000000000 --- a/layouts/community/ergodox/choromanski/visualizer.c +++ /dev/null | |||
| @@ -1,62 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2017 Fred Sundvik | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "simple_visualizer.h" | ||
| 19 | |||
| 20 | // This function should be implemented by the keymap visualizer | ||
| 21 | // Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing | ||
| 22 | // that the simple_visualizer assumes that you are updating | ||
| 23 | // Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is | ||
| 24 | // stopped. This can be done by either double buffering it or by using constant strings | ||
| 25 | static void get_visualizer_layer_and_color(visualizer_state_t* state) { | ||
| 26 | |||
| 27 | if (state->status.layer & 0x20) { | ||
| 28 | //GREEN | ||
| 29 | state->target_lcd_color = LCD_COLOR(85, 255, 128); | ||
| 30 | state->layer_text = "Gaming"; | ||
| 31 | } | ||
| 32 | else if (state->status.layer & 0x10) { | ||
| 33 | //ORANGE | ||
| 34 | state->target_lcd_color = LCD_COLOR(28, 255, 230); | ||
| 35 | state->layer_text = "Numpad & Mouse"; | ||
| 36 | } | ||
| 37 | else if (state->status.layer & 0x8) { | ||
| 38 | //YELLOW | ||
| 39 | state->target_lcd_color = LCD_COLOR(38, 255, 230); | ||
| 40 | state->layer_text = "Symbols"; | ||
| 41 | } | ||
| 42 | else if (state->status.layer & 0x4) { | ||
| 43 | //RED | ||
| 44 | state->target_lcd_color = LCD_COLOR(0, 255, 95); | ||
| 45 | if (state->status.layer & 0x2){ | ||
| 46 | state->layer_text = "Qwerty - Fn"; | ||
| 47 | }else{ | ||
| 48 | state->layer_text = "Colemak - Fn"; | ||
| 49 | } | ||
| 50 | } | ||
| 51 | else if (state->status.layer & 0x2) { | ||
| 52 | //BLUE | ||
| 53 | state->target_lcd_color = LCD_COLOR(149, 255, 192); | ||
| 54 | state->layer_text = "Qwerty"; | ||
| 55 | } | ||
| 56 | else { | ||
| 57 | //PURPLE | ||
| 58 | state->target_lcd_color = LCD_COLOR(200, 255, 192); | ||
| 59 | state->layer_text = "Colemak"; | ||
| 60 | } | ||
| 61 | } | ||
| 62 | |||
diff --git a/layouts/community/ergodox/drashna/visualizer.c_old b/layouts/community/ergodox/drashna/visualizer.c_old deleted file mode 100644 index 6b1c3ff49..000000000 --- a/layouts/community/ergodox/drashna/visualizer.c_old +++ /dev/null | |||
| @@ -1,77 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2017 Fred Sundvik | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "./simple_visualizer.h" | ||
| 19 | #include "util.h" | ||
| 20 | #include "drashna.h" | ||
| 21 | #include "rgblight_list.h" | ||
| 22 | |||
| 23 | #define LCD_COLOR_wrapper(...) LCD_COLOR(__VA_ARGS__) | ||
| 24 | // This function should be implemented by the keymap visualizer | ||
| 25 | // Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing | ||
| 26 | // that the simple_visualizer assumes that you are updating | ||
| 27 | // Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is | ||
| 28 | // stopped. This can be done by either double buffering it or by using constant strings | ||
| 29 | static void get_visualizer_layer_and_color(visualizer_state_t* state) { | ||
| 30 | |||
| 31 | switch(get_highest_layer(state->status.layer|default_layer_state)) { | ||
| 32 | case _LOWER: | ||
| 33 | state->layer_text = "Lower"; | ||
| 34 | state->target_lcd_color = LCD_COLOR_wrapper(HSV_GREEN); | ||
| 35 | break; | ||
| 36 | case _RAISE: | ||
| 37 | state->layer_text = "Raise"; | ||
| 38 | state->target_lcd_color = LCD_COLOR_wrapper(HSV_YELLOW); | ||
| 39 | break; | ||
| 40 | case _ADJUST: | ||
| 41 | state->layer_text = "Adjust"; | ||
| 42 | state->target_lcd_color = LCD_COLOR_wrapper(HSV_RED); | ||
| 43 | break; | ||
| 44 | case _MACROS: | ||
| 45 | state->layer_text = "Macros"; | ||
| 46 | state->target_lcd_color = LCD_COLOR_wrapper(HSV_ORANGE); | ||
| 47 | break; | ||
| 48 | case _MEDIA: | ||
| 49 | state->layer_text = "Media"; | ||
| 50 | state->target_lcd_color = LCD_COLOR_wrapper(HSV_CHARTREUSE); | ||
| 51 | break; | ||
| 52 | case _GAMEPAD: | ||
| 53 | state->layer_text = "Game"; | ||
| 54 | state->target_lcd_color = LCD_COLOR_wrapper(HSV_ORANGE); | ||
| 55 | break; | ||
| 56 | case _QWERTY: | ||
| 57 | state->layer_text = "QWERTY"; | ||
| 58 | state->target_lcd_color = LCD_COLOR_wrapper(HSV_CYAN); | ||
| 59 | break; | ||
| 60 | case _WORKMAN: | ||
| 61 | state->layer_text = "Workman"; | ||
| 62 | state->target_lcd_color = LCD_COLOR_wrapper(HSV_GOLDENROD); | ||
| 63 | break; | ||
| 64 | case _DVORAK: | ||
| 65 | state->layer_text = "Dvorak"; | ||
| 66 | state->target_lcd_color = LCD_COLOR_wrapper(HSV_SPRINGGREEN); | ||
| 67 | break; | ||
| 68 | case _COLEMAK: | ||
| 69 | state->layer_text = "Colemak"; | ||
| 70 | state->target_lcd_color = LCD_COLOR_wrapper(HSV_MAGENTA); | ||
| 71 | break; break; | ||
| 72 | default: | ||
| 73 | state->layer_text = "NONE"; | ||
| 74 | state->target_lcd_color = LCD_COLOR_wrapper(HSV_RED); | ||
| 75 | break; | ||
| 76 | } | ||
| 77 | } | ||
diff --git a/layouts/community/ergodox/osx_neo2/visualizer.c b/layouts/community/ergodox/osx_neo2/visualizer.c deleted file mode 100644 index 653201bb8..000000000 --- a/layouts/community/ergodox/osx_neo2/visualizer.c +++ /dev/null | |||
| @@ -1,47 +0,0 @@ | |||
| 1 | #include "layers.h" | ||
| 2 | #include "simple_visualizer.h" | ||
| 3 | #include "util.h" | ||
| 4 | |||
| 5 | static void get_visualizer_layer_and_color(visualizer_state_t *state) { | ||
| 6 | uint8_t layer = biton32(state->status.layer); | ||
| 7 | |||
| 8 | // Go from highest to lowest layer to get the right text/color combination. | ||
| 9 | switch (layer) { | ||
| 10 | // #AEB2F4 / hsv(65.71%, 28.69%, 95.69%) | ||
| 11 | case FKEYS: | ||
| 12 | // #F4AEDC / hsv(89.05%, 28.69%, 95.69%) | ||
| 13 | state->layer_text = "FUNCTION KEYS"; | ||
| 14 | state->target_lcd_color = LCD_COLOR(228, 73, 245); | ||
| 15 | break; | ||
| 16 | case US_1: | ||
| 17 | // #F4B993 / hsv(6.53%, 39.75%, 95.69%) | ||
| 18 | state->layer_text = "QWERTY"; | ||
| 19 | state->target_lcd_color = LCD_COLOR(17, 102, 245); | ||
| 20 | break; | ||
| 21 | case NEO_6: | ||
| 22 | // #F4E393 / hsv(13.75%, 39.75%, 95.69%) | ||
| 23 | state->layer_text = "NEO: 6"; | ||
| 24 | state->target_lcd_color = LCD_COLOR(35, 102, 245); | ||
| 25 | break; | ||
| 26 | case NEO_5: | ||
| 27 | // #C6F493 / hsv(24.57%, 39.75%, 95.69%) | ||
| 28 | state->layer_text = "NEO: 5"; | ||
| 29 | state->target_lcd_color = LCD_COLOR(63, 102, 245); | ||
| 30 | break; | ||
| 31 | case NEO_4: | ||
| 32 | // #8EEBC9 / hsv(43.91%, 39.57%, 92.16%) | ||
| 33 | state->layer_text = "NEO: 4"; | ||
| 34 | state->target_lcd_color = LCD_COLOR(112, 101, 189); | ||
| 35 | break; | ||
| 36 | case NEO_3: | ||
| 37 | // #93D2F4 / hsv(55.84%, 39.75%, 95.69%) | ||
| 38 | state->layer_text = "NEO: 3"; | ||
| 39 | state->target_lcd_color = LCD_COLOR(143, 102, 245); | ||
| 40 | break; | ||
| 41 | default: | ||
| 42 | // #EEEEEE / hsv(0%, 0%, 93%) | ||
| 43 | state->layer_text = "NEO: 1"; | ||
| 44 | state->target_lcd_color = LCD_COLOR(0, 0, 255); | ||
| 45 | break; | ||
| 46 | } | ||
| 47 | } | ||
diff --git a/show_options.mk b/show_options.mk index e0d7c9b07..c1da90bcb 100644 --- a/show_options.mk +++ b/show_options.mk | |||
| @@ -28,7 +28,6 @@ HARDWARE_OPTION_NAMES = \ | |||
| 28 | AUDIO_ENABLE \ | 28 | AUDIO_ENABLE \ |
| 29 | HD44780_ENABLE \ | 29 | HD44780_ENABLE \ |
| 30 | ENCODER_ENABLE \ | 30 | ENCODER_ENABLE \ |
| 31 | LCD_ENABLE \ | ||
| 32 | LED_TABLES \ | 31 | LED_TABLES \ |
| 33 | POINTING_DEVICE_ENABLE \ | 32 | POINTING_DEVICE_ENABLE \ |
| 34 | DIP_SWITCH_ENABLE | 33 | DIP_SWITCH_ENABLE |
diff --git a/users/talljoe/visualizer.c b/users/talljoe/visualizer.c deleted file mode 100644 index c17b56706..000000000 --- a/users/talljoe/visualizer.c +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | /* Copyright 2020 Joseph Wasson | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "talljoe.h" | ||
| 18 | |||
| 19 | static void get_visualizer_layer_and_color(visualizer_state_t* state) { | ||
| 20 | state->status_text = layer_names[biton32(state->status.layer)]; | ||
| 21 | } | ||
