diff options
| author | Nick Brassel <nick@tzarc.org> | 2021-10-07 10:57:48 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-07 10:57:48 +1100 |
| commit | b2a186cf92d91bbb7f98fff68c4edf571909bf89 (patch) | |
| tree | c58eca68f1ca0797b8080c32be3d14b10abd286a /keyboards | |
| parent | bc1f5ef38172bc77a802fb779e5da60f800c231b (diff) | |
| download | qmk_firmware-b2a186cf92d91bbb7f98fff68c4edf571909bf89.tar.gz qmk_firmware-b2a186cf92d91bbb7f98fff68c4edf571909bf89.zip | |
Purge uGFX. (#14720)
* Purge uGFX.
* Remove remnants of visualizer.
* Remove remnants of uGFX.
Diffstat (limited to 'keyboards')
| -rw-r--r-- | keyboards/ergodox_infinity/board_is31fl3731c.h | 110 | ||||
| -rw-r--r-- | keyboards/ergodox_infinity/board_st7565.h | 96 | ||||
| -rw-r--r-- | keyboards/ergodox_infinity/config.h | 2 | ||||
| -rw-r--r-- | keyboards/ergodox_infinity/ergodox_infinity.c | 11 | ||||
| -rw-r--r-- | keyboards/ergodox_infinity/ergodox_infinity.h | 2 | ||||
| -rw-r--r-- | keyboards/ergodox_infinity/gfxconf.h | 27 | ||||
| -rw-r--r-- | keyboards/ergodox_infinity/rules.mk | 7 | ||||
| -rw-r--r-- | keyboards/ergodox_infinity/simple_visualizer.h | 123 | ||||
| -rw-r--r-- | keyboards/ergodox_infinity/visualizer.c | 328 | ||||
| -rw-r--r-- | keyboards/whitefox/gfxconf.h | 27 | ||||
| -rw-r--r-- | keyboards/whitefox/visualizer.c | 54 |
11 files changed, 1 insertions, 786 deletions
diff --git a/keyboards/ergodox_infinity/board_is31fl3731c.h b/keyboards/ergodox_infinity/board_is31fl3731c.h deleted file mode 100644 index b2ed2b003..000000000 --- a/keyboards/ergodox_infinity/board_is31fl3731c.h +++ /dev/null | |||
| @@ -1,110 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2016 Fred Sundvik <fsundvik@gmail.com> | ||
| 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 | #ifndef _GDISP_LLD_BOARD_H | ||
| 19 | #define _GDISP_LLD_BOARD_H | ||
| 20 | |||
| 21 | static const I2CConfig i2ccfg = { | ||
| 22 | 400000 // clock speed (Hz); 400kHz max for IS31 | ||
| 23 | }; | ||
| 24 | |||
| 25 | static const uint8_t led_mask[] = { | ||
| 26 | 0xFF, 0x00, /* C1-1 -> C1-16 */ | ||
| 27 | 0xFF, 0x00, /* C2-1 -> C2-16 */ | ||
| 28 | 0xFF, 0x00, /* C3-1 -> C3-16 */ | ||
| 29 | 0xFF, 0x00, /* C4-1 -> C4-16 */ | ||
| 30 | 0x3F, 0x00, /* C5-1 -> C5-16 */ | ||
| 31 | 0x00, 0x00, /* C6-1 -> C6-16 */ | ||
| 32 | 0x00, 0x00, /* C7-1 -> C7-16 */ | ||
| 33 | 0x00, 0x00, /* C8-1 -> C8-16 */ | ||
| 34 | 0x00, 0x00, /* C9-1 -> C9-16 */ | ||
| 35 | }; | ||
| 36 | |||
| 37 | // The address of the LED | ||
| 38 | #define LA(c, r) (c + r * 16 ) | ||
| 39 | // Need to be an address that is not mapped, but inside the range of the controller matrix | ||
| 40 | #define NA LA(8, 8) | ||
| 41 | |||
| 42 | // The numbers in the comments are the led numbers DXX on the PCB | ||
| 43 | // The mapping is taken from the schematic of left hand side | ||
| 44 | static const uint8_t led_mapping[GDISP_SCREEN_HEIGHT][GDISP_SCREEN_WIDTH] = { | ||
| 45 | // 45 44 43 42 41 40 39 | ||
| 46 | { LA(1, 1), LA(1, 0), LA(0, 4), LA(0, 3), LA(0, 2), LA(0, 1), LA(0, 0)}, | ||
| 47 | // 52 51 50 49 48 47 46 | ||
| 48 | { LA(2, 3), LA(2, 2), LA(2, 1), LA(2, 0), LA(1, 4), LA(1, 3), LA(1, 2) }, | ||
| 49 | // 58 57 56 55 54 53 N/A | ||
| 50 | { LA(3, 4), LA(3, 3), LA(3, 2), LA(3, 1), LA(3, 0), LA(2, 4), NA }, | ||
| 51 | // 67 66 65 64 63 62 61 | ||
| 52 | { LA(5, 3), LA(5, 2), LA(5, 1), LA(5, 0), LA(4, 4), LA(4, 3), LA(4, 2) }, | ||
| 53 | // 76 75 74 73 72 60 59 | ||
| 54 | { LA(7, 3), LA(7, 2), LA(7, 1), LA(7, 0), LA(6, 3), LA(4, 1), LA(4, 0) }, | ||
| 55 | // N/A N/A N/A N/A N/A N/A 68 | ||
| 56 | { NA, NA, NA, NA, NA, NA, LA(5, 4) }, | ||
| 57 | // N/A N/A N/A N/A 71 70 69 | ||
| 58 | { NA, NA, NA, NA, LA(6, 2), LA(6, 1), LA(6, 0) }, | ||
| 59 | }; | ||
| 60 | |||
| 61 | |||
| 62 | #define IS31_ADDR_DEFAULT 0x74 // AD connected to GND | ||
| 63 | #define IS31_TIMEOUT 5000 | ||
| 64 | |||
| 65 | static GFXINLINE void init_board(GDisplay *g) { | ||
| 66 | (void) g; | ||
| 67 | /* I2C pins */ | ||
| 68 | palSetPadMode(GPIOB, 0, PAL_MODE_ALTERNATIVE_2); // PTB0/I2C0/SCL | ||
| 69 | palSetPadMode(GPIOB, 1, PAL_MODE_ALTERNATIVE_2); // PTB1/I2C0/SDA | ||
| 70 | palSetPadMode(GPIOB, 16, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 71 | palClearPad(GPIOB, 16); | ||
| 72 | /* start I2C */ | ||
| 73 | i2cStart(&I2CD1, &i2ccfg); | ||
| 74 | // try high drive (from kiibohd) | ||
| 75 | I2CD1.i2c->C2 |= I2Cx_C2_HDRS; | ||
| 76 | // try glitch fixing (from kiibohd) | ||
| 77 | I2CD1.i2c->FLT = 4; | ||
| 78 | } | ||
| 79 | |||
| 80 | static GFXINLINE void post_init_board(GDisplay *g) { | ||
| 81 | (void) g; | ||
| 82 | } | ||
| 83 | |||
| 84 | static GFXINLINE const uint8_t* get_led_mask(GDisplay* g) { | ||
| 85 | (void) g; | ||
| 86 | return led_mask; | ||
| 87 | } | ||
| 88 | |||
| 89 | static GFXINLINE uint8_t get_led_address(GDisplay* g, uint16_t x, uint16_t y) | ||
| 90 | { | ||
| 91 | (void) g; | ||
| 92 | return led_mapping[y][x]; | ||
| 93 | } | ||
| 94 | |||
| 95 | static GFXINLINE void set_hardware_shutdown(GDisplay* g, bool shutdown) { | ||
| 96 | (void) g; | ||
| 97 | if(!shutdown) { | ||
| 98 | palSetPad(GPIOB, 16); | ||
| 99 | } | ||
| 100 | else { | ||
| 101 | palClearPad(GPIOB, 16); | ||
| 102 | } | ||
| 103 | } | ||
| 104 | |||
| 105 | static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) { | ||
| 106 | (void) g; | ||
| 107 | i2cMasterTransmitTimeout(&I2CD1, IS31_ADDR_DEFAULT, data, length, 0, 0, TIME_US2I(IS31_TIMEOUT)); | ||
| 108 | } | ||
| 109 | |||
| 110 | #endif /* _GDISP_LLD_BOARD_H */ | ||
diff --git a/keyboards/ergodox_infinity/board_st7565.h b/keyboards/ergodox_infinity/board_st7565.h deleted file mode 100644 index 875ed9e65..000000000 --- a/keyboards/ergodox_infinity/board_st7565.h +++ /dev/null | |||
| @@ -1,96 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * This file is subject to the terms of the GFX License. If a copy of | ||
| 3 | * the license was not distributed with this file, you can obtain one at: | ||
| 4 | * | ||
| 5 | * http://ugfx.org/license.html | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef _GDISP_LLD_BOARD_H | ||
| 9 | #define _GDISP_LLD_BOARD_H | ||
| 10 | |||
| 11 | #include "quantum.h" | ||
| 12 | |||
| 13 | #define ST7565_LCD_BIAS ST7565_LCD_BIAS_7 | ||
| 14 | #define ST7565_COM_SCAN ST7565_COM_SCAN_DEC | ||
| 15 | #define ST7565_PAGE_ORDER 0, 1, 2, 3 | ||
| 16 | /* | ||
| 17 | * Custom page order for several LCD boards, e.g. HEM12864-99 | ||
| 18 | * #define ST7565_PAGE_ORDER 4,5,6,7,0,1,2,3 | ||
| 19 | */ | ||
| 20 | |||
| 21 | #define ST7565_A0_PIN C7 | ||
| 22 | #define ST7565_RST_PIN C8 | ||
| 23 | #define ST7565_MOSI_PIN C6 | ||
| 24 | #define ST7565_SCLK_PIN C5 | ||
| 25 | #define ST7565_SS_PIN C4 | ||
| 26 | |||
| 27 | // DSPI Clock and Transfer Attributes | ||
| 28 | // Frame Size: 8 bits | ||
| 29 | // MSB First | ||
| 30 | // CLK Low by default | ||
| 31 | static const SPIConfig spi1config = { | ||
| 32 | // Operation complete callback or @p NULL. | ||
| 33 | .end_cb = NULL, | ||
| 34 | // The chip select line port - when not using pcs. | ||
| 35 | .ssport = PAL_PORT(ST7565_SS_PIN), | ||
| 36 | // brief The chip select line pad number - when not using pcs. | ||
| 37 | .sspad = PAL_PAD(ST7565_SS_PIN), | ||
| 38 | // SPI initialization data. | ||
| 39 | .tar0 = SPIx_CTARn_FMSZ(7) // Frame size = 8 bytes | ||
| 40 | | SPIx_CTARn_ASC(1) // After SCK Delay Scaler (min 50 ns) = 55.56ns | ||
| 41 | | SPIx_CTARn_DT(0) // Delay After Transfer Scaler (no minimum)= 27.78ns | ||
| 42 | | SPIx_CTARn_CSSCK(0) // PCS to SCK Delay Scaler (min 20 ns) = 27.78ns | ||
| 43 | | SPIx_CTARn_PBR(0) // Baud Rate Prescaler = 2 | ||
| 44 | | SPIx_CTARn_BR(0) // Baud rate (min 50ns) = 55.56ns | ||
| 45 | }; | ||
| 46 | |||
| 47 | static GFXINLINE void acquire_bus(GDisplay *g) { | ||
| 48 | (void)g; | ||
| 49 | // Only the LCD is using the SPI bus, so no need to acquire | ||
| 50 | // spiAcquireBus(&SPID1); | ||
| 51 | spiSelect(&SPID1); | ||
| 52 | } | ||
| 53 | |||
| 54 | static GFXINLINE void release_bus(GDisplay *g) { | ||
| 55 | (void)g; | ||
| 56 | // Only the LCD is using the SPI bus, so no need to release | ||
| 57 | // spiReleaseBus(&SPID1); | ||
| 58 | spiUnselect(&SPID1); | ||
| 59 | } | ||
| 60 | |||
| 61 | static GFXINLINE void init_board(GDisplay *g) { | ||
| 62 | (void)g; | ||
| 63 | setPinOutput(ST7565_A0_PIN); | ||
| 64 | writePinHigh(ST7565_A0_PIN); | ||
| 65 | setPinOutput(ST7565_RST_PIN); | ||
| 66 | writePinHigh(ST7565_RST_PIN); | ||
| 67 | setPinOutput(ST7565_SS_PIN); | ||
| 68 | |||
| 69 | palSetPadMode(PAL_PORT(ST7565_MOSI_PIN), PAL_PAD(ST7565_MOSI_PIN), PAL_MODE_ALTERNATIVE_2); | ||
| 70 | palSetPadMode(PAL_PORT(ST7565_SCLK_PIN), PAL_PAD(ST7565_SCLK_PIN), PAL_MODE_ALTERNATIVE_2); | ||
| 71 | |||
| 72 | spiInit(); | ||
| 73 | spiStart(&SPID1, &spi1config); | ||
| 74 | release_bus(g); | ||
| 75 | } | ||
| 76 | |||
| 77 | static GFXINLINE void post_init_board(GDisplay *g) { (void)g; } | ||
| 78 | |||
| 79 | static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { | ||
| 80 | (void)g; | ||
| 81 | writePin(ST7565_RST_PIN, !state); | ||
| 82 | } | ||
| 83 | |||
| 84 | static GFXINLINE void write_cmd(GDisplay *g, gU8 cmd) { | ||
| 85 | (void)g; | ||
| 86 | writePinLow(ST7565_A0_PIN); | ||
| 87 | spiSend(&SPID1, 1, &cmd); | ||
| 88 | } | ||
| 89 | |||
| 90 | static GFXINLINE void write_data(GDisplay *g, gU8 *data, gU16 length) { | ||
| 91 | (void)g; | ||
| 92 | writePinHigh(ST7565_A0_PIN); | ||
| 93 | spiSend(&SPID1, length, data); | ||
| 94 | } | ||
| 95 | |||
| 96 | #endif /* _GDISP_LLD_BOARD_H */ | ||
diff --git a/keyboards/ergodox_infinity/config.h b/keyboards/ergodox_infinity/config.h index 357ddf6c5..5dcc707a5 100644 --- a/keyboards/ergodox_infinity/config.h +++ b/keyboards/ergodox_infinity/config.h | |||
| @@ -112,8 +112,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 112 | /* Set 0 if debouncing isn't needed */ | 112 | /* Set 0 if debouncing isn't needed */ |
| 113 | #define DEBOUNCE 5 | 113 | #define DEBOUNCE 5 |
| 114 | 114 | ||
| 115 | #define VISUALIZER_USER_DATA_SIZE 16 | ||
| 116 | |||
| 117 | /* | 115 | /* |
| 118 | * Feature disable options | 116 | * Feature disable options |
| 119 | * These options are also useful to firmware size reduction. | 117 | * These options are also useful to firmware size reduction. |
diff --git a/keyboards/ergodox_infinity/ergodox_infinity.c b/keyboards/ergodox_infinity/ergodox_infinity.c index 8f5b068a7..d2a311ee8 100644 --- a/keyboards/ergodox_infinity/ergodox_infinity.c +++ b/keyboards/ergodox_infinity/ergodox_infinity.c | |||
| @@ -4,9 +4,6 @@ | |||
| 4 | #include <string.h> | 4 | #include <string.h> |
| 5 | #include "eeconfig.h" | 5 | #include "eeconfig.h" |
| 6 | #include "serial_link/system/serial_link.h" | 6 | #include "serial_link/system/serial_link.h" |
| 7 | #ifdef VISUALIZER_ENABLE | ||
| 8 | # include "lcd_backlight.h" | ||
| 9 | #endif | ||
| 10 | 7 | ||
| 11 | #define RED_PIN 1 | 8 | #define RED_PIN 1 |
| 12 | #define GREEN_PIN 2 | 9 | #define GREEN_PIN 2 |
| @@ -87,11 +84,7 @@ static uint16_t cie_lightness(uint16_t v) { | |||
| 87 | return y * 65535.0f; | 84 | return y * 65535.0f; |
| 88 | } | 85 | } |
| 89 | 86 | ||
| 90 | #ifdef VISUALIZER_ENABLE | ||
| 91 | void lcd_backlight_hal_color(uint16_t r, uint16_t g, uint16_t b) { | ||
| 92 | #else | ||
| 93 | void ergodox_infinity_lcd_color(uint16_t r, uint16_t g, uint16_t b) { | 87 | void ergodox_infinity_lcd_color(uint16_t r, uint16_t g, uint16_t b) { |
| 94 | #endif | ||
| 95 | CHANNEL_RED.CnV = cie_lightness(r); | 88 | CHANNEL_RED.CnV = cie_lightness(r); |
| 96 | CHANNEL_GREEN.CnV = cie_lightness(g); | 89 | CHANNEL_GREEN.CnV = cie_lightness(g); |
| 97 | CHANNEL_BLUE.CnV = cie_lightness(b); | 90 | CHANNEL_BLUE.CnV = cie_lightness(b); |
| @@ -108,12 +101,10 @@ void keyboard_pre_init_kb() { | |||
| 108 | setPinOutput(B16); | 101 | setPinOutput(B16); |
| 109 | writePinHigh(B16); | 102 | writePinHigh(B16); |
| 110 | #endif | 103 | #endif |
| 111 | #ifndef VISUALIZER_ENABLE | ||
| 112 | // The backlight always has to be initialized, otherwise it will stay lit | 104 | // The backlight always has to be initialized, otherwise it will stay lit |
| 113 | lcd_backlight_hal_init(); | 105 | lcd_backlight_hal_init(); |
| 114 | # ifdef ST7565_ENABLE | 106 | #ifdef ST7565_ENABLE |
| 115 | ergodox_infinity_lcd_color(UINT16_MAX / 2, UINT16_MAX / 2, UINT16_MAX / 2); | 107 | ergodox_infinity_lcd_color(UINT16_MAX / 2, UINT16_MAX / 2, UINT16_MAX / 2); |
| 116 | # endif | ||
| 117 | #endif | 108 | #endif |
| 118 | keyboard_pre_init_user(); | 109 | keyboard_pre_init_user(); |
| 119 | } | 110 | } |
diff --git a/keyboards/ergodox_infinity/ergodox_infinity.h b/keyboards/ergodox_infinity/ergodox_infinity.h index 39a82e46d..b9636b69b 100644 --- a/keyboards/ergodox_infinity/ergodox_infinity.h +++ b/keyboards/ergodox_infinity/ergodox_infinity.h | |||
| @@ -79,9 +79,7 @@ inline void ergodox_led_all_set(uint8_t n) { | |||
| 79 | ergodox_right_led_3_set(n); | 79 | ergodox_right_led_3_set(n); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | #ifndef VISUALIZER_ENABLE | ||
| 83 | void ergodox_infinity_lcd_color(uint16_t r, uint16_t g, uint16_t b); | 82 | void ergodox_infinity_lcd_color(uint16_t r, uint16_t g, uint16_t b); |
| 84 | #endif | ||
| 85 | 83 | ||
| 86 | #define XXX KC_NO | 84 | #define XXX KC_NO |
| 87 | 85 | ||
diff --git a/keyboards/ergodox_infinity/gfxconf.h b/keyboards/ergodox_infinity/gfxconf.h deleted file mode 100644 index ca338399d..000000000 --- a/keyboards/ergodox_infinity/gfxconf.h +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | /** | ||
| 2 | * This file has a different license to the rest of the uGFX system. | ||
| 3 | * You can copy, modify and distribute this file as you see fit. | ||
| 4 | * You do not need to publish your source modifications to this file. | ||
| 5 | * The only thing you are not permitted to do is to relicense it | ||
| 6 | * under a different license. | ||
| 7 | */ | ||
| 8 | |||
| 9 | /** | ||
| 10 | * Copy this file into your project directory and rename it as gfxconf.h | ||
| 11 | * Edit your copy to turn on the uGFX features you want to use. | ||
| 12 | * The values below are the defaults. | ||
| 13 | * | ||
| 14 | * Only remove the comments from lines where you want to change the | ||
| 15 | * default value. This allows definitions to be included from | ||
| 16 | * driver makefiles when required and provides the best future | ||
| 17 | * compatibility for your project. | ||
| 18 | * | ||
| 19 | * Please use spaces instead of tabs in this file. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #ifndef _GFXCONF_H | ||
| 23 | #define _GFXCONF_H | ||
| 24 | |||
| 25 | #include "common_gfxconf.h" | ||
| 26 | |||
| 27 | #endif /* _GFXCONF_H */ | ||
diff --git a/keyboards/ergodox_infinity/rules.mk b/keyboards/ergodox_infinity/rules.mk index 06b62f547..b6922e1ee 100644 --- a/keyboards/ergodox_infinity/rules.mk +++ b/keyboards/ergodox_infinity/rules.mk | |||
| @@ -34,11 +34,4 @@ ST7565_ENABLE = yes | |||
| 34 | LED_MATRIX_ENABLE = yes | 34 | LED_MATRIX_ENABLE = yes |
| 35 | LED_MATRIX_DRIVER = IS31FL3731 | 35 | LED_MATRIX_DRIVER = IS31FL3731 |
| 36 | 36 | ||
| 37 | # Config for Visualizer (set VISUALIZER_ENABLE = yes and ST7565_ENABLE = no to use) | ||
| 38 | LCD_ENABLE = yes | ||
| 39 | LCD_BACKLIGHT_ENABLE = yes | ||
| 40 | LCD_DRIVER = st7565 | ||
| 41 | LCD_WIDTH = 128 | ||
| 42 | LCD_HEIGHT = 32 | ||
| 43 | |||
| 44 | LAYOUTS = ergodox | 37 | LAYOUTS = ergodox |
diff --git a/keyboards/ergodox_infinity/simple_visualizer.h b/keyboards/ergodox_infinity/simple_visualizer.h deleted file mode 100644 index 73d0e0887..000000000 --- a/keyboards/ergodox_infinity/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(200), gfxMillisecondsToTicks(500)}, | ||
| 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/visualizer.c b/keyboards/ergodox_infinity/visualizer.c deleted file mode 100644 index 1ea891e83..000000000 --- a/keyboards/ergodox_infinity/visualizer.c +++ /dev/null | |||
| @@ -1,328 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2016 Fred Sundvik <fsundvik@gmail.com> | ||
| 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 "visualizer.h" | ||
| 30 | #include "visualizer_keyframes.h" | ||
| 31 | #include "lcd_keyframes.h" | ||
| 32 | #include "lcd_backlight_keyframes.h" | ||
| 33 | #include "default_animations.h" | ||
| 34 | |||
| 35 | static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); | ||
| 36 | static const uint32_t initial_color = LCD_COLOR(0, 0, 0); | ||
| 37 | |||
| 38 | static const uint32_t led_emulation_colors[4] = { | ||
| 39 | LCD_COLOR(0, 0, 0), | ||
| 40 | LCD_COLOR(255, 255, 255), | ||
| 41 | LCD_COLOR(84, 255, 255), | ||
| 42 | LCD_COLOR(168, 255, 255), | ||
| 43 | }; | ||
| 44 | |||
| 45 | static uint32_t next_led_target_color = 0; | ||
| 46 | |||
| 47 | typedef enum { | ||
| 48 | LCD_STATE_INITIAL, | ||
| 49 | LCD_STATE_LAYER_BITMAP, | ||
| 50 | LCD_STATE_BITMAP_AND_LEDS, | ||
| 51 | } lcd_state_t; | ||
| 52 | |||
| 53 | static lcd_state_t lcd_state = LCD_STATE_INITIAL; | ||
| 54 | |||
| 55 | typedef struct { | ||
| 56 | uint8_t led_on; | ||
| 57 | uint8_t led1; | ||
| 58 | uint8_t led2; | ||
| 59 | uint8_t led3; | ||
| 60 | } visualizer_user_data_t; | ||
| 61 | |||
| 62 | // Don't access from visualization function, use the visualizer state instead | ||
| 63 | static visualizer_user_data_t user_data_keyboard = { | ||
| 64 | .led_on = 0, | ||
| 65 | .led1 = LED_BRIGHTNESS_HI, | ||
| 66 | .led2 = LED_BRIGHTNESS_HI, | ||
| 67 | .led3 = LED_BRIGHTNESS_HI, | ||
| 68 | }; | ||
| 69 | |||
| 70 | _Static_assert(sizeof(visualizer_user_data_t) <= VISUALIZER_USER_DATA_SIZE, | ||
| 71 | "Please increase the VISUALIZER_USER_DATA_SIZE"); | ||
| 72 | |||
| 73 | // Feel free to modify the animations below, or even add new ones if needed | ||
| 74 | |||
| 75 | |||
| 76 | // The color animation animates the LCD color when you change layers | ||
| 77 | static keyframe_animation_t one_led_color = { | ||
| 78 | .num_frames = 1, | ||
| 79 | .loop = false, | ||
| 80 | .frame_lengths = {gfxMillisecondsToTicks(0)}, | ||
| 81 | .frame_functions = {lcd_backlight_keyframe_set_color}, | ||
| 82 | }; | ||
| 83 | |||
| 84 | bool swap_led_target_color(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 85 | uint32_t temp = next_led_target_color; | ||
| 86 | next_led_target_color = state->target_lcd_color; | ||
| 87 | state->target_lcd_color = temp; | ||
| 88 | return false; | ||
| 89 | } | ||
| 90 | |||
| 91 | // The color animation animates the LCD color when you change layers | ||
| 92 | static keyframe_animation_t two_led_colors = { | ||
| 93 | .num_frames = 2, | ||
| 94 | .loop = true, | ||
| 95 | .frame_lengths = {gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(0)}, | ||
| 96 | .frame_functions = {lcd_backlight_keyframe_set_color, swap_led_target_color}, | ||
| 97 | }; | ||
| 98 | |||
| 99 | // The LCD animation alternates between the layer name display and a | ||
| 100 | // bitmap that displays all active layers | ||
| 101 | static keyframe_animation_t lcd_bitmap_animation = { | ||
| 102 | .num_frames = 1, | ||
| 103 | .loop = false, | ||
| 104 | .frame_lengths = {gfxMillisecondsToTicks(0)}, | ||
| 105 | .frame_functions = {lcd_keyframe_display_layer_bitmap}, | ||
| 106 | }; | ||
| 107 | |||
| 108 | static keyframe_animation_t lcd_bitmap_leds_animation = { | ||
| 109 | .num_frames = 2, | ||
| 110 | .loop = true, | ||
| 111 | .frame_lengths = {gfxMillisecondsToTicks(2000), gfxMillisecondsToTicks(2000)}, | ||
| 112 | .frame_functions = {lcd_keyframe_display_layer_bitmap, lcd_keyframe_display_led_states}, | ||
| 113 | }; | ||
| 114 | |||
| 115 | void initialize_user_visualizer(visualizer_state_t* state) { | ||
| 116 | // The brightness will be dynamically adjustable in the future | ||
| 117 | // But for now, change it here. | ||
| 118 | lcd_backlight_brightness(130); | ||
| 119 | state->current_lcd_color = initial_color; | ||
| 120 | state->target_lcd_color = logo_background_color; | ||
| 121 | lcd_state = LCD_STATE_INITIAL; | ||
| 122 | start_keyframe_animation(&default_startup_animation); | ||
| 123 | } | ||
| 124 | |||
| 125 | static inline bool is_led_on(visualizer_user_data_t* user_data, uint8_t num) { | ||
| 126 | return user_data->led_on & (1u << num); | ||
| 127 | } | ||
| 128 | |||
| 129 | static uint8_t get_led_index_master(visualizer_user_data_t* user_data) { | ||
| 130 | for (int i=0; i < 3; i++) { | ||
| 131 | if (is_led_on(user_data, i)) { | ||
| 132 | return i + 1; | ||
| 133 | } | ||
| 134 | } | ||
| 135 | return 0; | ||
| 136 | } | ||
| 137 | |||
| 138 | static uint8_t get_led_index_slave(visualizer_user_data_t* user_data) { | ||
| 139 | uint8_t master_index = get_led_index_master(user_data); | ||
| 140 | if (master_index!=0) { | ||
| 141 | for (int i=master_index; i < 3; i++) { | ||
| 142 | if (is_led_on(user_data, i)) { | ||
| 143 | return i + 1; | ||
| 144 | } | ||
| 145 | } | ||
| 146 | } | ||
| 147 | |||
| 148 | return 0; | ||
| 149 | } | ||
| 150 | |||
| 151 | static uint8_t get_secondary_led_index(visualizer_user_data_t* user_data) { | ||
| 152 | if (is_led_on(user_data, 0) && | ||
| 153 | is_led_on(user_data, 1) && | ||
| 154 | is_led_on(user_data, 2)) { | ||
| 155 | return 3; | ||
| 156 | } | ||
| 157 | return 0; | ||
| 158 | } | ||
| 159 | |||
| 160 | static uint8_t get_brightness(visualizer_user_data_t* user_data, uint8_t index) { | ||
| 161 | switch (index) { | ||
| 162 | case 1: | ||
| 163 | return user_data->led1; | ||
| 164 | case 2: | ||
| 165 | return user_data->led2; | ||
| 166 | case 3: | ||
| 167 | return user_data->led3; | ||
| 168 | } | ||
| 169 | return 0; | ||
| 170 | } | ||
| 171 | |||
| 172 | static void update_emulated_leds(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) { | ||
| 173 | visualizer_user_data_t* user_data_new = (visualizer_user_data_t*)state->status.user_data; | ||
| 174 | visualizer_user_data_t* user_data_old = (visualizer_user_data_t*)prev_status->user_data; | ||
| 175 | |||
| 176 | uint8_t new_index; | ||
| 177 | uint8_t old_index; | ||
| 178 | |||
| 179 | if (is_keyboard_master()) { | ||
| 180 | new_index = get_led_index_master(user_data_new); | ||
| 181 | old_index = get_led_index_master(user_data_old); | ||
| 182 | } | ||
| 183 | else { | ||
| 184 | new_index = get_led_index_slave(user_data_new); | ||
| 185 | old_index = get_led_index_slave(user_data_old); | ||
| 186 | } | ||
| 187 | uint8_t new_secondary_index = get_secondary_led_index(user_data_new); | ||
| 188 | uint8_t old_secondary_index = get_secondary_led_index(user_data_old); | ||
| 189 | |||
| 190 | uint8_t old_brightness = get_brightness(user_data_old, old_index); | ||
| 191 | uint8_t new_brightness = get_brightness(user_data_new, new_index); | ||
| 192 | |||
| 193 | uint8_t old_secondary_brightness = get_brightness(user_data_old, old_secondary_index); | ||
| 194 | uint8_t new_secondary_brightness = get_brightness(user_data_new, new_secondary_index); | ||
| 195 | |||
| 196 | if (lcd_state == LCD_STATE_INITIAL || | ||
| 197 | new_index != old_index || | ||
| 198 | new_secondary_index != old_secondary_index || | ||
| 199 | new_brightness != old_brightness || | ||
| 200 | new_secondary_brightness != old_secondary_brightness) { | ||
| 201 | |||
| 202 | if (new_secondary_index != 0) { | ||
| 203 | state->target_lcd_color = change_lcd_color_intensity( | ||
| 204 | led_emulation_colors[new_index], new_brightness); | ||
| 205 | next_led_target_color = change_lcd_color_intensity( | ||
| 206 | led_emulation_colors[new_secondary_index], new_secondary_brightness); | ||
| 207 | |||
| 208 | stop_keyframe_animation(&one_led_color); | ||
| 209 | start_keyframe_animation(&two_led_colors); | ||
| 210 | } else { | ||
| 211 | state->target_lcd_color = change_lcd_color_intensity( | ||
| 212 | led_emulation_colors[new_index], new_brightness); | ||
| 213 | stop_keyframe_animation(&two_led_colors); | ||
| 214 | start_keyframe_animation(&one_led_color); | ||
| 215 | } | ||
| 216 | } | ||
| 217 | } | ||
| 218 | |||
| 219 | static void update_lcd_text(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) { | ||
| 220 | if (state->status.leds) { | ||
| 221 | if (lcd_state != LCD_STATE_BITMAP_AND_LEDS || | ||
| 222 | state->status.leds != prev_status->leds || | ||
| 223 | state->status.layer != prev_status->layer || | ||
| 224 | state->status.default_layer != prev_status->default_layer) { | ||
| 225 | |||
| 226 | // NOTE: that it doesn't matter if the animation isn't playing, stop will do nothing in that case | ||
| 227 | stop_keyframe_animation(&lcd_bitmap_animation); | ||
| 228 | |||
| 229 | lcd_state = LCD_STATE_BITMAP_AND_LEDS; | ||
| 230 | // For information: | ||
| 231 | // The logic in this function makes sure that this doesn't happen, but if you call start on an | ||
| 232 | // animation that is already playing it will be restarted. | ||
| 233 | start_keyframe_animation(&lcd_bitmap_leds_animation); | ||
| 234 | } | ||
| 235 | } else { | ||
| 236 | if (lcd_state != LCD_STATE_LAYER_BITMAP || | ||
| 237 | state->status.layer != prev_status->layer || | ||
| 238 | state->status.default_layer != prev_status->default_layer) { | ||
| 239 | |||
| 240 | stop_keyframe_animation(&lcd_bitmap_leds_animation); | ||
| 241 | |||
| 242 | lcd_state = LCD_STATE_LAYER_BITMAP; | ||
| 243 | start_keyframe_animation(&lcd_bitmap_animation); | ||
| 244 | } | ||
| 245 | } | ||
| 246 | } | ||
| 247 | |||
| 248 | void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) { | ||
| 249 | // Check the status here to start and stop animations | ||
| 250 | // You might have to save some state, like the current animation here so that you can start the right | ||
| 251 | // This function is called every time the status changes | ||
| 252 | |||
| 253 | // NOTE that this is called from the visualizer thread, so don't access anything else outside the status | ||
| 254 | // This is also important because the slave won't have access to the active layer for example outside the | ||
| 255 | // status. | ||
| 256 | |||
| 257 | update_emulated_leds(state, prev_status); | ||
| 258 | update_lcd_text(state, prev_status); | ||
| 259 | |||
| 260 | } | ||
| 261 | |||
| 262 | void user_visualizer_suspend(visualizer_state_t* state) { | ||
| 263 | state->layer_text = "Suspending..."; | ||
| 264 | uint8_t hue = LCD_HUE(state->current_lcd_color); | ||
| 265 | uint8_t sat = LCD_SAT(state->current_lcd_color); | ||
| 266 | state->target_lcd_color = LCD_COLOR(hue, sat, 0); | ||
| 267 | start_keyframe_animation(&default_suspend_animation); | ||
| 268 | } | ||
| 269 | |||
| 270 | void user_visualizer_resume(visualizer_state_t* state) { | ||
| 271 | state->current_lcd_color = initial_color; | ||
| 272 | state->target_lcd_color = logo_background_color; | ||
| 273 | lcd_state = LCD_STATE_INITIAL; | ||
| 274 | start_keyframe_animation(&default_startup_animation); | ||
| 275 | } | ||
| 276 | |||
| 277 | void ergodox_board_led_on(void){ | ||
| 278 | // No board led support | ||
| 279 | } | ||
| 280 | |||
| 281 | void ergodox_right_led_1_on(void){ | ||
| 282 | user_data_keyboard.led_on |= (1u << 0); | ||
| 283 | visualizer_set_user_data(&user_data_keyboard); | ||
| 284 | } | ||
| 285 | |||
| 286 | void ergodox_right_led_2_on(void){ | ||
| 287 | user_data_keyboard.led_on |= (1u << 1); | ||
| 288 | visualizer_set_user_data(&user_data_keyboard); | ||
| 289 | } | ||
| 290 | |||
| 291 | void ergodox_right_led_3_on(void){ | ||
| 292 | user_data_keyboard.led_on |= (1u << 2); | ||
| 293 | visualizer_set_user_data(&user_data_keyboard); | ||
| 294 | } | ||
| 295 | |||
| 296 | void ergodox_board_led_off(void){ | ||
| 297 | // No board led support | ||
| 298 | } | ||
| 299 | |||
| 300 | void ergodox_right_led_1_off(void){ | ||
| 301 | user_data_keyboard.led_on &= ~(1u << 0); | ||
| 302 | visualizer_set_user_data(&user_data_keyboard); | ||
| 303 | } | ||
| 304 | |||
| 305 | void ergodox_right_led_2_off(void){ | ||
| 306 | user_data_keyboard.led_on &= ~(1u << 1); | ||
| 307 | visualizer_set_user_data(&user_data_keyboard); | ||
| 308 | } | ||
| 309 | |||
| 310 | void ergodox_right_led_3_off(void){ | ||
| 311 | user_data_keyboard.led_on &= ~(1u << 2); | ||
| 312 | visualizer_set_user_data(&user_data_keyboard); | ||
| 313 | } | ||
| 314 | |||
| 315 | void ergodox_right_led_1_set(uint8_t n) { | ||
| 316 | user_data_keyboard.led1 = n; | ||
| 317 | visualizer_set_user_data(&user_data_keyboard); | ||
| 318 | } | ||
| 319 | |||
| 320 | void ergodox_right_led_2_set(uint8_t n) { | ||
| 321 | user_data_keyboard.led2 = n; | ||
| 322 | visualizer_set_user_data(&user_data_keyboard); | ||
| 323 | } | ||
| 324 | |||
| 325 | void ergodox_right_led_3_set(uint8_t n) { | ||
| 326 | user_data_keyboard.led3 = n; | ||
| 327 | visualizer_set_user_data(&user_data_keyboard); | ||
| 328 | } | ||
diff --git a/keyboards/whitefox/gfxconf.h b/keyboards/whitefox/gfxconf.h deleted file mode 100644 index ca338399d..000000000 --- a/keyboards/whitefox/gfxconf.h +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | /** | ||
| 2 | * This file has a different license to the rest of the uGFX system. | ||
| 3 | * You can copy, modify and distribute this file as you see fit. | ||
| 4 | * You do not need to publish your source modifications to this file. | ||
| 5 | * The only thing you are not permitted to do is to relicense it | ||
| 6 | * under a different license. | ||
| 7 | */ | ||
| 8 | |||
| 9 | /** | ||
| 10 | * Copy this file into your project directory and rename it as gfxconf.h | ||
| 11 | * Edit your copy to turn on the uGFX features you want to use. | ||
| 12 | * The values below are the defaults. | ||
| 13 | * | ||
| 14 | * Only remove the comments from lines where you want to change the | ||
| 15 | * default value. This allows definitions to be included from | ||
| 16 | * driver makefiles when required and provides the best future | ||
| 17 | * compatibility for your project. | ||
| 18 | * | ||
| 19 | * Please use spaces instead of tabs in this file. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #ifndef _GFXCONF_H | ||
| 23 | #define _GFXCONF_H | ||
| 24 | |||
| 25 | #include "common_gfxconf.h" | ||
| 26 | |||
| 27 | #endif /* _GFXCONF_H */ | ||
diff --git a/keyboards/whitefox/visualizer.c b/keyboards/whitefox/visualizer.c deleted file mode 100644 index 3846e9278..000000000 --- a/keyboards/whitefox/visualizer.c +++ /dev/null | |||
| @@ -1,54 +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 | #include "visualizer.h" | ||
| 18 | #include "visualizer_keyframes.h" | ||
| 19 | #include "default_animations.h" | ||
| 20 | |||
| 21 | static bool initial_update = true; | ||
| 22 | |||
| 23 | // Feel free to modify the animations below, or even add new ones if needed | ||
| 24 | |||
| 25 | void initialize_user_visualizer(visualizer_state_t *state) { | ||
| 26 | // The brightness will be dynamically adjustable in the future | ||
| 27 | // But for now, change it here. | ||
| 28 | initial_update = true; | ||
| 29 | start_keyframe_animation(&default_startup_animation); | ||
| 30 | } | ||
| 31 | |||
| 32 | void update_user_visualizer_state(visualizer_state_t *state, visualizer_keyboard_status_t *prev_status) { | ||
| 33 | // Add more tests, change the colors and layer texts here | ||
| 34 | // Usually you want to check the high bits (higher layers first) | ||
| 35 | // because that's the order layers are processed for keypresses | ||
| 36 | // You can for check for example: | ||
| 37 | // state->status.layer | ||
| 38 | // state->status.default_layer | ||
| 39 | // state->status.leds (see led.h for available statuses) | ||
| 40 | |||
| 41 | if (initial_update) { | ||
| 42 | initial_update = false; | ||
| 43 | start_keyframe_animation(&led_test_animation); | ||
| 44 | } | ||
| 45 | } | ||
| 46 | |||
| 47 | void user_visualizer_suspend(visualizer_state_t *state) { | ||
| 48 | start_keyframe_animation(&default_suspend_animation); | ||
| 49 | } | ||
| 50 | |||
| 51 | void user_visualizer_resume(visualizer_state_t *state) { | ||
| 52 | initial_update = true; | ||
| 53 | start_keyframe_animation(&default_startup_animation); | ||
| 54 | } | ||
