From 1816006121de991581d50d0bc6b5a653e2b3ccd2 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Wed, 20 Oct 2021 21:27:46 +0100 Subject: 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 --- layouts/community/ergodox/333fred/keymap.c | 40 +++++++++++ layouts/community/ergodox/333fred/rules.mk | 3 - layouts/community/ergodox/333fred/visualizer.c | 39 ----------- layouts/community/ergodox/adnw_p_u_q/visualizer.c | 34 ---------- layouts/community/ergodox/belak/keymap.c | 35 +++++----- layouts/community/ergodox/belak/visualizer.c | 49 -------------- layouts/community/ergodox/choromanski/visualizer.c | 62 ----------------- layouts/community/ergodox/drashna/visualizer.c_old | 77 ---------------------- layouts/community/ergodox/osx_neo2/visualizer.c | 47 ------------- 9 files changed, 55 insertions(+), 331 deletions(-) delete mode 100644 layouts/community/ergodox/333fred/visualizer.c delete mode 100644 layouts/community/ergodox/adnw_p_u_q/visualizer.c delete mode 100644 layouts/community/ergodox/belak/visualizer.c delete mode 100644 layouts/community/ergodox/choromanski/visualizer.c delete mode 100644 layouts/community/ergodox/drashna/visualizer.c_old delete mode 100644 layouts/community/ergodox/osx_neo2/visualizer.c (limited to 'layouts/community/ergodox') diff --git a/layouts/community/ergodox/333fred/keymap.c b/layouts/community/ergodox/333fred/keymap.c index b9aefd9293..5dee9a1e3f 100644 --- a/layouts/community/ergodox/333fred/keymap.c +++ b/layouts/community/ergodox/333fred/keymap.c @@ -272,3 +272,43 @@ void matrix_scan_user(void) { ergodox_led_all_on(); } +#ifdef ST7565_ENABLE + +void st7565_task_user(void) { + // The colors will need to be ported over to the quantum painter API when + // https://github.com/qmk/qmk_firmware/pull/10174 is merged. + + st7565_clear(); + switch (get_highest_layer(layer_state)) { + case BASE: + //state->target_lcd_color = LCD_COLOR(84, saturation, 0xFF); + st7565_write_P(PSTR("Default\n"), false); + break; + case CODEFLOW: + //state->target_lcd_color = LCD_COLOR(216, 90, 0xFF); + st7565_write_P(PSTR("Code\n"), false); + break; + case SYMB: + //state->target_lcd_color = LCD_COLOR(168, saturation, 0xFF); + st7565_write_P(PSTR("Symbol\n"), false); + break; + case MDIA: + //state->target_lcd_color = LCD_COLOR(0, saturation, 0xFF); + st7565_write_P(PSTR("Media\n"), false); + break; + case VIM: + //state->target_lcd_color = LCD_COLOR(140, 100, 60); + st7565_write_P(PSTR("Movement\n"), false); + break; + case GAME: + //state->target_lcd_color = LCD_COLOR(0, 255, 60); + st7565_write_P(PSTR("Game\n"), false); + break; + case GAME_ARROW: + //state->target_lcd_color = LCD_COLOR(0, 255, 60); + st7565_write_P(PSTR("Game Arrow\n"), false); + break; + } +} + +#endif diff --git a/layouts/community/ergodox/333fred/rules.mk b/layouts/community/ergodox/333fred/rules.mk index f6c71feb46..9a3e2b97e5 100644 --- a/layouts/community/ergodox/333fred/rules.mk +++ b/layouts/community/ergodox/333fred/rules.mk @@ -1,5 +1,2 @@ -LCD_BACKLIGHT_ENABLE = yes -LCD_ENABLE = yes -BACKLIGHT_ENABLE = yes KEY_LOCK_ENABLE = yes CONSOLE_ENABLE = no diff --git a/layouts/community/ergodox/333fred/visualizer.c b/layouts/community/ergodox/333fred/visualizer.c deleted file mode 100644 index d13b3cd794..0000000000 --- a/layouts/community/ergodox/333fred/visualizer.c +++ /dev/null @@ -1,39 +0,0 @@ -/* -Note: this is a modified copy of ../default/visualizer.c, originally licensed GPL. -*/ - -#include "simple_visualizer.h" - -// This function should be implemented by the keymap visualizer -// Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing -// that the simple_visualizer assumes that you are updating -// Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is -// stopped. This can be done by either double buffering it or by using constant strings -static void get_visualizer_layer_and_color(visualizer_state_t* state) { - uint8_t saturation = 60; - if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) { - saturation = 255; - } - if (state->status.layer & 0x80) { - state->target_lcd_color = LCD_COLOR(0, 255, 60); - state->layer_text = "Game Arrow"; - } else if (state->status.layer & 0x40) { - state->target_lcd_color = LCD_COLOR(0, 255, 60); - state->layer_text = "Game"; - } else if (state->status.layer & 0x20) { - state->target_lcd_color = LCD_COLOR(140, 100, 60); - state->layer_text = "Movement"; - } else if (state->status.layer & 0x10) { - state->target_lcd_color = LCD_COLOR(0, saturation, 0xFF); - state->layer_text = "Media"; - } else if (state->status.layer & 0x8) { - state->target_lcd_color = LCD_COLOR(168, saturation, 0xFF); - state->layer_text = "Symbol"; - } else if (state->status.layer & 0x2 || state->status.layer & 0x4) { - state->target_lcd_color = LCD_COLOR(216, 90, 0xFF); - state->layer_text = "Code"; - } else { - state->target_lcd_color = LCD_COLOR(84, saturation, 0xFF); - state->layer_text = "Default"; - } -} 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 9a4d485387..0000000000 --- a/layouts/community/ergodox/adnw_p_u_q/visualizer.c +++ /dev/null @@ -1,34 +0,0 @@ -/* -Note: this is a modified copy of ../default/visualizer.c, originally licensed GPL. -*/ - -#include "simple_visualizer.h" - -// This function should be implemented by the keymap visualizer -// Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing -// that the simple_visualizer assumes that you are updating -// Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is -// stopped. This can be done by either double buffering it or by using constant strings -static void get_visualizer_layer_and_color(visualizer_state_t* state) { - - if (state->status.layer & 0x20) { - state->target_lcd_color = LCD_COLOR(127, 0xFF, 0xFF); - state->layer_text = "Mouse"; - } else if (state->status.layer & 0x10) { - state->target_lcd_color = LCD_COLOR(85, 0xFF, 0xFF); - state->layer_text = "Symbol"; - } else if (state->status.layer & 0x8) { - state->target_lcd_color = LCD_COLOR(64, 0xFF, 0xFF); - state->layer_text = "Brackets"; - } else if (state->status.layer & 0x4) { - state->target_lcd_color = LCD_COLOR(42, 0xFF, 0xFF); - state->layer_text = "Diak"; - } else if (state->status.layer & 0x2) { - state->target_lcd_color = LCD_COLOR(21, 0xFF, 0xFF); - state->layer_text = "Terminal"; - } else { - state->target_lcd_color = LCD_COLOR(192, 0xFF, 0xFF); - state->layer_text = "Vim"; - } -} - diff --git a/layouts/community/ergodox/belak/keymap.c b/layouts/community/ergodox/belak/keymap.c index bca0dec913..de0fe1b1ae 100644 --- a/layouts/community/ergodox/belak/keymap.c +++ b/layouts/community/ergodox/belak/keymap.c @@ -33,11 +33,6 @@ enum belak_keycodes { E_TSET, }; -inline void tap(uint16_t keycode) { - register_code(keycode); - unregister_code(keycode); -}; - // TODO: Add LED support to the tap dance by using the advanced macro #define LTOGGLE TD(TD_LAYER_TOGGLE) @@ -273,17 +268,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case E_SHRUG: // ¯\_(ツ)_/¯ if (record->event.pressed) { process_unicode((0x00AF|QK_UNICODE), record); // Hand - tap(KC_BSLS); // Arm + tap_code16(KC_BSLS); // Arm register_code(KC_RSFT); - tap(KC_UNDS); // Arm - tap(KC_LPRN); // Head + tap_code16(KC_UNDS); // Arm + tap_code16(KC_LPRN); // Head unregister_code(KC_RSFT); process_unicode((0x30C4|QK_UNICODE), record); // Face register_code(KC_RSFT); - tap(KC_RPRN); // Head - tap(KC_UNDS); // Arm + tap_code16(KC_RPRN); // Head + tap_code16(KC_UNDS); // Arm unregister_code(KC_RSFT); - tap(KC_SLSH); // Arm + tap_code16(KC_SLSH); // Arm process_unicode((0x00AF|QK_UNICODE), record); // Hand } return false; @@ -291,19 +286,19 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case E_TFLIP: // (╯°□°)╯ ︵ ┻━┻ if (record->event.pressed) { register_code(KC_RSFT); - tap(KC_9); + tap_code16(KC_9); unregister_code(KC_RSFT); process_unicode((0x256F|QK_UNICODE), record); // Arm process_unicode((0x00B0|QK_UNICODE), record); // Eye process_unicode((0x25A1|QK_UNICODE), record); // Mouth process_unicode((0x00B0|QK_UNICODE), record); // Eye register_code(KC_RSFT); - tap(KC_0); + tap_code16(KC_0); unregister_code(KC_RSFT); process_unicode((0x256F|QK_UNICODE), record); // Arm - tap(KC_SPC); + tap_code16(KC_SPC); process_unicode((0x0361|QK_UNICODE), record); // Flippy - tap(KC_SPC); + tap_code16(KC_SPC); process_unicode((0x253B|QK_UNICODE), record); // Table process_unicode((0x2501|QK_UNICODE), record); // Table process_unicode((0x253B|QK_UNICODE), record); // Table @@ -316,18 +311,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { process_unicode((0x2500|QK_UNICODE), record); // Table process_unicode((0x2500|QK_UNICODE), record); // Table process_unicode((0x252C|QK_UNICODE), record); // Table - tap(KC_SPC); + tap_code16(KC_SPC); process_unicode((0x30CE|QK_UNICODE), record); // Arm register_code(KC_RSFT); - tap(KC_9); + tap_code16(KC_9); unregister_code(KC_RSFT); - tap(KC_SPC); + tap_code16(KC_SPC); process_unicode((0x309C|QK_UNICODE), record); // Eye - tap(KC_MINS); + tap_code16(KC_MINS); process_unicode((0x309C|QK_UNICODE), record); // Eye process_unicode((0x30CE|QK_UNICODE), record); // Arm register_code(KC_RSFT); - tap(KC_0); + tap_code16(KC_0); unregister_code(KC_RSFT); } return false; diff --git a/layouts/community/ergodox/belak/visualizer.c b/layouts/community/ergodox/belak/visualizer.c deleted file mode 100644 index b92890a668..0000000000 --- a/layouts/community/ergodox/belak/visualizer.c +++ /dev/null @@ -1,49 +0,0 @@ -/* -Copyright 2017 Fred Sundvik - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -// Currently we are assuming that both the backlight and LCD are enabled -// But it's entirely possible to write a custom visualizer that use only -// one of them -#ifndef LCD_BACKLIGHT_ENABLE -#error This visualizer needs that LCD backlight is enabled -#endif - -#ifndef LCD_ENABLE -#error This visualizer needs that LCD is enabled -#endif - -#include "simple_visualizer.h" - -static void get_visualizer_layer_and_color(visualizer_state_t* state) { - uint8_t saturation = 60; - if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) { - saturation = 255; - } - - if (state->status.layer & 0x4) { - state->target_lcd_color = LCD_COLOR(0, saturation, 0xFF); - state->layer_text = "Media"; - } - else if (state->status.layer & 0x2) { - state->target_lcd_color = LCD_COLOR(168, saturation, 0xFF); - state->layer_text = "Symbols"; - } - else { - state->target_lcd_color = LCD_COLOR(84, saturation, 0xFF); - state->layer_text = "Base"; - } -} diff --git a/layouts/community/ergodox/choromanski/visualizer.c b/layouts/community/ergodox/choromanski/visualizer.c deleted file mode 100644 index e207c66822..0000000000 --- a/layouts/community/ergodox/choromanski/visualizer.c +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2017 Fred Sundvik - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "simple_visualizer.h" - -// This function should be implemented by the keymap visualizer -// Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing -// that the simple_visualizer assumes that you are updating -// Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is -// stopped. This can be done by either double buffering it or by using constant strings -static void get_visualizer_layer_and_color(visualizer_state_t* state) { - - if (state->status.layer & 0x20) { - //GREEN - state->target_lcd_color = LCD_COLOR(85, 255, 128); - state->layer_text = "Gaming"; - } - else if (state->status.layer & 0x10) { - //ORANGE - state->target_lcd_color = LCD_COLOR(28, 255, 230); - state->layer_text = "Numpad & Mouse"; - } - else if (state->status.layer & 0x8) { - //YELLOW - state->target_lcd_color = LCD_COLOR(38, 255, 230); - state->layer_text = "Symbols"; - } - else if (state->status.layer & 0x4) { - //RED - state->target_lcd_color = LCD_COLOR(0, 255, 95); - if (state->status.layer & 0x2){ - state->layer_text = "Qwerty - Fn"; - }else{ - state->layer_text = "Colemak - Fn"; - } - } - else if (state->status.layer & 0x2) { - //BLUE - state->target_lcd_color = LCD_COLOR(149, 255, 192); - state->layer_text = "Qwerty"; - } - else { - //PURPLE - state->target_lcd_color = LCD_COLOR(200, 255, 192); - state->layer_text = "Colemak"; - } -} - diff --git a/layouts/community/ergodox/drashna/visualizer.c_old b/layouts/community/ergodox/drashna/visualizer.c_old deleted file mode 100644 index 6b1c3ff498..0000000000 --- a/layouts/community/ergodox/drashna/visualizer.c_old +++ /dev/null @@ -1,77 +0,0 @@ -/* -Copyright 2017 Fred Sundvik - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "./simple_visualizer.h" -#include "util.h" -#include "drashna.h" -#include "rgblight_list.h" - -#define LCD_COLOR_wrapper(...) LCD_COLOR(__VA_ARGS__) -// This function should be implemented by the keymap visualizer -// Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing -// that the simple_visualizer assumes that you are updating -// Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is -// stopped. This can be done by either double buffering it or by using constant strings -static void get_visualizer_layer_and_color(visualizer_state_t* state) { - - switch(get_highest_layer(state->status.layer|default_layer_state)) { - case _LOWER: - state->layer_text = "Lower"; - state->target_lcd_color = LCD_COLOR_wrapper(HSV_GREEN); - break; - case _RAISE: - state->layer_text = "Raise"; - state->target_lcd_color = LCD_COLOR_wrapper(HSV_YELLOW); - break; - case _ADJUST: - state->layer_text = "Adjust"; - state->target_lcd_color = LCD_COLOR_wrapper(HSV_RED); - break; - case _MACROS: - state->layer_text = "Macros"; - state->target_lcd_color = LCD_COLOR_wrapper(HSV_ORANGE); - break; - case _MEDIA: - state->layer_text = "Media"; - state->target_lcd_color = LCD_COLOR_wrapper(HSV_CHARTREUSE); - break; - case _GAMEPAD: - state->layer_text = "Game"; - state->target_lcd_color = LCD_COLOR_wrapper(HSV_ORANGE); - break; - case _QWERTY: - state->layer_text = "QWERTY"; - state->target_lcd_color = LCD_COLOR_wrapper(HSV_CYAN); - break; - case _WORKMAN: - state->layer_text = "Workman"; - state->target_lcd_color = LCD_COLOR_wrapper(HSV_GOLDENROD); - break; - case _DVORAK: - state->layer_text = "Dvorak"; - state->target_lcd_color = LCD_COLOR_wrapper(HSV_SPRINGGREEN); - break; - case _COLEMAK: - state->layer_text = "Colemak"; - state->target_lcd_color = LCD_COLOR_wrapper(HSV_MAGENTA); - break; break; - default: - state->layer_text = "NONE"; - state->target_lcd_color = LCD_COLOR_wrapper(HSV_RED); - break; - } -} diff --git a/layouts/community/ergodox/osx_neo2/visualizer.c b/layouts/community/ergodox/osx_neo2/visualizer.c deleted file mode 100644 index 653201bb8a..0000000000 --- a/layouts/community/ergodox/osx_neo2/visualizer.c +++ /dev/null @@ -1,47 +0,0 @@ -#include "layers.h" -#include "simple_visualizer.h" -#include "util.h" - -static void get_visualizer_layer_and_color(visualizer_state_t *state) { - uint8_t layer = biton32(state->status.layer); - - // Go from highest to lowest layer to get the right text/color combination. - switch (layer) { - // #AEB2F4 / hsv(65.71%, 28.69%, 95.69%) - case FKEYS: - // #F4AEDC / hsv(89.05%, 28.69%, 95.69%) - state->layer_text = "FUNCTION KEYS"; - state->target_lcd_color = LCD_COLOR(228, 73, 245); - break; - case US_1: - // #F4B993 / hsv(6.53%, 39.75%, 95.69%) - state->layer_text = "QWERTY"; - state->target_lcd_color = LCD_COLOR(17, 102, 245); - break; - case NEO_6: - // #F4E393 / hsv(13.75%, 39.75%, 95.69%) - state->layer_text = "NEO: 6"; - state->target_lcd_color = LCD_COLOR(35, 102, 245); - break; - case NEO_5: - // #C6F493 / hsv(24.57%, 39.75%, 95.69%) - state->layer_text = "NEO: 5"; - state->target_lcd_color = LCD_COLOR(63, 102, 245); - break; - case NEO_4: - // #8EEBC9 / hsv(43.91%, 39.57%, 92.16%) - state->layer_text = "NEO: 4"; - state->target_lcd_color = LCD_COLOR(112, 101, 189); - break; - case NEO_3: - // #93D2F4 / hsv(55.84%, 39.75%, 95.69%) - state->layer_text = "NEO: 3"; - state->target_lcd_color = LCD_COLOR(143, 102, 245); - break; - default: - // #EEEEEE / hsv(0%, 0%, 93%) - state->layer_text = "NEO: 1"; - state->target_lcd_color = LCD_COLOR(0, 0, 255); - break; - } -} -- cgit v1.2.3