From f59cbfb75c0b161187d22d07b58e242ef225611a Mon Sep 17 00:00:00 2001 From: HorrorTroll Date: Mon, 10 Jan 2022 17:21:53 +0700 Subject: [Keyboard] Added Handwired Redragon K552 Kumara (RGB) (#14004) * Added Handwired Redragon K552 with default and via keymaps * Resolve some request changes, and change the cols pin to a better one. * Resolved request changes * Added OLED support and resolve request change * Increase polling rate to 1000hz * Update font for OLED, and change logo * Added LED Underglow support * Add personal custom keymap * Nit some line, to get better way to look on code * Refactor everything and solved some issue. * Resolved issue --- .../handwired/horrortroll/k552/boards/k552/board.c | 49 +++ .../handwired/horrortroll/k552/boards/k552/board.h | 145 ++++++++ .../horrortroll/k552/boards/k552/board.mk | 5 + keyboards/handwired/horrortroll/k552/chconf.h | 29 ++ keyboards/handwired/horrortroll/k552/config.h | 102 ++++++ keyboards/handwired/horrortroll/k552/halconf.h | 26 ++ keyboards/handwired/horrortroll/k552/info.json | 103 ++++++ keyboards/handwired/horrortroll/k552/k552.c | 64 ++++ keyboards/handwired/horrortroll/k552/k552.h | 54 +++ .../horrortroll/k552/keymaps/default/keymap.c | 98 ++++++ .../k552/keymaps/default/keymap_stuff.h | 304 +++++++++++++++++ .../k552/keymaps/default/led/cool_diagonal.c | 22 ++ .../k552/keymaps/default/led/custom_gradient.c | 74 ++++ .../k552/keymaps/default/led/diagonal.c | 22 ++ .../horrortroll/k552/keymaps/default/led/kitt.c | 68 ++++ .../keymaps/default/led/random_breath_rainbow.c | 55 +++ .../k552/keymaps/default/oled/oled_stuff.h | 69 ++++ .../horrortroll/k552/keymaps/default/readme.md | 16 + .../k552/keymaps/default/rgb_matrix_user.inc | 15 + .../horrortroll/k552/keymaps/default/rules.mk | 1 + .../horrortroll/k552/keymaps/via/config.h | 19 ++ .../horrortroll/k552/keymaps/via/keymap.c | 98 ++++++ .../horrortroll/k552/keymaps/via/keymap_stuff.h | 304 +++++++++++++++++ .../k552/keymaps/via/led/cool_diagonal.c | 22 ++ .../k552/keymaps/via/led/custom_gradient.c | 74 ++++ .../horrortroll/k552/keymaps/via/led/diagonal.c | 22 ++ .../horrortroll/k552/keymaps/via/led/kitt.c | 68 ++++ .../k552/keymaps/via/led/random_breath_rainbow.c | 55 +++ .../horrortroll/k552/keymaps/via/oled/oled_stuff.h | 69 ++++ .../horrortroll/k552/keymaps/via/readme.md | 16 + .../k552/keymaps/via/rgb_matrix_user.inc | 15 + .../horrortroll/k552/keymaps/via/rules.mk | 3 + .../handwired/horrortroll/k552/ld/k552_f103.ld | 85 +++++ .../handwired/horrortroll/k552/lib/bongocat.c | 376 +++++++++++++++++++++ keyboards/handwired/horrortroll/k552/lib/galaxy.c | 58 ++++ .../handwired/horrortroll/k552/lib/glcdfont.c | 248 ++++++++++++++ keyboards/handwired/horrortroll/k552/lib/logo.c | 58 ++++ keyboards/handwired/horrortroll/k552/lib/wave.c | 133 ++++++++ keyboards/handwired/horrortroll/k552/mcuconf.h | 27 ++ keyboards/handwired/horrortroll/k552/readme.md | 22 ++ keyboards/handwired/horrortroll/k552/rules.mk | 33 ++ 41 files changed, 3126 insertions(+) create mode 100644 keyboards/handwired/horrortroll/k552/boards/k552/board.c create mode 100644 keyboards/handwired/horrortroll/k552/boards/k552/board.h create mode 100644 keyboards/handwired/horrortroll/k552/boards/k552/board.mk create mode 100644 keyboards/handwired/horrortroll/k552/chconf.h create mode 100644 keyboards/handwired/horrortroll/k552/config.h create mode 100644 keyboards/handwired/horrortroll/k552/halconf.h create mode 100644 keyboards/handwired/horrortroll/k552/info.json create mode 100644 keyboards/handwired/horrortroll/k552/k552.c create mode 100644 keyboards/handwired/horrortroll/k552/k552.h create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/default/keymap.c create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/default/keymap_stuff.h create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/default/led/cool_diagonal.c create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/default/led/custom_gradient.c create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/default/led/diagonal.c create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/default/led/kitt.c create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/default/led/random_breath_rainbow.c create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/default/oled/oled_stuff.h create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/default/readme.md create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/default/rgb_matrix_user.inc create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/default/rules.mk create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/via/config.h create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/via/keymap.c create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/via/keymap_stuff.h create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/via/led/cool_diagonal.c create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/via/led/custom_gradient.c create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/via/led/diagonal.c create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/via/led/kitt.c create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/via/led/random_breath_rainbow.c create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/via/oled/oled_stuff.h create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/via/readme.md create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/via/rgb_matrix_user.inc create mode 100644 keyboards/handwired/horrortroll/k552/keymaps/via/rules.mk create mode 100644 keyboards/handwired/horrortroll/k552/ld/k552_f103.ld create mode 100644 keyboards/handwired/horrortroll/k552/lib/bongocat.c create mode 100644 keyboards/handwired/horrortroll/k552/lib/galaxy.c create mode 100644 keyboards/handwired/horrortroll/k552/lib/glcdfont.c create mode 100644 keyboards/handwired/horrortroll/k552/lib/logo.c create mode 100644 keyboards/handwired/horrortroll/k552/lib/wave.c create mode 100644 keyboards/handwired/horrortroll/k552/mcuconf.h create mode 100644 keyboards/handwired/horrortroll/k552/readme.md create mode 100644 keyboards/handwired/horrortroll/k552/rules.mk (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/horrortroll/k552/boards/k552/board.c b/keyboards/handwired/horrortroll/k552/boards/k552/board.c new file mode 100644 index 0000000000..65269520ea --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/boards/k552/board.c @@ -0,0 +1,49 @@ +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include + +/** + * @brief PAL setup. + * @details Digital I/O ports static configuration as defined in @p board.h. + * This variable is used by the HAL when initializing the PAL driver. + */ +#if HAL_USE_PAL || defined(__DOXYGEN__) +const PALConfig pal_default_config = +{ + {VAL_GPIOAODR, VAL_GPIOACRL, VAL_GPIOACRH}, + {VAL_GPIOBODR, VAL_GPIOBCRL, VAL_GPIOBCRH}, + {VAL_GPIOCODR, VAL_GPIOCCRL, VAL_GPIOCCRH}, + {VAL_GPIODODR, VAL_GPIODCRL, VAL_GPIODCRH}, +}; +#endif + +/* + * Early initialization code. + * This initialization must be performed just after stack setup and before + * any other initialization. + */ +void __early_init(void) { + stm32_clock_init(); + +} + +/* + * Board-specific initialization code. + */ +void boardInit(void) { + +} diff --git a/keyboards/handwired/horrortroll/k552/boards/k552/board.h b/keyboards/handwired/horrortroll/k552/boards/k552/board.h new file mode 100644 index 0000000000..f9b38b0caf --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/boards/k552/board.h @@ -0,0 +1,145 @@ +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef _BOARD_H_ +#define _BOARD_H_ + +/* + * Board identifier. + */ +#define BOARD_K552 +#define BOARD_NAME "K552 keyboard" + +/* + * Board frequencies. + */ +#define STM32_LSECLK 32768 +#define STM32_HSECLK 8000000 + +/* + * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h. + * + * Only xC (256KB Flash) is defined, but it's identical to the + * x8 version (64KB Flash) except for the Flash region size in the + * linker script. For x8 parts use xC here and change to the x8 linker + * script in the project Makefile. + */ +#pragma once +#include_next +#undef STM32F103xB +#define STM32F103xE + +/* + * IO pins assignments + * + * numbering is sorted by onboard/connectors, as from the schematics in + * http://www.vcc-gnd.com/read.php?tid=369 + */ + +/* on-board */ +#define GPIOA_USBDM 11 // pin 8 +#define GPIOA_USBDP 12 // pin 9 + +#define GPIOC_OSC32_IN 14 +#define GPIOC_OSC32_OUT 15 + +/* + * I/O ports initial setup, this configuration is established soon after reset + * in the initialization code. + * + * The digits have the following meaning: + * 0 - Analog input. + * 1 - Push Pull output 10MHz. + * 2 - Push Pull output 2MHz. + * 3 - Push Pull output 50MHz. + * 4 - Digital input. + * 5 - Open Drain output 10MHz. + * 6 - Open Drain output 2MHz. + * 7 - Open Drain output 50MHz. + * 8 - Digital input with PullUp or PullDown resistor depending on ODR. + * 9 - Alternate Push Pull output 10MHz. + * A - Alternate Push Pull output 2MHz. + * B - Alternate Push Pull output 50MHz. + * C - Reserved. + * D - Alternate Open Drain output 10MHz. + * E - Alternate Open Drain output 2MHz. + * F - Alternate Open Drain output 50MHz. + * Please refer to the STM32 Reference Manual for details. + */ + +/* + * Port A setup. + * Everything input with pull-up except: + */ +#define VAL_GPIOACRL 0x88888888 /* PA7...PA0 */ +#define VAL_GPIOACRH 0x88888888 /* PA15...PA8 */ +#define VAL_GPIOAODR 0xFFFFFFFF + +/* + * Port B setup. + * Everything input with pull-up except: + */ +#define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */ +#define VAL_GPIOBCRH 0x88888888 /* PB15...PB8 */ +#define VAL_GPIOBODR 0xFFFFFFFF + +/* + * Port C setup. + * Everything input with pull-up except: + */ +#define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */ +#define VAL_GPIOCCRH 0x88888888 /* PC15...PC8 */ +#define VAL_GPIOCODR 0xFFFFFFFF + +/* + * Port D setup. + * Everything input with pull-up except: + * PD0 - Normal input (XTAL). + * PD1 - Normal input (XTAL). + */ +#define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */ +#define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */ +#define VAL_GPIODODR 0xFFFFFFFF + +/* + * Port E setup. + * Everything input with pull-up except: + */ +#define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */ +#define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */ +#define VAL_GPIOEODR 0xFFFFFFFF + +/* + * USB bus activation macro, required by the USB driver. + */ +#define usb_lld_connect_bus(usbp) /* always connected */ + +/* + * USB bus de-activation macro, required by the USB driver. + */ +#define usb_lld_disconnect_bus(usbp) /* always connected */ + +#if !defined(_FROM_ASM_) +#ifdef __cplusplus +extern "C" { +#endif + void boardInit(void); +#ifdef __cplusplus +} +#endif +#endif /* _FROM_ASM_ */ + +#endif /* _BOARD_H_ */ diff --git a/keyboards/handwired/horrortroll/k552/boards/k552/board.mk b/keyboards/handwired/horrortroll/k552/boards/k552/board.mk new file mode 100644 index 0000000000..15831c4f15 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/boards/k552/board.mk @@ -0,0 +1,5 @@ +# List of all the board related files. +BOARDSRC = $(BOARD_PATH)/boards/k552/board.c + +# Required include directories +BOARDINC = $(BOARD_PATH)/boards/k552 diff --git a/keyboards/handwired/horrortroll/k552/chconf.h b/keyboards/handwired/horrortroll/k552/chconf.h new file mode 100644 index 0000000000..41c38c33e4 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/chconf.h @@ -0,0 +1,29 @@ +/* Copyright 2020 QMK + * + * 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 . + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/wolfmarkclub/wm1/chconf.h -r platforms/chibios/common/configs/chconf.h` + */ + +#pragma once + +#define CH_CFG_ST_TIMEDELTA 0 + +#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE + +#include_next + diff --git a/keyboards/handwired/horrortroll/k552/config.h b/keyboards/handwired/horrortroll/k552/config.h new file mode 100644 index 0000000000..1071b7ff31 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/config.h @@ -0,0 +1,102 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x7516 //Redragon +#define PRODUCT_ID 0x5104 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Redragon +#define PRODUCT K552 Kumara + +/* Key matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 17 + +/* Key matrix pin 0 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 */ +#define MATRIX_ROW_PINS { C12, C10, A10, A8, C8, C9 } +#define MATRIX_COL_PINS { B15, C6, C7, A3, A1, C3, C1, B14, B13, A9, B3, B4, A0, C11, A2, C0, C2 } + +/* Direction of diode (COL2ROW or ROW2COL) */ +#define DIODE_DIRECTION ROW2COL + +/* Bootmagic reset */ +#define BOOTMAGIC_LITE_ROW 4 +#define BOOTMAGIC_LITE_COLUMN 6 + +/* Forcing to use NKRO instead 6KRO */ +#define FORCE_NKRO + +/* Change USB Polling Rate to 1000hz and a larger keys per scan for elite gaming */ +#define USB_POLLING_INTERVAL_MS 1 +#define QMK_KEYS_PER_SCAN 12 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* EEPROM size */ +#define EEPROM_PAGE_SIZE +#define FEE_PAGE_SIZE 0x800 +#define FEE_PAGE_COUNT 4 + +#define FEE_MCU_FLASH_SIZE_IGNORE_CHECK +#define FEE_MCU_FLASH_SIZE \ +({ \ + uint16_t flash_size = *(uint16_t*)FLASHSIZE_BASE; \ + (flash_size <= 512) ? flash_size : 512; \ +}) + +#ifdef OLED_ENABLE + /* Mapping I2C2 for OLED */ + #define I2C1_SCL_PIN B10 + #define I2C1_SDA_PIN B11 + #define I2C_DRIVER I2CD2 + + /* Use the custom font */ + #define OLED_FONT_H "lib/glcdfont.c" +#endif + +#ifdef RGB_MATRIX_ENABLE + #define DRIVER_LED_TOTAL 24 + #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 + #define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS + + /* RGB Matrix config */ + #define RGB_DI_PIN C14 + + /* RGB Matrix effect */ + #define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN + #define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT + #define ENABLE_RGB_MATRIX_BREATHING + #define ENABLE_RGB_MATRIX_BAND_VAL + #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL + #define ENABLE_RGB_MATRIX_CYCLE_ALL + #define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT + #define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN + #define ENABLE_RGB_MATRIX_CYCLE_OUT_IN + #define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL + #define ENABLE_RGB_MATRIX_DUAL_BEACON + #define ENABLE_RGB_MATRIX_RAINBOW_BEACON + #define ENABLE_RGB_MATRIX_RAINDROPS + #define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS + #define ENABLE_RGB_MATRIX_HUE_BREATHING + #define ENABLE_RGB_MATRIX_HUE_PENDULUM + #define ENABLE_RGB_MATRIX_HUE_WAVE + #define ENABLE_RGB_MATRIX_PIXEL_RAIN +#endif diff --git a/keyboards/handwired/horrortroll/k552/halconf.h b/keyboards/handwired/horrortroll/k552/halconf.h new file mode 100644 index 0000000000..e872252b6e --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/halconf.h @@ -0,0 +1,26 @@ +/* Copyright 2020 QMK + * + * 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 . + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/wolfmarkclub/wm1/halconf.h -r platforms/chibios/common/configs/halconf.h` + */ + +#pragma once + +#define HAL_USE_I2C TRUE + +#include_next diff --git a/keyboards/handwired/horrortroll/k552/info.json b/keyboards/handwired/horrortroll/k552/info.json new file mode 100644 index 0000000000..d7cbb2b448 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/info.json @@ -0,0 +1,103 @@ +{ + "keyboard_name": "Redragon K552 Kumara", + "url": "", + "maintainer": "HorrorTroll", + "layouts": { + "LAYOUT_tkl_ansi": { + "layout": [ + {"label":"Esc", "x":0, "y":0}, + {"label":"F1", "x":2, "y":0}, + {"label":"F2", "x":3, "y":0}, + {"label":"F3", "x":4, "y":0}, + {"label":"F4", "x":5, "y":0}, + {"label":"F5", "x":6.5, "y":0}, + {"label":"F6", "x":7.5, "y":0}, + {"label":"F7", "x":8.5, "y":0}, + {"label":"F8", "x":9.5, "y":0}, + {"label":"F9", "x":11, "y":0}, + {"label":"F10", "x":12, "y":0}, + {"label":"F11", "x":13, "y":0}, + {"label":"F12", "x":14, "y":0}, + {"label":"Print Screen", "x":15.25, "y":0}, + {"label":"Scroll Lock", "x":16.25, "y":0}, + {"label":"Pause", "x":17.25, "y":0}, + + {"label":"`~", "x":0, "y":1.25}, + {"label":"1!", "x":1, "y":1.25}, + {"label":"2@", "x":2, "y":1.25}, + {"label":"3#", "x":3, "y":1.25}, + {"label":"4$", "x":4, "y":1.25}, + {"label":"5%", "x":5, "y":1.25}, + {"label":"6^", "x":6, "y":1.25}, + {"label":"7&", "x":7, "y":1.25}, + {"label":"8*", "x":8, "y":1.25}, + {"label":"9(", "x":9, "y":1.25}, + {"label":"0)", "x":10, "y":1.25}, + {"label":"-_", "x":11, "y":1.25}, + {"label":"=+", "x":12, "y":1.25}, + {"label":"Backspace", "x":13, "y":1.25, "w":2}, + {"label":"Insert", "x":15.25, "y":1.25}, + {"label":"Home", "x":16.25, "y":1.25}, + {"label":"PgUp", "x":17.25, "y":1.25}, + + {"label":"Tab", "x":0, "y":2.25, "w":1.5}, + {"label":"Q", "x":1.5, "y":2.25}, + {"label":"W", "x":2.5, "y":2.25}, + {"label":"E", "x":3.5, "y":2.25}, + {"label":"R", "x":4.5, "y":2.25}, + {"label":"T", "x":5.5, "y":2.25}, + {"label":"Y", "x":6.5, "y":2.25}, + {"label":"U", "x":7.5, "y":2.25}, + {"label":"I", "x":8.5, "y":2.25}, + {"label":"O", "x":9.5, "y":2.25}, + {"label":"P", "x":10.5, "y":2.25}, + {"label":"[{", "x":11.5, "y":2.25}, + {"label":"]}", "x":12.5, "y":2.25}, + {"label":"\\|", "x":13.5, "y":2.25, "w":1.5}, + {"label":"Delete", "x":15.25, "y":2.25}, + {"label":"End", "x":16.25, "y":2.25}, + {"label":"PgDn", "x":17.25, "y":2.25}, + + {"label":"Caps Lock", "x":0, "y":3.25, "w":1.75}, + {"label":"A", "x":1.75, "y":3.25}, + {"label":"S", "x":2.75, "y":3.25}, + {"label":"D", "x":3.75, "y":3.25}, + {"label":"F", "x":4.75, "y":3.25}, + {"label":"G", "x":5.75, "y":3.25}, + {"label":"H", "x":6.75, "y":3.25}, + {"label":"J", "x":7.75, "y":3.25}, + {"label":"K", "x":8.75, "y":3.25}, + {"label":"L", "x":9.75, "y":3.25}, + {"label":";:", "x":10.75, "y":3.25}, + {"label":"'\"", "x":11.75, "y":3.25}, + {"label":"Enter", "x":12.75, "y":3.25, "w":2.25}, + + {"label":"Shift", "x":0, "y":4.25, "w":2.25}, + {"label":"Z", "x":2.25, "y":4.25}, + {"label":"X", "x":3.25, "y":4.25}, + {"label":"C", "x":4.25, "y":4.25}, + {"label":"V", "x":5.25, "y":4.25}, + {"label":"B", "x":6.25, "y":4.25}, + {"label":"N", "x":7.25, "y":4.25}, + {"label":"M", "x":8.25, "y":4.25}, + {"label":",<", "x":9.25, "y":4.25}, + {"label":".>", "x":10.25, "y":4.25}, + {"label":"/?", "x":11.25, "y":4.25}, + {"label":"Shift", "x":12.25, "y":4.25, "w":2.75}, + {"label":"\u2191", "x":16.25, "y":4.25}, + + {"label":"Ctrl", "x":0, "y":5.25, "w":1.25}, + {"label":"Win", "x":1.25, "y":5.25, "w":1.25}, + {"label":"Alt", "x":2.5, "y":5.25, "w":1.25}, + {"label":"Space", "x":3.75, "y":5.25, "w":6.25}, + {"label":"Alt", "x":10, "y":5.25, "w":1.25}, + {"label":"Fn", "x":11.25, "y":5.25, "w":1.25}, + {"label":"App", "x":12.5, "y":5.25, "w":1.25}, + {"label":"Ctrl", "x":13.75, "y":5.25, "w":1.25}, + {"label":"\u2190", "x":15.25, "y":5.25}, + {"label":"\u2193", "x":16.25, "y":5.25}, + {"label":"\u2192", "x":17.25, "y":5.25} + ] + } + } +} diff --git a/keyboards/handwired/horrortroll/k552/k552.c b/keyboards/handwired/horrortroll/k552/k552.c new file mode 100644 index 0000000000..31ce5d1bbf --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/k552.c @@ -0,0 +1,64 @@ +/* Copyright 2021 HorrorTroll + * + * 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 "k552.h" + +// OLED animation +#include "lib/logo.c" + +#ifdef RGB_MATRIX_ENABLE +led_config_t g_led_config = { { + { } +}, { + {152, 0}, {165, 0}, {190, 0}, {205, 0}, + {224, 21}, {224, 43}, {224, 54}, + {188, 64}, {172, 64}, {156, 64}, {140, 64}, {115, 64}, {99 , 64}, {75 , 64}, {59 , 64}, {43 , 64}, {26 , 64}, + {0 , 15}, {0 , 50}, {0 , 39}, + {18 , 0}, {36 , 0}, {57 , 0}, {67 , 0} +}, { + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, + 2, 2, + 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +} }; +#endif + +#ifdef OLED_ENABLE + uint16_t startup_timer; + + oled_rotation_t oled_init_kb(oled_rotation_t rotation) { + startup_timer = timer_read(); + + return rotation; + } + + bool oled_task_kb(void) { + static bool finished_logo = false; + + if ((timer_elapsed(startup_timer) < 5000) && !finished_logo) { + render_logo(); + } else { + finished_logo = true; + + if (!oled_task_user()) { + return false; + } + } + + return true; + } +#endif diff --git a/keyboards/handwired/horrortroll/k552/k552.h b/keyboards/handwired/horrortroll/k552/k552.h new file mode 100644 index 0000000000..2a537714e3 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/k552.h @@ -0,0 +1,54 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +#pragma once + +#include "quantum.h" + +#define XXX KC_NO + +/* ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ + * │00 │ │01 │02 │03 │04 │ │05 │06 │07 │08 │ │09 │0A │0B │0C │ │0E │0F │0G │ + * └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ + * │10 │11 │12 │13 │14 │15 │16 │17 │18 │19 │1A │1B │1C │1D │ │1E │1F │1G │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ + * │20 │21 │22 │23 │24 │25 │26 │27 │28 │29 │2A │2B │2C │2D │ │2E │2F │2G │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ + * │30 │31 │32 │33 │34 │35 │36 │37 │38 │39 │3A │3B │3D │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ + * │40 │42 │43 │44 │45 │46 │47 │48 │49 │4A │4B │4D │ │4F │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ + * │50 │51 │52 │53 │54 │55 │56 │58 │ │5E │5F │5G │ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ + */ + +#define LAYOUT_tkl_ansi( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0E, K0F, K0G, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1F, K1G, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, K2F, K2G, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, \ + K40, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4D, K4F, \ + K50, K51, K52, K53, K54, K55, K56, K58, K5E, K5F, K5G \ +)\ +{\ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, XXX, K0E, K0F, K0G }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1F, K1G }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, K2F, K2G }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, XXX, K3D, XXX, XXX, XXX }, \ + { K40, XXX, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, XXX, K4D, XXX, K4F, XXX }, \ + { K50, K51, K52, K53, K54, K55, K56, XXX, K58, XXX, XXX, XXX, XXX, XXX, K5E, K5F, K5G }, \ +} diff --git a/keyboards/handwired/horrortroll/k552/keymaps/default/keymap.c b/keyboards/handwired/horrortroll/k552/keymaps/default/keymap.c new file mode 100644 index 0000000000..641e0e5381 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/default/keymap.c @@ -0,0 +1,98 @@ +/* Copyright 2021 HorrorTroll + * + * 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 QMK_KEYBOARD_H + +#include "keymap_stuff.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* + ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ + │Esc│ │F1 │F2 │F3 │F4 │ │F5 │F6 │F7 │F8 │ │F9 │F10│F11│F12│ │PSc│Scr│Pse│ + └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ + │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Backsp│ │Ins│Hom│PgU│ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ + │ Tab │ q │ w │ e │ r │ t │ y │ u │ i │ o │ p │ [ │ ] │ \ │ │Del│End│PgD│ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ + │ Caps │ a │ s │ d │ f │ g │ h │ j │ k │ l │ ; │ ' │ Enter │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ + │ LShift │ z │ x │ c │ v │ b │ n │ m │ , │ . │ / │ RShift │ │ ↑ │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ + │LCrl│GUI │LAlt│ Space │RAlt│ Fn │ App│RCrl│ │ ← │ ↓ │ → │ + └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ + ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ + │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ │ │ │ │ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ + │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ { │ } │ | │ │ │ │ │ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ + │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ : │ " │ │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ + │ LShift │ Z │ X │ C │ V │ B │ N │ M │ < │ > │ ? │ RShift │ │ │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ + └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + [_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUSE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + [_WAVE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUSE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT + ), + +/* + ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ + │Rst│ │MeP│VoD│VoU│Mut│ │Stp│Prv│Ply│Nxt│ │Mai│Hom│Cal│Sch│ │Rod│Mod│Tog│ + └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ + │ │ │ │ │ │ │ │ │ │ │ │Spd│Spi│ │ │C_E│ │ │ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ + │ │1Hd│1Hi│1Sd│1Si│1Vd│1Vi│ │ │ │ │ │ │ │ │ │ │Wve│ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ + │ │2Hd│2Hi│2Sd│2Si│2Vd│2Vi│ │ │ │ │ │ │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ + │ │ │Pre│Ref│Flp│ │ │ │ │ │ │ │ │Vai│ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ + │ │ │ │ │ │ Fn │ │ │ │Hud│Vad│Hui│ + └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + [_FN] = LAYOUT_tkl_ansi( + RESET, KC_MSEL, KC_VOLD, KC_VOLU, KC_MUTE, KC_MSTP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MAIL, KC_WHOM, KC_CALC, KC_WSCH, RGB_RMOD, RGB_MOD, RGB_TOG, + NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SPD, RGB_SPI, _______, RGB_C_E, _______, _______, + _______, G1_HUD, G1_HUI, G1_SAD, G1_SAI, G1_VAD, G1_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, TG(_WAVE), + _______, G2_HUD, G2_HUI, G2_SAD, G2_SAI, G2_VAD, G2_VAI, _______, _______, _______, _______, _______, _______, + _______, G_PRE, REF_G, G_FLIP, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, + _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_VAD, RGB_HUI + ), +}; diff --git a/keyboards/handwired/horrortroll/k552/keymaps/default/keymap_stuff.h b/keyboards/handwired/horrortroll/k552/keymaps/default/keymap_stuff.h new file mode 100644 index 0000000000..c328e03e00 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/default/keymap_stuff.h @@ -0,0 +1,304 @@ +/* Copyright 2021 HorrorTroll + * + * 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 "rgb_matrix.h" +#include "progmem.h" +#include "config.h" +#include "eeprom.h" +#include +#include + +#include + +#include "oled/oled_stuff.h" + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. + +enum layer_names { + _BASE = 0, + _WAVE = 1, + _FN = 2 +}; + +// For CUSTOM_GRADIENT +HSV gradient_0 = {205, 250, 255}; +HSV gradient_100 = {140, 215, 125}; +bool reflected_gradient = false; +uint8_t gp_i = 0; + +typedef struct { + HSV gradient_0; + HSV gradient_1; + bool reflected; +} CUSTOM_PRESETS; + +enum user_rgb_mode { + RGB_MODE_ALL, + RGB_MODE_NONE, +}; + +typedef union { + uint32_t raw; + struct { + uint8_t rgb_mode :8; + }; +} user_config_t; + +user_config_t user_config; + +enum layer_keycodes { + //Custom Gradient control keycode + G1_HUI = SAFE_RANGE, //Custom gradient color 1 hue increase + G1_HUD, //Custom gradient color 1 hue decrease + G1_SAI, //Custom gradient color 1 saturation increase + G1_SAD, //Custom gradient color 1 saturation decrease + G1_VAI, //Custom gradient color 1 value increase + G1_VAD, //Custom gradient color 1 value decrease + G2_HUI, //Custom gradient color 2 hue increase + G2_HUD, //Custom gradient color 2 hue decrease + G2_SAI, //Custom gradient color 2 saturation increase + G2_SAD, //Custom gradient color 2 saturation decrease + G2_VAI, //Custom gradient color 2 value increase + G2_VAD, //Custom gradient color 2 value decrease + G_PRE, //Gradient presets + REF_G, //Toggle between linear and reflected gradient + G_FLIP, //Flip the gradient colors + + //Custom led effect keycode + RGB_C_E, //Cycle user effect +}; + +void keyboard_post_init_kb(void) { + user_config.raw = eeconfig_read_user(); + switch (user_config.rgb_mode) { + case RGB_MODE_ALL: + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_enable_noeeprom(); + break; + case RGB_MODE_NONE: + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_set_color_all(0, 0, 0); + break; + } +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + process_record_user_oled(keycode, record); + + uint8_t color_adj_step = 5; + + CUSTOM_PRESETS gradient_presets[] = { + {{41 , 255, 255}, {233, 245, 255}, false }, + {{45 , 245, 155}, {160, 255, 80}, false }, + {{173, 245, 40}, {41 , 255, 205}, true }, + {{32 , 255, 165}, {217, 185, 70}, false }, + {{240, 255, 145}, {115, 255, 245}, true }, + {{118, 255, 255}, {242, 255, 255}, false }, + {{212, 0 , 0}, {223, 235, 165}, true }, + {{205, 250, 255}, {140, 215, 125}, false }, + }; + + uint8_t gp_length = sizeof(gradient_presets)/sizeof(gradient_presets[0]); + + switch (keycode) { + case G1_HUI: + if (record->event.pressed) { + gradient_0.h += color_adj_step; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G1_HUD: + if (record->event.pressed) { + gradient_0.h -= color_adj_step; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G1_SAI: + if (record->event.pressed) { + gradient_0.s = (gradient_0.s + color_adj_step * 2 <= 255) ? gradient_0.s + color_adj_step * 2 : 255; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G1_SAD: + if (record->event.pressed) { + gradient_0.s = (gradient_0.s - color_adj_step * 2 >= 0) ? gradient_0.s - color_adj_step * 2 : 0; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G1_VAI: + if (record->event.pressed) { + gradient_0.v = (gradient_0.v + color_adj_step * 2 <= 255) ? gradient_0.v + color_adj_step * 2 : 255; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G1_VAD: + if (record->event.pressed) { + gradient_0.v = (gradient_0.v - color_adj_step * 2 >= 0) ? gradient_0.v - color_adj_step * 2 : 0; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G2_HUI: + if (record->event.pressed) { + gradient_100.h += color_adj_step; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G2_HUD: + if (record->event.pressed) { + gradient_100.h -= color_adj_step; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G2_SAI: + if (record->event.pressed) { + gradient_100.s = (gradient_100.s + color_adj_step * 2 <= 255) ? gradient_100.s + color_adj_step * 2 : 255; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G2_SAD: + if (record->event.pressed) { + gradient_100.s = (gradient_100.s - color_adj_step * 2 >= 0) ? gradient_100.s - color_adj_step * 2 : 0; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G2_VAI: + if (record->event.pressed) { + gradient_100.v = (gradient_100.v + color_adj_step * 2 <= 255) ? gradient_100.v + color_adj_step * 2 : 255; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G2_VAD: + if (record->event.pressed) { + gradient_100.v = (gradient_100.v - color_adj_step * 2 >= 0) ? gradient_100.v - color_adj_step * 2 : 0; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G_PRE: + if (record->event.pressed) { + gp_i = (gp_i + gp_length ) % gp_length; + + gradient_0 = gradient_presets[gp_i].gradient_0; + gradient_100 = gradient_presets[gp_i].gradient_1; + reflected_gradient = gradient_presets[gp_i].reflected; + + gp_i += 1; + } + return false; + case REF_G: + if (record->event.pressed) { + reflected_gradient = !reflected_gradient; + } + return false; + case G_FLIP: + if (record->event.pressed) { + HSV temp_color = gradient_0; + gradient_0 = gradient_100; + gradient_100 = temp_color; + } + return false; + case RGB_C_E: + if (record->event.pressed) { + switch (rgb_matrix_get_mode()) { + case RGB_MATRIX_CUSTOM_CUSTOM_GRADIENT: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_DIAGONAL); + return false; + case RGB_MATRIX_CUSTOM_DIAGONAL: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_COOL_DIAGONAL); + return false; + case RGB_MATRIX_CUSTOM_COOL_DIAGONAL: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_KITT); + return false; + case RGB_MATRIX_CUSTOM_KITT: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_RANDOM_BREATH_RAINBOW); + return false; + default: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_CUSTOM_GRADIENT); + return false; + } + } + return false; + case RGB_TOG: + if (record->event.pressed) { + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_set_color_all(0, 0, 0); + user_config.rgb_mode = RGB_MODE_NONE; + } + break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_enable_noeeprom(); + user_config.rgb_mode = RGB_MODE_ALL; + } + break; + } + eeconfig_update_user(user_config.raw); + } + return false; + } + return true; +} + +void rgb_matrix_indicators_user(void) { + uint8_t side_leds_left[3] = {17, 18, 19}; + uint8_t side_leds_right[3] = { 4, 5, 6}; + HSV hsv = rgb_matrix_config.hsv; + uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1)); + hsv.h = time; + RGB rgb = hsv_to_rgb(hsv); + + if ((rgb_matrix_get_flags() & LED_FLAG_ALL)) { + if (host_keyboard_led_state().caps_lock) { + for (uint8_t i = 0; i < 3; i++) + { + rgb_matrix_set_color(side_leds_left[i], rgb.r, rgb.g, rgb.b); + } + } + if (host_keyboard_led_state().scroll_lock) { + for (uint8_t i = 0; i < 3; i++) + { + rgb_matrix_set_color(side_leds_right[i], rgb.r, rgb.g, rgb.b); + } + } + } else { + if (host_keyboard_led_state().caps_lock) { + for (uint8_t i = 0; i < 3; i++) + { + rgb_matrix_set_color(side_leds_left[i], rgb.r, rgb.g, rgb.b); + } + } else { + for (uint8_t i = 0; i < 3; i++) + { + rgb_matrix_set_color(side_leds_left[i], 0, 0, 0); + } + } + if (host_keyboard_led_state().scroll_lock) { + for (uint8_t i = 0; i < 3; i++) + { + rgb_matrix_set_color(side_leds_right[i], rgb.r, rgb.g, rgb.b); + } + } else { + for (uint8_t i = 0; i < 3; i++) + { + rgb_matrix_set_color(side_leds_right[i], 0, 0, 0); + } + } + } +} diff --git a/keyboards/handwired/horrortroll/k552/keymaps/default/led/cool_diagonal.c b/keyboards/handwired/horrortroll/k552/keymaps/default/led/cool_diagonal.c new file mode 100644 index 0000000000..2c518a5431 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/default/led/cool_diagonal.c @@ -0,0 +1,22 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +static HSV COOL_DIAGONAL_math(HSV hsv, uint8_t i, uint8_t time) { + hsv.h = (g_led_config.point[i].x / 4) - g_led_config.point[i].y - time; + return hsv; +} + +bool COOL_DIAGONAL(effect_params_t* params) { return effect_runner_i(params, &COOL_DIAGONAL_math); } \ No newline at end of file diff --git a/keyboards/handwired/horrortroll/k552/keymaps/default/led/custom_gradient.c b/keyboards/handwired/horrortroll/k552/keymaps/default/led/custom_gradient.c new file mode 100644 index 0000000000..49e4a242fb --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/default/led/custom_gradient.c @@ -0,0 +1,74 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +extern HSV gradient_0; +extern HSV gradient_100; +extern bool reflected_gradient; + +static HSV INTERPOLATE_HSV(float step, HSV gradient_0, HSV gradient_100) { + uint8_t cw, ccw; + HSV color; + + cw = (gradient_0.h >= gradient_100.h) ? 255 + gradient_100.h - gradient_0.h : gradient_100.h - gradient_0.h; // Hue range is 0 to 255. + ccw = (gradient_0.h >= gradient_100.h) ? gradient_0.h - gradient_100.h : 255 + gradient_0.h - gradient_100.h; + + if( cw < ccw ) { // going clockwise + color.h = gradient_0.h + (uint8_t)(step * cw); + } else { // Going counter clockwise + color.h = gradient_0.h - (uint8_t)(step * ccw); + } + + color.s = gradient_0.s + step * (gradient_100.s - gradient_0.s); + + // Scale V with global RGB Matrix's V, so users can still control overall brightness with RGB_VAI & RGB_VAD0 + color.v = round((gradient_0.v + step * (gradient_100.v - gradient_0.v)) * ((float)rgb_matrix_config.hsv.v / 255)); + + return color; +} + +static HSV CUSTOM_GRADIENT_math(uint8_t led_x, uint8_t min_x, uint8_t max_x) { + float step = (float)led_x / (max_x - min_x); + float mid_gradient_pos = 0.5; + + if( reflected_gradient ) { + if( step <= mid_gradient_pos ) { + return INTERPOLATE_HSV(step * (1/mid_gradient_pos), gradient_0, gradient_100); + } else { + return INTERPOLATE_HSV((step - mid_gradient_pos) * (1/(1-mid_gradient_pos)), gradient_100, gradient_0); + } + + } else { + return INTERPOLATE_HSV(step, gradient_0, gradient_100); + } +} + +static bool CUSTOM_GRADIENT(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint8_t min_x = 0; // X coordinate of the left-most LED + uint8_t max_x = 224; // X coordinate of the right-most LED + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + HSV hsv_orig = CUSTOM_GRADIENT_math(g_led_config.point[i].x, min_x, max_x); + RGB rgb = hsv_to_rgb(hsv_orig); + + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + + return led_max < DRIVER_LED_TOTAL; +} diff --git a/keyboards/handwired/horrortroll/k552/keymaps/default/led/diagonal.c b/keyboards/handwired/horrortroll/k552/keymaps/default/led/diagonal.c new file mode 100644 index 0000000000..19e3791bd6 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/default/led/diagonal.c @@ -0,0 +1,22 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +static HSV DIAGONAL_math(HSV hsv, uint8_t i, uint8_t time) { + hsv.h = g_led_config.point[i].x - g_led_config.point[i].y - time; + return hsv; +} + +bool DIAGONAL(effect_params_t* params) { return effect_runner_i(params, &DIAGONAL_math); } diff --git a/keyboards/handwired/horrortroll/k552/keymaps/default/led/kitt.c b/keyboards/handwired/horrortroll/k552/keymaps/default/led/kitt.c new file mode 100644 index 0000000000..823eb5839b --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/default/led/kitt.c @@ -0,0 +1,68 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +// variable for startup animation +bool BASE_EFFECT_NOT_STARTED_YET = true; +uint8_t base_effect_startup_counter = 255; + +uint8_t led_count = 10; +uint8_t led_first = 7; + +static uint8_t time_to_led(uint8_t time, uint8_t led_behind) { + uint16_t led_time = led_count * time; + uint16_t step = ((2 * led_count + (led_time / 128)) - led_behind) % (2 * led_count); + uint8_t led; + + if (step < led_count) { + led = step; + } else { + led = led_count - 1 - (step - led_count); + } + + return led; +} + +static HSV KITT_math(HSV hsv, uint8_t i, uint8_t time) { + + // reset base effect startup + if (i == 0) { + BASE_EFFECT_NOT_STARTED_YET = true; + } + + hsv.h = 0; + hsv.s = 255; + + if (i >= led_first && i < led_first + led_count) { + uint8_t j = i - led_first; + if (j == time_to_led(time, 0)) { + hsv.v = hsv.v; + } else if (j == time_to_led(time, 1)) { + hsv.v = hsv.v/2; + } else if (j == time_to_led(time, 2)) { + hsv.v = hsv.v/4; + } else if (j == time_to_led(time, 3)) { + hsv.v = hsv.v/8; + } else { + hsv.v = 0; + } + } else { + hsv.v = 0; + } + + return hsv; +} + +bool KITT(effect_params_t* params) { return effect_runner_i(params, &KITT_math); } diff --git a/keyboards/handwired/horrortroll/k552/keymaps/default/led/random_breath_rainbow.c b/keyboards/handwired/horrortroll/k552/keymaps/default/led/random_breath_rainbow.c new file mode 100644 index 0000000000..041417477b --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/default/led/random_breath_rainbow.c @@ -0,0 +1,55 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +static uint8_t offset[DRIVER_LED_TOTAL]; + +static void doRandom_breath_rainbow(int i, effect_params_t* params) { + if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; + uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 6); + + if (rand() * 50 == 1) { + if (rand() * 2 == 1) { + offset[i]++; + } + else { + offset[i]--; + } + } + + //float val = (((float)sin8(time + offset[i]) / 256)/2.1) + .05; + HSV hsv = {0, 255, 255}; + hsv.h = scale16by8(g_rgb_timer + offset[i], rgb_matrix_config.speed / 4) + (offset[i]*2); + hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); + RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); +} + +bool RANDOM_BREATH_RAINBOW(effect_params_t* params) { + + if (!params->init) { + // Change one LED every tick, make sure speed is not 0 + doRandom_breath_rainbow(rand() % DRIVER_LED_TOTAL, params); + return false; + } + + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + for (uint8_t i = led_min; i < led_max; i++) { + doRandom_breath_rainbow(i, params); + } + + return led_max < DRIVER_LED_TOTAL; +} diff --git a/keyboards/handwired/horrortroll/k552/keymaps/default/oled/oled_stuff.h b/keyboards/handwired/horrortroll/k552/keymaps/default/oled/oled_stuff.h new file mode 100644 index 0000000000..9d8d629179 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/default/oled/oled_stuff.h @@ -0,0 +1,69 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +// OLED animation +#include "lib/bongocat.c" +#include "lib/galaxy.c" +#include "lib/wave.c" + +#ifdef OLED_ENABLE + bool oled_task_user(void) { + led_t led_usb_state = host_keyboard_led_state(); + static uint8_t old_layer; + uint8_t layer = get_highest_layer(layer_state | default_layer_state); + + if (layer != old_layer) { + oled_clear(); + } + + old_layer = layer; + + switch (layer) { + case 0: + render_bongocat(); + oled_set_cursor(14, 0); // sets cursor to (column, row) using charactar spacing (4 rows on 128x32 screen, anything more will overflow back to the top) + oled_write_P(PSTR("WPM:"), false); + oled_write(get_u8_str(get_current_wpm(), '0'), false); // writes wpm on top right corner of string + oled_set_cursor(17, 2); + oled_write_P(led_usb_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false); + oled_set_cursor(17, 3); + oled_write_P(led_usb_state.scroll_lock ? PSTR("SCRL") : PSTR(" "), false); + break; + case 1: + // sleep if it has been long enough since we last got a char + if (timer_elapsed32(wave_sleep) > OLED_TIMEOUT) { + oled_off(); + } else { + oled_on(); + } + // time for the next frame? + if (timer_elapsed(wave_timer) > FRAME_TIMEOUT) { + wave_timer = timer_read(); + render_frame(); + } + + oled_set_cursor(0, 3); + oled_write_P(led_usb_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false); + oled_set_cursor(17, 3); + oled_write_P(led_usb_state.scroll_lock ? PSTR("SCRL") : PSTR(" "), false); + break; + case 2: + render_galaxy(); + break; + } + return false; + } +#endif diff --git a/keyboards/handwired/horrortroll/k552/keymaps/default/readme.md b/keyboards/handwired/horrortroll/k552/keymaps/default/readme.md new file mode 100644 index 0000000000..c8f9c1f8ec --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/default/readme.md @@ -0,0 +1,16 @@ +# Default layout and custom LED / OLED + +Keymap is default 87 qwerty, TKL layout + +It have new LED effect: +- Custom gradient (ported from SirTimmyTimbit code [https://github.com/SirTimmyTimbit/customizable-gradient-effect-for-drop-alt]) +- Diagonal (ported from pleasuretek code [https://github.com/pleasuretek/qmk_firmware]) +- Cool diagonal (ported from pleasuretek code [https://github.com/pleasuretek/qmk_firmware]) +- Knight Rider (ported from jumper149 code [https://github.com/jumper149/qmk_firmware/blob/jumper149/keyboards/dztech/dz65rgb/keymaps/jumper149/]) +- Random breath rainbow (based from daed code [https://github.com/daed/qmk_firmware/blob/master/keyboards/massdrop/alt/keymaps/daed] and modify by me) + +And OLED Animation: +- Bongo Cat (ported from nwii code [https://github.com/nwii/oledbongocat] and modify image animation by me) +- Waveform Typing (ported from drcforbin code [https://github.com/drcforbin/keyboards] and modify to correct my TKL layout) +- Galaxy image when pressing FN key (original image [https://www.deviantart.com/rock-bomber/art/Gateway-668850827] and redraw then cut for 128x32 size by me) +- Redragon Logo when booting up diff --git a/keyboards/handwired/horrortroll/k552/keymaps/default/rgb_matrix_user.inc b/keyboards/handwired/horrortroll/k552/keymaps/default/rgb_matrix_user.inc new file mode 100644 index 0000000000..38edbae993 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/default/rgb_matrix_user.inc @@ -0,0 +1,15 @@ +RGB_MATRIX_EFFECT(CUSTOM_GRADIENT) +RGB_MATRIX_EFFECT(DIAGONAL) +RGB_MATRIX_EFFECT(COOL_DIAGONAL) +RGB_MATRIX_EFFECT(KITT) +RGB_MATRIX_EFFECT(RANDOM_BREATH_RAINBOW) + +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +#include "led/custom_gradient.c" +#include "led/diagonal.c" +#include "led/cool_diagonal.c" +#include "led/kitt.c" +#include "led/random_breath_rainbow.c" + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS \ No newline at end of file diff --git a/keyboards/handwired/horrortroll/k552/keymaps/default/rules.mk b/keyboards/handwired/horrortroll/k552/keymaps/default/rules.mk new file mode 100644 index 0000000000..6245023e80 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/default/rules.mk @@ -0,0 +1 @@ +RGB_MATRIX_CUSTOM_USER = yes diff --git a/keyboards/handwired/horrortroll/k552/keymaps/via/config.h b/keyboards/handwired/horrortroll/k552/keymaps/via/config.h new file mode 100644 index 0000000000..a36ce468bc --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/via/config.h @@ -0,0 +1,19 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +#pragma once + +#define DYNAMIC_KEYMAP_LAYER_COUNT 3 diff --git a/keyboards/handwired/horrortroll/k552/keymaps/via/keymap.c b/keyboards/handwired/horrortroll/k552/keymaps/via/keymap.c new file mode 100644 index 0000000000..641e0e5381 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/via/keymap.c @@ -0,0 +1,98 @@ +/* Copyright 2021 HorrorTroll + * + * 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 QMK_KEYBOARD_H + +#include "keymap_stuff.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* + ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ + │Esc│ │F1 │F2 │F3 │F4 │ │F5 │F6 │F7 │F8 │ │F9 │F10│F11│F12│ │PSc│Scr│Pse│ + └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ + │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Backsp│ │Ins│Hom│PgU│ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ + │ Tab │ q │ w │ e │ r │ t │ y │ u │ i │ o │ p │ [ │ ] │ \ │ │Del│End│PgD│ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ + │ Caps │ a │ s │ d │ f │ g │ h │ j │ k │ l │ ; │ ' │ Enter │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ + │ LShift │ z │ x │ c │ v │ b │ n │ m │ , │ . │ / │ RShift │ │ ↑ │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ + │LCrl│GUI │LAlt│ Space │RAlt│ Fn │ App│RCrl│ │ ← │ ↓ │ → │ + └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ + ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ + │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ │ │ │ │ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ + │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ { │ } │ | │ │ │ │ │ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ + │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ : │ " │ │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ + │ LShift │ Z │ X │ C │ V │ B │ N │ M │ < │ > │ ? │ RShift │ │ │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ + └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + [_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUSE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + [_WAVE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUSE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT + ), + +/* + ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ + │Rst│ │MeP│VoD│VoU│Mut│ │Stp│Prv│Ply│Nxt│ │Mai│Hom│Cal│Sch│ │Rod│Mod│Tog│ + └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ + │ │ │ │ │ │ │ │ │ │ │ │Spd│Spi│ │ │C_E│ │ │ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ + │ │1Hd│1Hi│1Sd│1Si│1Vd│1Vi│ │ │ │ │ │ │ │ │ │ │Wve│ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ + │ │2Hd│2Hi│2Sd│2Si│2Vd│2Vi│ │ │ │ │ │ │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ + │ │ │Pre│Ref│Flp│ │ │ │ │ │ │ │ │Vai│ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ + │ │ │ │ │ │ Fn │ │ │ │Hud│Vad│Hui│ + └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + [_FN] = LAYOUT_tkl_ansi( + RESET, KC_MSEL, KC_VOLD, KC_VOLU, KC_MUTE, KC_MSTP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MAIL, KC_WHOM, KC_CALC, KC_WSCH, RGB_RMOD, RGB_MOD, RGB_TOG, + NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SPD, RGB_SPI, _______, RGB_C_E, _______, _______, + _______, G1_HUD, G1_HUI, G1_SAD, G1_SAI, G1_VAD, G1_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, TG(_WAVE), + _______, G2_HUD, G2_HUI, G2_SAD, G2_SAI, G2_VAD, G2_VAI, _______, _______, _______, _______, _______, _______, + _______, G_PRE, REF_G, G_FLIP, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, + _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_VAD, RGB_HUI + ), +}; diff --git a/keyboards/handwired/horrortroll/k552/keymaps/via/keymap_stuff.h b/keyboards/handwired/horrortroll/k552/keymaps/via/keymap_stuff.h new file mode 100644 index 0000000000..c328e03e00 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/via/keymap_stuff.h @@ -0,0 +1,304 @@ +/* Copyright 2021 HorrorTroll + * + * 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 "rgb_matrix.h" +#include "progmem.h" +#include "config.h" +#include "eeprom.h" +#include +#include + +#include + +#include "oled/oled_stuff.h" + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. + +enum layer_names { + _BASE = 0, + _WAVE = 1, + _FN = 2 +}; + +// For CUSTOM_GRADIENT +HSV gradient_0 = {205, 250, 255}; +HSV gradient_100 = {140, 215, 125}; +bool reflected_gradient = false; +uint8_t gp_i = 0; + +typedef struct { + HSV gradient_0; + HSV gradient_1; + bool reflected; +} CUSTOM_PRESETS; + +enum user_rgb_mode { + RGB_MODE_ALL, + RGB_MODE_NONE, +}; + +typedef union { + uint32_t raw; + struct { + uint8_t rgb_mode :8; + }; +} user_config_t; + +user_config_t user_config; + +enum layer_keycodes { + //Custom Gradient control keycode + G1_HUI = SAFE_RANGE, //Custom gradient color 1 hue increase + G1_HUD, //Custom gradient color 1 hue decrease + G1_SAI, //Custom gradient color 1 saturation increase + G1_SAD, //Custom gradient color 1 saturation decrease + G1_VAI, //Custom gradient color 1 value increase + G1_VAD, //Custom gradient color 1 value decrease + G2_HUI, //Custom gradient color 2 hue increase + G2_HUD, //Custom gradient color 2 hue decrease + G2_SAI, //Custom gradient color 2 saturation increase + G2_SAD, //Custom gradient color 2 saturation decrease + G2_VAI, //Custom gradient color 2 value increase + G2_VAD, //Custom gradient color 2 value decrease + G_PRE, //Gradient presets + REF_G, //Toggle between linear and reflected gradient + G_FLIP, //Flip the gradient colors + + //Custom led effect keycode + RGB_C_E, //Cycle user effect +}; + +void keyboard_post_init_kb(void) { + user_config.raw = eeconfig_read_user(); + switch (user_config.rgb_mode) { + case RGB_MODE_ALL: + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_enable_noeeprom(); + break; + case RGB_MODE_NONE: + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_set_color_all(0, 0, 0); + break; + } +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + process_record_user_oled(keycode, record); + + uint8_t color_adj_step = 5; + + CUSTOM_PRESETS gradient_presets[] = { + {{41 , 255, 255}, {233, 245, 255}, false }, + {{45 , 245, 155}, {160, 255, 80}, false }, + {{173, 245, 40}, {41 , 255, 205}, true }, + {{32 , 255, 165}, {217, 185, 70}, false }, + {{240, 255, 145}, {115, 255, 245}, true }, + {{118, 255, 255}, {242, 255, 255}, false }, + {{212, 0 , 0}, {223, 235, 165}, true }, + {{205, 250, 255}, {140, 215, 125}, false }, + }; + + uint8_t gp_length = sizeof(gradient_presets)/sizeof(gradient_presets[0]); + + switch (keycode) { + case G1_HUI: + if (record->event.pressed) { + gradient_0.h += color_adj_step; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G1_HUD: + if (record->event.pressed) { + gradient_0.h -= color_adj_step; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G1_SAI: + if (record->event.pressed) { + gradient_0.s = (gradient_0.s + color_adj_step * 2 <= 255) ? gradient_0.s + color_adj_step * 2 : 255; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G1_SAD: + if (record->event.pressed) { + gradient_0.s = (gradient_0.s - color_adj_step * 2 >= 0) ? gradient_0.s - color_adj_step * 2 : 0; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G1_VAI: + if (record->event.pressed) { + gradient_0.v = (gradient_0.v + color_adj_step * 2 <= 255) ? gradient_0.v + color_adj_step * 2 : 255; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G1_VAD: + if (record->event.pressed) { + gradient_0.v = (gradient_0.v - color_adj_step * 2 >= 0) ? gradient_0.v - color_adj_step * 2 : 0; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G2_HUI: + if (record->event.pressed) { + gradient_100.h += color_adj_step; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G2_HUD: + if (record->event.pressed) { + gradient_100.h -= color_adj_step; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G2_SAI: + if (record->event.pressed) { + gradient_100.s = (gradient_100.s + color_adj_step * 2 <= 255) ? gradient_100.s + color_adj_step * 2 : 255; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G2_SAD: + if (record->event.pressed) { + gradient_100.s = (gradient_100.s - color_adj_step * 2 >= 0) ? gradient_100.s - color_adj_step * 2 : 0; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G2_VAI: + if (record->event.pressed) { + gradient_100.v = (gradient_100.v + color_adj_step * 2 <= 255) ? gradient_100.v + color_adj_step * 2 : 255; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G2_VAD: + if (record->event.pressed) { + gradient_100.v = (gradient_100.v - color_adj_step * 2 >= 0) ? gradient_100.v - color_adj_step * 2 : 0; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G_PRE: + if (record->event.pressed) { + gp_i = (gp_i + gp_length ) % gp_length; + + gradient_0 = gradient_presets[gp_i].gradient_0; + gradient_100 = gradient_presets[gp_i].gradient_1; + reflected_gradient = gradient_presets[gp_i].reflected; + + gp_i += 1; + } + return false; + case REF_G: + if (record->event.pressed) { + reflected_gradient = !reflected_gradient; + } + return false; + case G_FLIP: + if (record->event.pressed) { + HSV temp_color = gradient_0; + gradient_0 = gradient_100; + gradient_100 = temp_color; + } + return false; + case RGB_C_E: + if (record->event.pressed) { + switch (rgb_matrix_get_mode()) { + case RGB_MATRIX_CUSTOM_CUSTOM_GRADIENT: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_DIAGONAL); + return false; + case RGB_MATRIX_CUSTOM_DIAGONAL: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_COOL_DIAGONAL); + return false; + case RGB_MATRIX_CUSTOM_COOL_DIAGONAL: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_KITT); + return false; + case RGB_MATRIX_CUSTOM_KITT: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_RANDOM_BREATH_RAINBOW); + return false; + default: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_CUSTOM_GRADIENT); + return false; + } + } + return false; + case RGB_TOG: + if (record->event.pressed) { + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_set_color_all(0, 0, 0); + user_config.rgb_mode = RGB_MODE_NONE; + } + break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_enable_noeeprom(); + user_config.rgb_mode = RGB_MODE_ALL; + } + break; + } + eeconfig_update_user(user_config.raw); + } + return false; + } + return true; +} + +void rgb_matrix_indicators_user(void) { + uint8_t side_leds_left[3] = {17, 18, 19}; + uint8_t side_leds_right[3] = { 4, 5, 6}; + HSV hsv = rgb_matrix_config.hsv; + uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1)); + hsv.h = time; + RGB rgb = hsv_to_rgb(hsv); + + if ((rgb_matrix_get_flags() & LED_FLAG_ALL)) { + if (host_keyboard_led_state().caps_lock) { + for (uint8_t i = 0; i < 3; i++) + { + rgb_matrix_set_color(side_leds_left[i], rgb.r, rgb.g, rgb.b); + } + } + if (host_keyboard_led_state().scroll_lock) { + for (uint8_t i = 0; i < 3; i++) + { + rgb_matrix_set_color(side_leds_right[i], rgb.r, rgb.g, rgb.b); + } + } + } else { + if (host_keyboard_led_state().caps_lock) { + for (uint8_t i = 0; i < 3; i++) + { + rgb_matrix_set_color(side_leds_left[i], rgb.r, rgb.g, rgb.b); + } + } else { + for (uint8_t i = 0; i < 3; i++) + { + rgb_matrix_set_color(side_leds_left[i], 0, 0, 0); + } + } + if (host_keyboard_led_state().scroll_lock) { + for (uint8_t i = 0; i < 3; i++) + { + rgb_matrix_set_color(side_leds_right[i], rgb.r, rgb.g, rgb.b); + } + } else { + for (uint8_t i = 0; i < 3; i++) + { + rgb_matrix_set_color(side_leds_right[i], 0, 0, 0); + } + } + } +} diff --git a/keyboards/handwired/horrortroll/k552/keymaps/via/led/cool_diagonal.c b/keyboards/handwired/horrortroll/k552/keymaps/via/led/cool_diagonal.c new file mode 100644 index 0000000000..2c518a5431 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/via/led/cool_diagonal.c @@ -0,0 +1,22 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +static HSV COOL_DIAGONAL_math(HSV hsv, uint8_t i, uint8_t time) { + hsv.h = (g_led_config.point[i].x / 4) - g_led_config.point[i].y - time; + return hsv; +} + +bool COOL_DIAGONAL(effect_params_t* params) { return effect_runner_i(params, &COOL_DIAGONAL_math); } \ No newline at end of file diff --git a/keyboards/handwired/horrortroll/k552/keymaps/via/led/custom_gradient.c b/keyboards/handwired/horrortroll/k552/keymaps/via/led/custom_gradient.c new file mode 100644 index 0000000000..49e4a242fb --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/via/led/custom_gradient.c @@ -0,0 +1,74 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +extern HSV gradient_0; +extern HSV gradient_100; +extern bool reflected_gradient; + +static HSV INTERPOLATE_HSV(float step, HSV gradient_0, HSV gradient_100) { + uint8_t cw, ccw; + HSV color; + + cw = (gradient_0.h >= gradient_100.h) ? 255 + gradient_100.h - gradient_0.h : gradient_100.h - gradient_0.h; // Hue range is 0 to 255. + ccw = (gradient_0.h >= gradient_100.h) ? gradient_0.h - gradient_100.h : 255 + gradient_0.h - gradient_100.h; + + if( cw < ccw ) { // going clockwise + color.h = gradient_0.h + (uint8_t)(step * cw); + } else { // Going counter clockwise + color.h = gradient_0.h - (uint8_t)(step * ccw); + } + + color.s = gradient_0.s + step * (gradient_100.s - gradient_0.s); + + // Scale V with global RGB Matrix's V, so users can still control overall brightness with RGB_VAI & RGB_VAD0 + color.v = round((gradient_0.v + step * (gradient_100.v - gradient_0.v)) * ((float)rgb_matrix_config.hsv.v / 255)); + + return color; +} + +static HSV CUSTOM_GRADIENT_math(uint8_t led_x, uint8_t min_x, uint8_t max_x) { + float step = (float)led_x / (max_x - min_x); + float mid_gradient_pos = 0.5; + + if( reflected_gradient ) { + if( step <= mid_gradient_pos ) { + return INTERPOLATE_HSV(step * (1/mid_gradient_pos), gradient_0, gradient_100); + } else { + return INTERPOLATE_HSV((step - mid_gradient_pos) * (1/(1-mid_gradient_pos)), gradient_100, gradient_0); + } + + } else { + return INTERPOLATE_HSV(step, gradient_0, gradient_100); + } +} + +static bool CUSTOM_GRADIENT(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint8_t min_x = 0; // X coordinate of the left-most LED + uint8_t max_x = 224; // X coordinate of the right-most LED + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + HSV hsv_orig = CUSTOM_GRADIENT_math(g_led_config.point[i].x, min_x, max_x); + RGB rgb = hsv_to_rgb(hsv_orig); + + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + + return led_max < DRIVER_LED_TOTAL; +} diff --git a/keyboards/handwired/horrortroll/k552/keymaps/via/led/diagonal.c b/keyboards/handwired/horrortroll/k552/keymaps/via/led/diagonal.c new file mode 100644 index 0000000000..19e3791bd6 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/via/led/diagonal.c @@ -0,0 +1,22 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +static HSV DIAGONAL_math(HSV hsv, uint8_t i, uint8_t time) { + hsv.h = g_led_config.point[i].x - g_led_config.point[i].y - time; + return hsv; +} + +bool DIAGONAL(effect_params_t* params) { return effect_runner_i(params, &DIAGONAL_math); } diff --git a/keyboards/handwired/horrortroll/k552/keymaps/via/led/kitt.c b/keyboards/handwired/horrortroll/k552/keymaps/via/led/kitt.c new file mode 100644 index 0000000000..823eb5839b --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/via/led/kitt.c @@ -0,0 +1,68 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +// variable for startup animation +bool BASE_EFFECT_NOT_STARTED_YET = true; +uint8_t base_effect_startup_counter = 255; + +uint8_t led_count = 10; +uint8_t led_first = 7; + +static uint8_t time_to_led(uint8_t time, uint8_t led_behind) { + uint16_t led_time = led_count * time; + uint16_t step = ((2 * led_count + (led_time / 128)) - led_behind) % (2 * led_count); + uint8_t led; + + if (step < led_count) { + led = step; + } else { + led = led_count - 1 - (step - led_count); + } + + return led; +} + +static HSV KITT_math(HSV hsv, uint8_t i, uint8_t time) { + + // reset base effect startup + if (i == 0) { + BASE_EFFECT_NOT_STARTED_YET = true; + } + + hsv.h = 0; + hsv.s = 255; + + if (i >= led_first && i < led_first + led_count) { + uint8_t j = i - led_first; + if (j == time_to_led(time, 0)) { + hsv.v = hsv.v; + } else if (j == time_to_led(time, 1)) { + hsv.v = hsv.v/2; + } else if (j == time_to_led(time, 2)) { + hsv.v = hsv.v/4; + } else if (j == time_to_led(time, 3)) { + hsv.v = hsv.v/8; + } else { + hsv.v = 0; + } + } else { + hsv.v = 0; + } + + return hsv; +} + +bool KITT(effect_params_t* params) { return effect_runner_i(params, &KITT_math); } diff --git a/keyboards/handwired/horrortroll/k552/keymaps/via/led/random_breath_rainbow.c b/keyboards/handwired/horrortroll/k552/keymaps/via/led/random_breath_rainbow.c new file mode 100644 index 0000000000..041417477b --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/via/led/random_breath_rainbow.c @@ -0,0 +1,55 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +static uint8_t offset[DRIVER_LED_TOTAL]; + +static void doRandom_breath_rainbow(int i, effect_params_t* params) { + if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; + uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 6); + + if (rand() * 50 == 1) { + if (rand() * 2 == 1) { + offset[i]++; + } + else { + offset[i]--; + } + } + + //float val = (((float)sin8(time + offset[i]) / 256)/2.1) + .05; + HSV hsv = {0, 255, 255}; + hsv.h = scale16by8(g_rgb_timer + offset[i], rgb_matrix_config.speed / 4) + (offset[i]*2); + hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); + RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); +} + +bool RANDOM_BREATH_RAINBOW(effect_params_t* params) { + + if (!params->init) { + // Change one LED every tick, make sure speed is not 0 + doRandom_breath_rainbow(rand() % DRIVER_LED_TOTAL, params); + return false; + } + + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + for (uint8_t i = led_min; i < led_max; i++) { + doRandom_breath_rainbow(i, params); + } + + return led_max < DRIVER_LED_TOTAL; +} diff --git a/keyboards/handwired/horrortroll/k552/keymaps/via/oled/oled_stuff.h b/keyboards/handwired/horrortroll/k552/keymaps/via/oled/oled_stuff.h new file mode 100644 index 0000000000..9d8d629179 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/via/oled/oled_stuff.h @@ -0,0 +1,69 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +// OLED animation +#include "lib/bongocat.c" +#include "lib/galaxy.c" +#include "lib/wave.c" + +#ifdef OLED_ENABLE + bool oled_task_user(void) { + led_t led_usb_state = host_keyboard_led_state(); + static uint8_t old_layer; + uint8_t layer = get_highest_layer(layer_state | default_layer_state); + + if (layer != old_layer) { + oled_clear(); + } + + old_layer = layer; + + switch (layer) { + case 0: + render_bongocat(); + oled_set_cursor(14, 0); // sets cursor to (column, row) using charactar spacing (4 rows on 128x32 screen, anything more will overflow back to the top) + oled_write_P(PSTR("WPM:"), false); + oled_write(get_u8_str(get_current_wpm(), '0'), false); // writes wpm on top right corner of string + oled_set_cursor(17, 2); + oled_write_P(led_usb_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false); + oled_set_cursor(17, 3); + oled_write_P(led_usb_state.scroll_lock ? PSTR("SCRL") : PSTR(" "), false); + break; + case 1: + // sleep if it has been long enough since we last got a char + if (timer_elapsed32(wave_sleep) > OLED_TIMEOUT) { + oled_off(); + } else { + oled_on(); + } + // time for the next frame? + if (timer_elapsed(wave_timer) > FRAME_TIMEOUT) { + wave_timer = timer_read(); + render_frame(); + } + + oled_set_cursor(0, 3); + oled_write_P(led_usb_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false); + oled_set_cursor(17, 3); + oled_write_P(led_usb_state.scroll_lock ? PSTR("SCRL") : PSTR(" "), false); + break; + case 2: + render_galaxy(); + break; + } + return false; + } +#endif diff --git a/keyboards/handwired/horrortroll/k552/keymaps/via/readme.md b/keyboards/handwired/horrortroll/k552/keymaps/via/readme.md new file mode 100644 index 0000000000..c8f9c1f8ec --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/via/readme.md @@ -0,0 +1,16 @@ +# Default layout and custom LED / OLED + +Keymap is default 87 qwerty, TKL layout + +It have new LED effect: +- Custom gradient (ported from SirTimmyTimbit code [https://github.com/SirTimmyTimbit/customizable-gradient-effect-for-drop-alt]) +- Diagonal (ported from pleasuretek code [https://github.com/pleasuretek/qmk_firmware]) +- Cool diagonal (ported from pleasuretek code [https://github.com/pleasuretek/qmk_firmware]) +- Knight Rider (ported from jumper149 code [https://github.com/jumper149/qmk_firmware/blob/jumper149/keyboards/dztech/dz65rgb/keymaps/jumper149/]) +- Random breath rainbow (based from daed code [https://github.com/daed/qmk_firmware/blob/master/keyboards/massdrop/alt/keymaps/daed] and modify by me) + +And OLED Animation: +- Bongo Cat (ported from nwii code [https://github.com/nwii/oledbongocat] and modify image animation by me) +- Waveform Typing (ported from drcforbin code [https://github.com/drcforbin/keyboards] and modify to correct my TKL layout) +- Galaxy image when pressing FN key (original image [https://www.deviantart.com/rock-bomber/art/Gateway-668850827] and redraw then cut for 128x32 size by me) +- Redragon Logo when booting up diff --git a/keyboards/handwired/horrortroll/k552/keymaps/via/rgb_matrix_user.inc b/keyboards/handwired/horrortroll/k552/keymaps/via/rgb_matrix_user.inc new file mode 100644 index 0000000000..38edbae993 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/via/rgb_matrix_user.inc @@ -0,0 +1,15 @@ +RGB_MATRIX_EFFECT(CUSTOM_GRADIENT) +RGB_MATRIX_EFFECT(DIAGONAL) +RGB_MATRIX_EFFECT(COOL_DIAGONAL) +RGB_MATRIX_EFFECT(KITT) +RGB_MATRIX_EFFECT(RANDOM_BREATH_RAINBOW) + +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +#include "led/custom_gradient.c" +#include "led/diagonal.c" +#include "led/cool_diagonal.c" +#include "led/kitt.c" +#include "led/random_breath_rainbow.c" + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS \ No newline at end of file diff --git a/keyboards/handwired/horrortroll/k552/keymaps/via/rules.mk b/keyboards/handwired/horrortroll/k552/keymaps/via/rules.mk new file mode 100644 index 0000000000..d475530c87 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/keymaps/via/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +RGB_MATRIX_CUSTOM_USER = yes diff --git a/keyboards/handwired/horrortroll/k552/ld/k552_f103.ld b/keyboards/handwired/horrortroll/k552/ld/k552_f103.ld new file mode 100644 index 0000000000..7b9e75b3c7 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/ld/k552_f103.ld @@ -0,0 +1,85 @@ +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* + * STM32F103xC memory setup for use with the K552 mass-storage device bootloader. + */ +MEMORY +{ + flash0 : org = 0x08002000, len = 256k - 0x2000 + flash1 : org = 0x00000000, len = 0 + flash2 : org = 0x00000000, len = 0 + flash3 : org = 0x00000000, len = 0 + flash4 : org = 0x00000000, len = 0 + flash5 : org = 0x00000000, len = 0 + flash6 : org = 0x00000000, len = 0 + flash7 : org = 0x00000000, len = 0 + ram0 : org = 0x20000000, len = 48k + ram1 : org = 0x00000000, len = 0 + ram2 : org = 0x00000000, len = 0 + ram3 : org = 0x00000000, len = 0 + ram4 : org = 0x00000000, len = 0 + ram5 : org = 0x00000000, len = 0 + ram6 : org = 0x00000000, len = 0 + ram7 : org = 0x00000000, len = 0 +} + +/* For each data/text section two region are defined, a virtual region + and a load region (_LMA suffix).*/ + +/* Flash region to be used for exception vectors.*/ +REGION_ALIAS("VECTORS_FLASH", flash0); +REGION_ALIAS("VECTORS_FLASH_LMA", flash0); + +/* Flash region to be used for constructors and destructors.*/ +REGION_ALIAS("XTORS_FLASH", flash0); +REGION_ALIAS("XTORS_FLASH_LMA", flash0); + +/* Flash region to be used for code text.*/ +REGION_ALIAS("TEXT_FLASH", flash0); +REGION_ALIAS("TEXT_FLASH_LMA", flash0); + +/* Flash region to be used for read only data.*/ +REGION_ALIAS("RODATA_FLASH", flash0); +REGION_ALIAS("RODATA_FLASH_LMA", flash0); + +/* Flash region to be used for various.*/ +REGION_ALIAS("VARIOUS_FLASH", flash0); +REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); + +/* Flash region to be used for RAM(n) initialization data.*/ +REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); + +/* RAM region to be used for Main stack. This stack accommodates the processing + of all exceptions and interrupts.*/ +REGION_ALIAS("MAIN_STACK_RAM", ram0); + +/* RAM region to be used for the process stack. This is the stack used by + the main() function.*/ +REGION_ALIAS("PROCESS_STACK_RAM", ram0); + +/* RAM region to be used for data segment.*/ +REGION_ALIAS("DATA_RAM", ram0); +REGION_ALIAS("DATA_RAM_LMA", flash0); + +/* RAM region to be used for BSS segment.*/ +REGION_ALIAS("BSS_RAM", ram0); + +/* RAM region to be used for the default heap.*/ +REGION_ALIAS("HEAP_RAM", ram0); + +/* Generic rules inclusion.*/ +INCLUDE rules.ld diff --git a/keyboards/handwired/horrortroll/k552/lib/bongocat.c b/keyboards/handwired/horrortroll/k552/lib/bongocat.c new file mode 100644 index 0000000000..fbde9c911a --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/lib/bongocat.c @@ -0,0 +1,376 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +// WPM-responsive animation stuff here +# define IDLE_FRAMES 5 +# define IDLE_SPEED 10 // below this wpm value your animation will idle +// #define PREP_FRAMES 1 // uncomment if >1 +# define TAP_FRAMES 2 +# define ANIM_WPM_LOWER 20 // above this wpm value typing animation to trigger +# define ANIM_FRAME_DURATION_MAX 450 // longest animation duration in ms +# define ANIM_FRAME_DURATION_MIN 100 // shortest animation duration in ms +# define IDLE_FRAME_DURATION 300 // how long each frame lasts in ms +# define ANIM_FRAME_RATIO 2.5 // how aggressively animation speeds up with wpm +// #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing +# define ANIM_SIZE 636 // number of bytes in array, minimize for adequate firmware size, max is 1024 +# define MAX(x, y) (((x) > (y)) ? (x) : (y)) // Math.max macro + +uint32_t curr_anim_duration = 0; // variable animation duration +uint32_t bongo_timer = 0; +uint32_t bongo_sleep = 0; +uint8_t current_idle_frame = 0; +// uint8_t current_prep_frame = 0; // uncomment if PREP_FRAMES >1 +uint8_t current_tap_frame = 0; + +// Code containing pixel art, contains: +// 5 idle frames, 1 prep frame, and 2 tap frames + +// To make your own pixel art: +// save a png/jpeg of an 128x32 image (resource: https://www.pixilart.com/draw ) +// follow this guide up to and including "CONVERT YOUR IMAGE" https://docs.splitkb.com/hc/en-us/articles/360013811280-How-do-I-convert-an-image-for-use-on-an-OLED-display- +// replace numbers in brackets with your own +// if you start getting errors when compiling make sure you didn't accedentally delete a bracket +static void render_bongocat(void) { + static const char PROGMEM idle[IDLE_FRAMES][ANIM_SIZE] = { + { + //Idle 1 - 128x32 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xce, 0x9c, 0xf8, 0xfc, 0xfe, 0x80, 0xe0, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xc0, 0xc0, 0xe0, 0xe0, 0xf0, + 0xf8, 0xfc, 0xfe, 0xff, 0xfe, 0xfc, 0xf8, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0xc0, 0xc0, 0x80, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x38, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x31, 0x00, 0x08, + 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, + 0xc0, 0xe0, 0xf0, 0xf8, 0xf8, 0xfc, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xcf, 0xff, + 0xff, 0xbf, 0x7f, 0x7f, 0xbf, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xfe, 0xfe, 0xfc, 0xfc, 0xfc, 0xfc, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0f, 0x0f, 0x0f, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x30, 0x38, 0x2c, 0x04, 0x64, 0xf8, 0xfe, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x7f, 0xbf, 0x8f, 0x27, 0x27, 0x27, 0xc7, 0xc7, 0x4f, 0x4f, 0x8f, 0x8f, + 0x9f, 0x9f, 0x1f, 0x1f, 0x3f, 0x3e, 0x3e, 0x3f, 0x7f, 0x7f, 0x7f, 0x7f, 0xfc, 0xfc, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xf8, 0xe0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x60, 0x30, 0x10, 0x18, 0x08, 0x08, 0x08, 0x18, 0x10, 0x30, + 0x60, 0x40, 0xc0, 0x86, 0x87, 0x85, 0xc4, 0x49, 0x69, 0x3e, 0x0e, 0x13, 0x11, 0x12, 0x12, 0x3d, + 0x2d, 0x25, 0x26, 0x44, 0x68, 0x78, 0x58, 0x9d, 0x97, 0x93, 0xe3, 0x62, 0x34, 0x3c, 0x2c, 0x26, + 0xc7, 0xc5, 0x69, 0x39, 0x19, 0x1d, 0x36, 0xa2, 0xe2, 0x62, 0x24, 0x18, 0x3c, 0x7e, 0x7f, 0x7f, + 0x7f, 0xbf, 0x3f, 0x1f, 0x1f, 0x8f, 0xe7, 0x63, 0x27, 0x27, 0x47, 0x47, 0xcf, 0xcf, 0x0f, 0x08, + 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + { + //Idle 2 - 128x32 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xce, 0x9c, 0xf8, 0xfc, 0xfe, 0x80, 0xe0, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xc0, 0xe0, 0xf0, + 0xf8, 0xfc, 0xfe, 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0xc0, 0xc0, 0x80, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x38, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x31, 0x00, 0x08, + 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, + 0xc0, 0xe0, 0xe0, 0xf0, 0xf0, 0xf8, 0xf8, 0xfc, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0x9f, 0x9f, 0xff, + 0xff, 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xfe, 0xfe, 0xfc, 0xfc, 0xfc, 0xfc, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0f, 0x0f, 0x0f, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x30, 0x38, 0x2c, 0x04, 0x64, 0xf8, 0xfe, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x7f, 0xbf, 0x8f, 0x27, 0x27, 0x27, 0xc7, 0xc7, 0x4f, 0x4f, 0x8f, 0x8f, + 0x9f, 0x9f, 0x1e, 0x1e, 0x3f, 0x3d, 0x3d, 0x3e, 0x7f, 0x7f, 0x7f, 0x7f, 0xf9, 0xf9, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xf0, 0xc0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x60, 0x30, 0x10, 0x18, 0x08, 0x08, 0x08, 0x18, 0x10, 0x30, + 0x60, 0x40, 0xc0, 0x86, 0x87, 0x85, 0xc4, 0x49, 0x69, 0x3e, 0x0e, 0x13, 0x11, 0x12, 0x12, 0x3d, + 0x2d, 0x25, 0x26, 0x44, 0x68, 0x78, 0x58, 0x9d, 0x97, 0x93, 0xe3, 0x62, 0x34, 0x3c, 0x2c, 0x26, + 0xc7, 0xc5, 0x69, 0x39, 0x19, 0x1d, 0x36, 0xa2, 0xe2, 0x62, 0x24, 0x18, 0x3c, 0x7e, 0x7f, 0x7f, + 0x7f, 0xbf, 0x3f, 0x1f, 0x1f, 0x8f, 0xe7, 0x63, 0x27, 0x27, 0x47, 0x47, 0xcf, 0xcf, 0x0f, 0x08, + 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + { + //Idle 3 - 128x32 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xce, 0x9c, 0xf8, 0xfc, 0xfe, 0x80, 0xe0, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xc0, 0xe0, + 0xf0, 0xf8, 0xfc, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x38, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x31, 0x00, 0x08, + 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, + 0xc0, 0xe0, 0xe0, 0xf0, 0xf0, 0xf8, 0xf8, 0xfc, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0x9f, 0x9f, 0xff, + 0xff, 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xfe, 0xfc, 0xfc, 0xf8, 0xf8, 0xf8, 0xf8, 0xfc, 0xfc, 0xfe, 0xfe, 0xfe, 0x7e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0f, 0x0f, 0x0f, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x30, 0x38, 0x2c, 0x04, 0x64, 0xf8, 0xfe, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x7f, 0xbf, 0x8f, 0x27, 0x27, 0x27, 0xc7, 0xc7, 0x4f, 0x4f, 0x8f, 0x8f, + 0x9f, 0x9f, 0x1e, 0x1e, 0x3f, 0x3d, 0x3d, 0x3e, 0x7f, 0x7f, 0x7f, 0x7f, 0xf9, 0xf9, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xf0, 0xc0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x60, 0x30, 0x10, 0x18, 0x08, 0x08, 0x08, 0x18, 0x10, 0x30, + 0x60, 0x40, 0xc0, 0x86, 0x87, 0x85, 0xc4, 0x49, 0x69, 0x3e, 0x0e, 0x13, 0x11, 0x12, 0x12, 0x3d, + 0x2d, 0x25, 0x26, 0x44, 0x68, 0x78, 0x58, 0x9d, 0x97, 0x93, 0xe3, 0x62, 0x34, 0x3c, 0x2c, 0x26, + 0xc7, 0xc5, 0x69, 0x39, 0x19, 0x1d, 0x36, 0xa2, 0xe2, 0x62, 0x24, 0x18, 0x3c, 0x7e, 0x7f, 0x7f, + 0x7f, 0xbf, 0x3f, 0x1f, 0x1f, 0x8f, 0xe7, 0x63, 0x27, 0x27, 0x47, 0x47, 0xcf, 0xcf, 0x0f, 0x08, + 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + { + //Idle 4 - 128x32 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xce, 0x9c, 0xf8, 0xfc, 0xfe, 0x80, 0xe0, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xc0, 0xe0, + 0xf0, 0xf8, 0xfc, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x38, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x31, 0x00, 0x08, + 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, + 0xc0, 0xe0, 0xf0, 0xf8, 0xf8, 0xfc, 0xfc, 0xfc, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xcf, 0xcf, 0xff, + 0xff, 0xbf, 0x7f, 0x7f, 0xbf, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xfe, 0xfc, 0xfc, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xfc, 0xfc, 0xfc, 0xfc, 0x3c, 0x1c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0f, 0x0f, 0x0f, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x30, 0x38, 0x2c, 0x04, 0x64, 0xf8, 0xfe, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x7f, 0xbf, 0x8f, 0x27, 0x27, 0x27, 0xc7, 0xc7, 0x4f, 0x4f, 0x8f, 0x8f, + 0x9f, 0x9f, 0x1f, 0x1f, 0x3f, 0x3e, 0x3e, 0x3f, 0x7f, 0x7f, 0x7f, 0x7f, 0xfc, 0xfc, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xf8, 0xe0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x60, 0x30, 0x10, 0x18, 0x08, 0x08, 0x08, 0x18, 0x10, 0x30, + 0x60, 0x40, 0xc0, 0x86, 0x87, 0x85, 0xc4, 0x49, 0x69, 0x3e, 0x0e, 0x13, 0x11, 0x12, 0x12, 0x3d, + 0x2d, 0x25, 0x26, 0x44, 0x68, 0x78, 0x58, 0x9d, 0x97, 0x93, 0xe3, 0x62, 0x34, 0x3c, 0x2c, 0x26, + 0xc7, 0xc5, 0x69, 0x39, 0x19, 0x1d, 0x36, 0xa2, 0xe2, 0x62, 0x24, 0x18, 0x3c, 0x7e, 0x7f, 0x7f, + 0x7f, 0xbf, 0x3f, 0x1f, 0x1f, 0x8f, 0xe7, 0x63, 0x27, 0x27, 0x47, 0x47, 0xcf, 0xcf, 0x0f, 0x08, + 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + { + //Idle 5 - 128x32 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xce, 0x9c, 0xf8, 0xfc, 0xfe, 0x80, 0xe0, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xc0, 0xc0, 0xe0, 0xe0, 0xf0, + 0xf8, 0xfc, 0xfe, 0xff, 0xfe, 0xfc, 0xf8, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0xc0, 0xc0, 0x80, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x38, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x31, 0x00, 0x08, + 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, + 0xc0, 0xe0, 0xf0, 0xf8, 0xf8, 0xfc, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xcf, 0xff, + 0xff, 0xbf, 0x7f, 0x7f, 0xbf, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xfe, 0xfe, 0xfc, 0xfc, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x0f, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0f, 0x0f, 0x0f, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x30, 0x38, 0x2c, 0x04, 0x64, 0xf8, 0xfe, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x7f, 0xbf, 0x8f, 0x27, 0x27, 0x27, 0xc7, 0xc7, 0x4f, 0x4f, 0x8f, 0x8f, + 0x9f, 0x9f, 0x1f, 0x1f, 0x3f, 0x3e, 0x3e, 0x3f, 0x7f, 0x7f, 0x7f, 0x7f, 0xfc, 0xfc, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xf8, 0xe0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x60, 0x30, 0x10, 0x18, 0x08, 0x08, 0x08, 0x18, 0x10, 0x30, + 0x60, 0x40, 0xc0, 0x86, 0x87, 0x85, 0xc4, 0x49, 0x69, 0x3e, 0x0e, 0x13, 0x11, 0x12, 0x12, 0x3d, + 0x2d, 0x25, 0x26, 0x44, 0x68, 0x78, 0x58, 0x9d, 0x97, 0x93, 0xe3, 0x62, 0x34, 0x3c, 0x2c, 0x26, + 0xc7, 0xc5, 0x69, 0x39, 0x19, 0x1d, 0x36, 0xa2, 0xe2, 0x62, 0x24, 0x18, 0x3c, 0x7e, 0x7f, 0x7f, + 0x7f, 0xbf, 0x3f, 0x1f, 0x1f, 0x8f, 0xe7, 0x63, 0x27, 0x27, 0x47, 0x47, 0xcf, 0xcf, 0x0f, 0x08, + 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + } + }; + + static const char PROGMEM prep[][ANIM_SIZE] = { + { + //Prepare - 128x32 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xce, 0x9c, 0xf8, 0xfc, 0xfe, 0x80, 0xe0, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xc0, 0xc0, 0xe0, 0xe0, 0xf0, + 0xf0, 0xf8, 0xfc, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xe0, 0xc0, 0xc0, 0x80, 0x80, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x38, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x31, 0x00, 0x08, + 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0xf0, 0xf8, + 0xdc, 0x36, 0x3e, 0xee, 0xfc, 0xe0, 0x9c, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xcf, 0xff, + 0xff, 0xbf, 0x7f, 0x7f, 0xbf, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x7e, 0xbe, 0xbc, 0xbc, 0x7c, 0xfc, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0f, 0x0f, 0x0f, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x30, 0x38, 0x2c, 0x44, 0xc4, 0xc4, 0x68, 0x78, + 0x59, 0x89, 0x91, 0x91, 0xd3, 0xf3, 0xa3, 0x23, 0x27, 0x27, 0xc7, 0xc7, 0x4f, 0x4f, 0x8f, 0x8f, + 0x9f, 0x9f, 0x1f, 0x1f, 0x3f, 0x3e, 0x3e, 0x3f, 0x7f, 0x7f, 0x7f, 0x7f, 0xfc, 0xfc, 0xff, 0x81, + 0xfa, 0xff, 0xe6, 0xe7, 0xfd, 0xff, 0xfc, 0xf3, 0xff, 0xff, 0xff, 0xfe, 0xf8, 0xe0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x60, 0x30, 0x10, 0x18, 0x08, 0x08, 0x08, 0x18, 0x10, 0x30, + 0x60, 0x40, 0xc0, 0x86, 0x87, 0x85, 0xc4, 0x49, 0x69, 0x3e, 0x0e, 0x13, 0x11, 0x13, 0x12, 0x3c, + 0x2c, 0x26, 0x27, 0x45, 0x68, 0x78, 0x58, 0x9d, 0x97, 0x93, 0xe3, 0x62, 0x34, 0x3c, 0x2c, 0x26, + 0xc7, 0xc5, 0x69, 0x39, 0x19, 0x1d, 0x36, 0xa2, 0xe2, 0x62, 0x34, 0x3c, 0x2c, 0x44, 0xc8, 0xc8, + 0xe9, 0xb9, 0x11, 0x11, 0x13, 0x93, 0xe3, 0x63, 0x27, 0x27, 0x47, 0x47, 0xcf, 0xcf, 0x0f, 0x08, + 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + } + }; + + static const char PROGMEM tap[TAP_FRAMES][ANIM_SIZE] = { + { + //Tap left - 128x32 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xce, 0x9c, 0xf8, 0xfc, 0xfe, 0x80, 0xe0, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xc0, 0xc0, 0xe0, 0xe0, 0xf0, + 0xf0, 0xf8, 0xfc, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xe0, 0xc0, 0xc0, 0x80, 0x80, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x38, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x31, 0x00, 0x08, + 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0xf0, 0xf8, + 0xdc, 0x36, 0x3e, 0xee, 0xfc, 0xe0, 0x9c, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xcf, 0xff, + 0xff, 0xbf, 0x7f, 0x7f, 0xbf, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xfe, 0xfe, 0xfc, 0xfc, 0xfc, 0xfc, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0f, 0x0f, 0x0f, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x30, 0x38, 0x2c, 0x44, 0xc4, 0xc4, 0x68, 0x78, + 0x59, 0x89, 0x91, 0x91, 0xd3, 0xf3, 0xa3, 0x23, 0x27, 0x27, 0xc7, 0xc7, 0x4f, 0x4f, 0x8f, 0x8f, + 0x9f, 0x9f, 0x1f, 0x1f, 0x3f, 0x3e, 0x3e, 0x3f, 0x7f, 0x7f, 0x7f, 0x7f, 0xfc, 0xfc, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xf8, 0xe0, 0x00, 0x00, + 0x3f, 0x1f, 0x07, 0x83, 0xc0, 0xe0, 0xe0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x60, 0x30, 0x10, 0x18, 0x08, 0x08, 0x08, 0x18, 0x10, 0x30, + 0x60, 0x40, 0xc0, 0x86, 0x87, 0x85, 0xc4, 0x49, 0x69, 0x3e, 0x0e, 0x13, 0x11, 0x13, 0x12, 0x3c, + 0x2c, 0x26, 0x27, 0x45, 0x68, 0x78, 0x58, 0x9d, 0x97, 0x93, 0xe3, 0x62, 0x34, 0x3c, 0x2c, 0x26, + 0xc7, 0xc5, 0x69, 0x39, 0x19, 0x1d, 0x36, 0xa2, 0xe2, 0x62, 0x24, 0x18, 0x3c, 0x7e, 0x7f, 0x7f, + 0x7f, 0xbf, 0x3f, 0x1f, 0x1f, 0x8f, 0xe7, 0x63, 0x27, 0x27, 0x47, 0x47, 0xcf, 0xcf, 0x0f, 0x08, + 0x10, 0x10, 0x11, 0x11, 0x21, 0x23, 0x23, 0x21, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + { + //Tap right - 128x32 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xce, 0x9c, 0xf8, 0xfc, 0xfe, 0x80, 0xe0, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xc0, 0xc0, 0xe0, 0xe0, 0xf0, + 0xf0, 0xf8, 0xfc, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xe0, 0xc0, 0xc0, 0x80, 0x80, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x38, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x31, 0x00, 0x08, + 0x10, 0x10, 0x10, 0x10, 0xa0, 0xa0, 0x20, 0x20, 0x40, 0x46, 0x4f, 0x5f, 0x9f, 0x9c, 0x90, 0x80, + 0xc0, 0xe0, 0xf0, 0xf8, 0xf8, 0xfc, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xcf, 0xff, + 0xff, 0xbf, 0x7f, 0x7f, 0xbf, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x7e, 0xbe, 0xbc, 0xbc, 0x7c, 0xfc, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0f, 0x0f, 0x0f, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x07, 0x0f, 0x8f, 0xc7, 0xe3, 0x31, 0x38, 0x2c, 0x04, 0x64, 0xf8, 0xfe, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x7f, 0xbf, 0x8f, 0x27, 0x27, 0x27, 0xc7, 0xc7, 0x4f, 0x4f, 0x8f, 0x8f, + 0x9f, 0x9f, 0x1f, 0x1f, 0x3f, 0x3e, 0x3e, 0x3f, 0x7f, 0x7f, 0x7f, 0x7f, 0xfc, 0xfc, 0xff, 0x81, + 0xfa, 0xff, 0xe6, 0xe7, 0xfd, 0xff, 0xfc, 0xf3, 0xff, 0xff, 0xff, 0xfe, 0xf8, 0xe0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x60, 0x30, 0x10, 0x18, 0x08, 0x08, 0x08, 0x18, 0x10, 0x30, + 0x60, 0x40, 0xc0, 0x86, 0x87, 0x85, 0xc4, 0x49, 0x69, 0x3e, 0x0e, 0x13, 0x11, 0x12, 0x12, 0x3d, + 0x2d, 0x25, 0x26, 0x44, 0x68, 0x78, 0x58, 0x9d, 0x97, 0x93, 0xe3, 0x62, 0x34, 0x3c, 0x2c, 0x26, + 0xc7, 0xc5, 0x69, 0x39, 0x19, 0x1d, 0x36, 0xa2, 0xe2, 0x62, 0x34, 0x3c, 0x2c, 0x44, 0xc8, 0xc8, + 0xe9, 0xb9, 0x11, 0x11, 0x13, 0x93, 0xe3, 0x63, 0x27, 0x27, 0x47, 0x47, 0xcf, 0xcf, 0x0f, 0x08, + 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + }; + + // assumes 1 frame prep stage + void animation_phase(void) { + if (get_current_wpm() <= IDLE_SPEED) { + current_idle_frame = (current_idle_frame + 1) % IDLE_FRAMES; + oled_write_raw_P(idle[abs((IDLE_FRAMES - 1) - current_idle_frame)], ANIM_SIZE); + } + + if (get_current_wpm() > IDLE_SPEED && get_current_wpm() < ANIM_WPM_LOWER) { + // oled_write_raw_P(prep[abs((PREP_FRAMES-1)-current_prep_frame)], ANIM_SIZE); // uncomment if IDLE_FRAMES >1 + oled_write_raw_P(prep[0], ANIM_SIZE); // remove if IDLE_FRAMES >1 + } + + if (get_current_wpm() >= ANIM_WPM_LOWER) { + current_tap_frame = (current_tap_frame + 1) % TAP_FRAMES; + oled_write_raw_P(tap[abs((TAP_FRAMES - 1) - current_tap_frame)], ANIM_SIZE); + } + } + + // variable animation duration. Don't want this value to get near zero as it'll bug out. + curr_anim_duration = MAX(ANIM_FRAME_DURATION_MIN, ANIM_FRAME_DURATION_MAX - ANIM_FRAME_RATIO * get_current_wpm()); + + if (get_current_wpm() > ANIM_WPM_LOWER) { + oled_on(); // not essential but turns on animation OLED with any alpha keypress + + if (timer_elapsed32(bongo_timer) > curr_anim_duration) { + bongo_timer = timer_read32(); + animation_phase(); + } + + bongo_sleep = timer_read32(); + } else { + if (timer_elapsed32(bongo_sleep) > OLED_TIMEOUT) { + oled_off(); + } else { + if (timer_elapsed32(bongo_timer) > IDLE_FRAME_DURATION) { + bongo_timer = timer_read32(); + animation_phase(); + } + } + } +} diff --git a/keyboards/handwired/horrortroll/k552/lib/galaxy.c b/keyboards/handwired/horrortroll/k552/lib/galaxy.c new file mode 100644 index 0000000000..5cc340dded --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/lib/galaxy.c @@ -0,0 +1,58 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +# define ANIM_SIZE 636 // number of bytes in array, minimize for adequate firmware size, max is 1024 + +static void render_galaxy(void) { + static const char PROGMEM galaxy[][ANIM_SIZE] = { + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x80, 0xc8, 0xe8, 0x49, 0x72, + 0x7e, 0x4b, 0x82, 0x05, 0xa2, 0x55, 0x0a, 0x11, 0x2a, 0x44, 0xaa, 0x11, 0xaa, 0x44, 0x2a, 0x10, + 0x20, 0x42, 0x02, 0x80, 0xc4, 0x92, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x05, 0x02, 0x05, 0x03, 0x06, 0x81, 0xfe, 0x81, 0x1c, 0x1e, 0x08, 0x00, 0x00, 0x00, 0x80, + 0x00, 0x10, 0x65, 0xcd, 0x63, 0xce, 0x2b, 0x2b, 0x8e, 0x9c, 0x2c, 0x78, 0xf3, 0x58, 0xc0, 0xe8, + 0xe0, 0xf9, 0x88, 0x68, 0xa1, 0x00, 0x01, 0x03, 0x8f, 0x0f, 0x1f, 0x2f, 0xdf, 0x7f, 0x7e, 0xff, + 0x79, 0x2f, 0xff, 0xdf, 0x5f, 0xbf, 0xff, 0x7f, 0xff, 0x9e, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xf7, + 0xde, 0xfd, 0xfe, 0x50, 0xa8, 0x50, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x42, 0xe4, 0xf0, 0xfe, 0xf0, 0xe1, 0x41, 0x47, 0x49, 0xab, + 0x14, 0x48, 0x22, 0x55, 0x0a, 0x05, 0x20, 0x55, 0x88, 0x54, 0xa2, 0x14, 0x08, 0x00, 0x48, 0x22, + 0x90, 0x20, 0x00, 0x40, 0xa8, 0x70, 0x86, 0x5d, 0x60, 0x04, 0x08, 0x00, 0x04, 0x00, 0x04, 0x04, + 0x04, 0x04, 0x84, 0x84, 0x0e, 0x1f, 0x3f, 0xff, 0x3f, 0x1f, 0x6e, 0xe4, 0xe4, 0xd4, 0xa4, 0xd4, + 0xa5, 0xd9, 0xad, 0xde, 0xfd, 0xf9, 0xfd, 0xf4, 0x08, 0xf0, 0x40, 0x40, 0x00, 0xc1, 0x01, 0x0b, + 0x9f, 0x4f, 0xbf, 0x7f, 0xff, 0xff, 0xfa, 0xc0, 0xea, 0x84, 0xaa, 0x84, 0x00, 0x05, 0x00, 0x01, + 0xc5, 0x7c, 0x2d, 0x57, 0x28, 0x53, 0x20, 0x11, 0x2b, 0x9d, 0x1e, 0x2f, 0x57, 0x2f, 0xdf, 0x3f, + 0xff, 0x7f, 0xff, 0x7f, 0xbf, 0x3f, 0x52, 0x04, 0x0a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f, 0x31, 0x60, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x0a, 0x11, 0x2a, 0x44, 0xa8, 0x00, 0x80, 0x00, 0x01, 0x00, 0x04, 0x19, 0x58, 0xf6, 0xf5, + 0xf8, 0xd5, 0x58, 0xe1, 0x6e, 0xb4, 0x02, 0x80, 0x04, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x03, 0x07, 0xa7, 0xa3, 0x00, 0x00, 0xaf, 0x80, 0x00, 0x04, 0x01, 0x03, 0x83, 0x73, 0x05, + 0xd3, 0xff, 0x7f, 0xbf, 0x7f, 0xbf, 0xdf, 0xff, 0xfb, 0xf5, 0xe9, 0xac, 0x97, 0x1e, 0xae, 0xf0, + 0x82, 0xc1, 0x42, 0xc5, 0x50, 0xef, 0x9b, 0x1f, 0x9f, 0x6f, 0x59, 0x80, 0x18, 0xe0, 0x60, 0xf1, + 0x56, 0x23, 0x61, 0x22, 0x11, 0x02, 0x01, 0x00, 0x00, 0x80, 0x80, 0x10, 0x08, 0x1a, 0xfd, 0x02, + 0xa9, 0x71, 0x3f, 0x16, 0x07, 0x02, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x05, 0x0a, 0x11, 0x0a, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, + 0xff, 0xff, 0xbf, 0xea, 0xed, 0x7a, 0x05, 0x02, 0x06, 0x00, 0x0c, 0x00, 0x09, 0x2e, 0x80, 0x30, + 0x02, 0x04, 0x82, 0x8a, 0x0d, 0xb8, 0x10, 0xf1, 0xe0, 0xe0, 0x80, 0xe0, 0x40, 0x00, 0x54, 0xa8, + 0x41, 0x82, 0x01, 0x00, 0x01, 0x00, 0x41, 0x88, 0x55, 0x23, 0x55, 0x8b, 0x57, 0xaf, 0xdf, 0xff, + 0xfe, 0xfe, 0xff, 0xfe, 0xfe, 0xfc, 0xbf, 0x4b, 0x8c, 0x07, 0x0f, 0x1f, 0x0c, 0xaa, 0x10, 0x00, + 0x00, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x04, 0x01, 0x80, + 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0e, 0x04, 0x00 + } + }; + + oled_write_raw_P(galaxy[0], ANIM_SIZE); +} \ No newline at end of file diff --git a/keyboards/handwired/horrortroll/k552/lib/glcdfont.c b/keyboards/handwired/horrortroll/k552/lib/glcdfont.c new file mode 100644 index 0000000000..23bfd92d72 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/lib/glcdfont.c @@ -0,0 +1,248 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. +// See gfxfont.h for newer custom bitmap font info. + +#include "progmem.h" + +// Standard ASCII 5x7 font +const unsigned char font[] PROGMEM = { + 0x07, 0x08, 0x7F, 0x08, 0x07, 0x00, + 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, + 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, + 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, + 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, + 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, + 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, + 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, + 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, + 0x00, 0x18, 0x24, 0x18, 0x00, 0x00, + 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, + 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, + 0x26, 0x29, 0x79, 0x29, 0x26, 0x00, + 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, + 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, + 0x2A, 0x1C, 0x77, 0x1C, 0x2A, 0x00, + 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, + 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, + 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, + 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, + 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, + 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, + 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, + 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, + 0x08, 0x04, 0x3E, 0x04, 0x08, 0x00, + 0x08, 0x10, 0x3E, 0x10, 0x08, 0x00, + 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, + 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, + 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, + 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, + 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, + 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, + 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, + 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, + 0x23, 0x13, 0x08, 0x64, 0x62, 0x00, + 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, + 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, + 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, + 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, + 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, + 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, + 0x00, 0x80, 0x70, 0x30, 0x00, 0x00, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, + 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, + 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, + 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, + 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, + 0x72, 0x49, 0x49, 0x49, 0x46, 0x00, + 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, + 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, + 0x27, 0x45, 0x45, 0x45, 0x39, 0x00, + 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, + 0x41, 0x21, 0x11, 0x09, 0x07, 0x00, + 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, + 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, + 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, + 0x41, 0x22, 0x14, 0x08, 0x00, 0x00, + 0x02, 0x01, 0x59, 0x09, 0x06, 0x00, + 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, + 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, + 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, + 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, + 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, + 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, + 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, + 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, + 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, + 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, + 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, + 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, + 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, + 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, + 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, + 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, + 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, + 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, + 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, + 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, + 0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, + 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, + 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, + 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, + 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, + 0x03, 0x04, 0x78, 0x04, 0x03, 0x00, + 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, + 0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, + 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, + 0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, + 0x04, 0x02, 0x01, 0x02, 0x04, 0x00, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, + 0x00, 0x03, 0x07, 0x08, 0x00, 0x00, + 0x20, 0x54, 0x54, 0x78, 0x40, 0x00, + 0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x28, 0x00, + 0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, + 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, + 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, + 0x18, 0xA4, 0xA4, 0x9C, 0x78, 0x00, + 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, + 0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, + 0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, + 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, + 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, + 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, + 0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, + 0xFC, 0x18, 0x24, 0x24, 0x18, 0x00, + 0x18, 0x24, 0x24, 0x18, 0xFC, 0x00, + 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, + 0x48, 0x54, 0x54, 0x54, 0x24, 0x00, + 0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, + 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, + 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, + 0x3C, 0x40, 0x38, 0x40, 0x3C, 0x00, + 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, + 0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00, + 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, + 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, + 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, + 0x00, 0x41, 0x36, 0x08, 0x00, 0x00, + 0x02, 0x01, 0x02, 0x04, 0x02, 0x00, + 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, + 0x10, 0x38, 0x10, 0x10, 0x1C, 0x00, + 0x0C, 0x7A, 0x41, 0x7A, 0x0C, 0x00, + 0x18, 0x2F, 0x41, 0x2F, 0x18, 0x00, + 0x22, 0x72, 0x22, 0x27, 0x22, 0x00, + 0x08, 0x1C, 0x08, 0x08, 0x08, 0x00, + 0x08, 0x08, 0x38, 0x20, 0x28, 0x28, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x2A, 0x2A, 0x2A, 0x00, 0x00, + 0x4E, 0x46, 0x4A, 0x50, 0x2F, 0x00, + 0x3E, 0x45, 0x55, 0x51, 0x3E, 0x00, + 0x48, 0x50, 0x7E, 0x50, 0x48, 0x00, + 0x3E, 0x49, 0x71, 0x49, 0x3E, 0x00, + 0x10, 0x22, 0x4F, 0x20, 0x10, 0x00, + 0x0E, 0x06, 0x0A, 0x10, 0x20, 0x00, + 0x20, 0x10, 0x0A, 0x06, 0x0E, 0x00, + 0x08, 0x08, 0x08, 0x1C, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, + 0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, + 0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, + 0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00, + 0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B, + 0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00, + 0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE, + 0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, + 0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, + 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00, + 0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20, + 0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00, + 0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F, + 0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; diff --git a/keyboards/handwired/horrortroll/k552/lib/logo.c b/keyboards/handwired/horrortroll/k552/lib/logo.c new file mode 100644 index 0000000000..2e05555af2 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/lib/logo.c @@ -0,0 +1,58 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +# define ANIM_SIZE 636 // number of bytes in array, minimize for adequate firmware size, max is 1024 + +static void render_logo(void) { + static const char PROGMEM redragon[][ANIM_SIZE] = { + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xc0, 0xc0, 0x80, + 0x80, 0xc0, 0xe0, 0x80, 0xc0, 0xe0, 0x30, 0x8c, 0x83, 0xc0, 0x60, 0x18, 0x04, 0x00, 0x01, 0x03, + 0x0e, 0x3e, 0xfe, 0xfc, 0xfc, 0xf8, 0xf0, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0xf0, 0xf0, 0xf0, 0xf8, 0xf8, 0xfc, 0xf6, 0xf3, 0x31, 0xfc, 0xff, 0xff, 0x3f, + 0x9f, 0x5f, 0x5f, 0x5f, 0xcf, 0xcf, 0xcf, 0xcb, 0xc9, 0x8c, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xf8, 0xe0, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0xf0, 0xe0, 0x60, 0x60, 0xc0, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x40, 0xc0, 0xc0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x10, 0xf0, 0xf0, 0xf0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x03, 0xcf, 0xff, 0x0c, + 0x02, 0x00, 0x80, 0x80, 0xc0, 0xe0, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x1c, 0x00, 0x00, 0x00, 0x00, + 0x03, 0xfe, 0xf8, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x3f, 0x7f, 0xff, 0xff, + 0xfc, 0x80, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0xff, 0xff, 0x20, 0x60, 0xd9, 0x9f, 0x0f, 0x00, + 0x01, 0xff, 0xff, 0x23, 0x21, 0x21, 0x73, 0x00, 0xff, 0xff, 0x03, 0x22, 0x1e, 0xfc, 0xf8, 0x41, + 0xff, 0xff, 0xe3, 0xb2, 0x3e, 0x1c, 0x00, 0xe0, 0xfe, 0x7f, 0x43, 0x4f, 0x7d, 0xf0, 0x80, 0x70, + 0xfc, 0x9e, 0x22, 0x03, 0x43, 0x43, 0xc6, 0xcc, 0x80, 0x78, 0xfc, 0x06, 0x23, 0x22, 0x06, 0x9c, + 0xf8, 0x40, 0x20, 0xff, 0xff, 0xff, 0x07, 0x1f, 0x7c, 0xf8, 0xe0, 0xff, 0xff, 0xff, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xf1, 0xf9, 0xfd, 0xff, 0xfe, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x97, 0x87, 0xc1, 0xe3, 0xf0, 0x78, 0x7e, 0x7f, 0x38, + 0x3e, 0x3f, 0x9f, 0x6f, 0x3f, 0x1f, 0x07, 0x00, 0x03, 0x7f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x0f, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0e, 0x0f, 0x0f, 0x08, 0x00, 0x01, 0x03, 0x0f, 0x1e, + 0x3c, 0x77, 0x67, 0x44, 0x04, 0x04, 0x04, 0x02, 0x07, 0x07, 0x06, 0x06, 0x03, 0x03, 0x01, 0x04, + 0x07, 0x07, 0x00, 0x03, 0x07, 0x04, 0x06, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x06, + 0x05, 0x03, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x00, 0x00, 0x03, 0x07, 0x06, 0x06, 0x06, 0x07, + 0x01, 0x00, 0x04, 0x07, 0x07, 0x07, 0x04, 0x00, 0x00, 0x01, 0x03, 0x0f, 0x3f, 0xff, 0x00, 0x00 + } + }; + + oled_write_raw_P(redragon[0], ANIM_SIZE); +} diff --git a/keyboards/handwired/horrortroll/k552/lib/wave.c b/keyboards/handwired/horrortroll/k552/lib/wave.c new file mode 100644 index 0000000000..79b4e0ced7 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/lib/wave.c @@ -0,0 +1,133 @@ +/* Copyright 2021 HorrorTroll + * + * 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 . + */ + +extern const unsigned char font[] PROGMEM; + +#define ROW_1 OLED_DISPLAY_WIDTH +#define ROW_2 (OLED_DISPLAY_WIDTH * 2) + +static uint32_t wave_sleep = 0; + +#define FRAME_TIMEOUT (1000/24) + +static uint16_t wave_timer = 0; + +static uint8_t next_bar_val = 0; +static uint8_t next_log_byte[OLED_FONT_WIDTH] = {0}; +static uint8_t line1[OLED_DISPLAY_WIDTH] = {0}; +static uint8_t line2[OLED_DISPLAY_WIDTH] = {0}; + +static const uint8_t PROGMEM bar_lut[8] = {0, 16, 24, 56, 60, 124, 126, 255}; + +#define BAR_KEY_WEIGHT 128 +#define BAR_KEY_DECAY_MAX 18 + +static uint8_t bar_key_decay = BAR_KEY_DECAY_MAX; + +// clang-format off +static const char PROGMEM code_to_name[0xFF] = { +// 0 1 2 3 4 5 6 7 8 9 A B C D E F + ' ', ' ', ' ', ' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', // 0x + 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', // 1x + '3', '4', '5', '6', '7', '8', '9', '0', 128, 136, 132, 131, 22, '-', '=', '[', // 2x + ']','\\', '#', ';','\'', '`', ',', '.', '/', 130, 7, 7, 7, 7, 7, 7, // 3x + 7, 7, 7, 7, 7, 7, 137, 138, 139, 140, 141, 30, 143, 142, 31, 26, // 4x + 27, 25, 24, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 5x + ' ', ' ', ' ', ' ', ' ', 135, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 6x + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 7x + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 8x + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 9x + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ax + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Bx + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Cx + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Dx + 15, 129, 133, 4, 15, 129, 133, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ex + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' // Fx +}; +// clang-format on + +void add_keylog(uint16_t keycode) { + if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || + (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) || + (keycode >= QK_MODS && keycode <= QK_MODS_MAX)) { + keycode = keycode & 0xFF; + } else if (keycode > 0xFF) { + keycode = 0; + } + + if (keycode < (sizeof(code_to_name) / sizeof(char))) { + char log_char = pgm_read_byte(&code_to_name[keycode]); + + for (uint8_t j = 0; j < OLED_FONT_WIDTH; j++) { + const uint8_t glyph_line = pgm_read_byte(&font[log_char * OLED_FONT_WIDTH + j]); + next_log_byte[j] = glyph_line; + } + } +} + +bool process_record_user_oled(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + wave_sleep = timer_read32(); + add_keylog(keycode); + + uint8_t t = next_bar_val + BAR_KEY_WEIGHT; + + if (t < next_bar_val) { + next_bar_val = 255; + } else { + next_bar_val = t; + } + + bar_key_decay = BAR_KEY_DECAY_MAX; + } + + return true; +} + +void render_layer_name(void) { + oled_write_P(PSTR("LAYER: WAVE"), false); +} + +void render_frame(void) { + // rotate line 1, and stick in the next byte of the next char, + // then rotate the next char buffer + memmove(line1+1, line1, OLED_DISPLAY_WIDTH - 1); + line1[0] = next_log_byte[OLED_FONT_WIDTH - 1]; + memmove(next_log_byte+1, next_log_byte, OLED_FONT_WIDTH - 1); + next_log_byte[0] = 0; + + // rotate line 2, sticking in the next display value + uint8_t disp_val = pgm_read_byte(&bar_lut[next_bar_val / 32]); + memmove(line2+1, line2, OLED_DISPLAY_WIDTH - 1); + line2[0] = disp_val; + + // draw both bars + for (uint8_t i = 0; i < OLED_DISPLAY_WIDTH; i++) { + oled_write_raw_byte(line1[i], ROW_1 + i); + oled_write_raw_byte(line2[i], ROW_2 + i); + } + + // decay the next bar value + if (next_bar_val > bar_key_decay) { + next_bar_val -= bar_key_decay; + } else { + next_bar_val = 0; + } + + if (bar_key_decay > 1) { + bar_key_decay -= 1; + } +} diff --git a/keyboards/handwired/horrortroll/k552/mcuconf.h b/keyboards/handwired/horrortroll/k552/mcuconf.h new file mode 100644 index 0000000000..c2c0e9a2f6 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/mcuconf.h @@ -0,0 +1,27 @@ +/* Copyright 2020 QMK + * + * 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 . + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/wolfmarkclub/wm1/mcuconf.h -r platforms/chibios/STM32_F103_STM32DUINO/configs/mcuconf.h` + */ + +#pragma once + +#include_next + +#undef STM32_I2C_USE_I2C2 +#define STM32_I2C_USE_I2C2 TRUE diff --git a/keyboards/handwired/horrortroll/k552/readme.md b/keyboards/handwired/horrortroll/k552/readme.md new file mode 100644 index 0000000000..f1b30afae5 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/readme.md @@ -0,0 +1,22 @@ +# Redragon K552 Kumara + +![K552](https://i.imgur.com/XpNmJpBh.png) + +A handwired K552 Kumara. Built using STM32F103RCT6 Mini + +* Keyboard Maintainer: [HorrorTroll](https://github.com/HorrorTroll) +* Hardware Supported: Redragon K552 Kumara and STM32F103RCT6 Mini + +Make example for this keyboard (after setting up your build environment): + + make handwired/horrortroll/k552:default + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). + +## Bootloader + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the key at (4,6) in the matrix (B key) and plug in the keyboard +* **Physical reset button**: Briefly press the button on the back of the PCB +* **Keycode in layout**: Press the key mapped to `RESET` if it is available diff --git a/keyboards/handwired/horrortroll/k552/rules.mk b/keyboards/handwired/horrortroll/k552/rules.mk new file mode 100644 index 0000000000..5df510cd44 --- /dev/null +++ b/keyboards/handwired/horrortroll/k552/rules.mk @@ -0,0 +1,33 @@ +# MCU name +MCU = STM32F103 + +MCU_LDSCRIPT = k552_f103 +BOARD = k552 + +# Bootloader selection +BOOTLOADER = stm32duino + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +NO_USB_STARTUP_CHECK = yes + +# RGB Matrix enabled +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = WS2812 + +# OLED enabled +OLED_ENABLE = yes +OLED_DRIVER = SSD1306 +WPM_ENABLE = yes + +LAYOUTS = tkl_ansi -- cgit v1.2.3