diff options
author | HorrorTroll <sonicvipduc@gmail.com> | 2022-12-30 08:04:01 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-30 12:04:01 +1100 |
commit | 724aa3a4b256ccb058e4ef86c882167635d6815d (patch) | |
tree | e3c13a9e983fff434fa7919973c2e0708bd9dae4 /keyboards/horrortroll | |
parent | 87cace28a62a9a7e156ca03201488a46915cf8ec (diff) |
Refactor entire Handwired K552 keyboard (#18066)
Diffstat (limited to 'keyboards/horrortroll')
43 files changed, 231 insertions, 296 deletions
diff --git a/keyboards/horrortroll/handwired_k552/chconf.h b/keyboards/horrortroll/handwired_k552/board.h index 4ad4a3be34..edd68f15ae 100644 --- a/keyboards/horrortroll/handwired_k552/chconf.h +++ b/keyboards/horrortroll/handwired_k552/board.h @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 @@ -14,13 +14,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* - * This file was auto-generated by: - * `qmk chibios-confmigrate -i keyboards/horrortroll/handwired_k552/chconf.h -r platforms/chibios/common/configs/chconf.h` - */ - -#pragma once - -#define CH_CFG_ST_TIMEDELTA 0 +#include_next <board.h> -#include_next <chconf.h> +#undef STM32F103xB +#define STM32F103xE diff --git a/keyboards/horrortroll/handwired_k552/boards/k552/board.c b/keyboards/horrortroll/handwired_k552/boards/k552/board.c deleted file mode 100644 index 65269520ea..0000000000 --- a/keyboards/horrortroll/handwired_k552/boards/k552/board.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - 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 <hal.h> - -/** - * @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/horrortroll/handwired_k552/boards/k552/board.h b/keyboards/horrortroll/handwired_k552/boards/k552/board.h deleted file mode 100644 index f9b38b0caf..0000000000 --- a/keyboards/horrortroll/handwired_k552/boards/k552/board.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - 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 <board.h> -#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/horrortroll/handwired_k552/boards/k552/board.mk b/keyboards/horrortroll/handwired_k552/boards/k552/board.mk deleted file mode 100644 index 15831c4f15..0000000000 --- a/keyboards/horrortroll/handwired_k552/boards/k552/board.mk +++ /dev/null @@ -1,5 +0,0 @@ -# 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/horrortroll/handwired_k552/config.h b/keyboards/horrortroll/handwired_k552/config.h index b26e7489a6..8633bb603f 100644 --- a/keyboards/horrortroll/handwired_k552/config.h +++ b/keyboards/horrortroll/handwired_k552/config.h @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 @@ -22,9 +22,9 @@ #define MATRIX_ROWS 6 #define MATRIX_COLS 17 -/* key matrix pins */ +/* Key matrix pins */ #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 } +#define MATRIX_COL_PINS { B15, C6, C7, A3, A1, C3, C1, B14, B13, A9, B3, B4, A0, C11, C4, C0, C2 } /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION ROW2COL @@ -33,23 +33,29 @@ #define DEBOUNCE 5 /* Bootmagic reset */ -#define BOOTMAGIC_LITE_ROW 4 -#define BOOTMAGIC_LITE_COLUMN 6 +#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_COLUMN 0 /* Forcing to use NKRO instead 6KRO */ #define FORCE_NKRO -/* 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; \ -}) +// SPI configuration +#define SPI_DRIVER SPID1 +#define SPI_SCK_PIN A5 +#define SPI_MOSI_PIN A7 +#define SPI_MISO_PIN A6 + +// Flash configuration +#define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN A2 +#define EXTERNAL_FLASH_SPI_CLOCK_DIVISOR 16 +#define EXTERNAL_FLASH_PAGE_SIZE 256 +#define EXTERNAL_FLASH_SECTOR_SIZE 4096 +#define EXTERNAL_FLASH_BLOCK_SIZE 4096 +#define EXTERNAL_FLASH_SIZE (256 * 1024) // 2M-bit flash size + +// Wear-leveling driver configuration +#define WEAR_LEVELING_LOGICAL_SIZE 1024 +#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) #ifdef OLED_ENABLE /* Mapping I2C2 for OLED */ diff --git a/keyboards/horrortroll/handwired_k552/halconf.h b/keyboards/horrortroll/handwired_k552/halconf.h index 2ef68f8fb2..a8be303915 100644 --- a/keyboards/horrortroll/handwired_k552/halconf.h +++ b/keyboards/horrortroll/handwired_k552/halconf.h @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 @@ -23,4 +23,8 @@ #define HAL_USE_I2C TRUE +#define HAL_USE_SPI TRUE +#define SPI_USE_WAIT TRUE +#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD + #include_next <halconf.h> diff --git a/keyboards/horrortroll/handwired_k552/handwired_k552.c b/keyboards/horrortroll/handwired_k552/handwired_k552.c index 03bbad461f..f4ce6d4c86 100644 --- a/keyboards/horrortroll/handwired_k552/handwired_k552.c +++ b/keyboards/horrortroll/handwired_k552/handwired_k552.c @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 @@ -17,7 +17,7 @@ #include "handwired_k552.h" // OLED animation -#include "lib/logo.c" +#include "lib/logo.h" #ifdef RGB_MATRIX_ENABLE led_config_t g_led_config = { { diff --git a/keyboards/horrortroll/handwired_k552/handwired_k552.h b/keyboards/horrortroll/handwired_k552/handwired_k552.h index 2a537714e3..7811c0e82e 100644 --- a/keyboards/horrortroll/handwired_k552/handwired_k552.h +++ b/keyboards/horrortroll/handwired_k552/handwired_k552.h @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/keymap.c b/keyboards/horrortroll/handwired_k552/keymaps/default/keymap.c index 6e06466d22..3208b56544 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/keymap.c +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 @@ -88,7 +88,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ [_FN] = LAYOUT_tkl_ansi( - QK_BOOT, 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, + QK_BOOT, 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, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/keymap_stuff.h b/keyboards/horrortroll/handwired_k552/keymaps/default/keymap_stuff.h index 5d854b9396..cc93f18207 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/keymap_stuff.h +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/keymap_stuff.h @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 @@ -27,9 +27,9 @@ // entirely and just use numbers. enum layer_names { - _BASE = 0, - _WAVE = 1, - _FN = 2 + _BASE, + _WAVE, + _FN, }; // For CUSTOM_GRADIENT @@ -212,12 +212,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { 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_FLOWER_BLOOMING); + return false; + case RGB_MATRIX_CUSTOM_FLOWER_BLOOMING: rgb_matrix_mode(RGB_MATRIX_CUSTOM_KITT); return false; case RGB_MATRIX_CUSTOM_KITT: diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/led/cool_diagonal.c b/keyboards/horrortroll/handwired_k552/keymaps/default/led/cool_diagonal.c index 2c518a5431..a5bf960d45 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/led/cool_diagonal.c +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/led/cool_diagonal.c @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/led/custom_gradient.c b/keyboards/horrortroll/handwired_k552/keymaps/default/led/custom_gradient.c index 0d7acd7e8b..af6173d250 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/led/custom_gradient.c +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/led/custom_gradient.c @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/led/flower_blooming/flower_blooming.c b/keyboards/horrortroll/handwired_k552/keymaps/default/led/flower_blooming/flower_blooming.c new file mode 100644 index 0000000000..add83149cc --- /dev/null +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/led/flower_blooming/flower_blooming.c @@ -0,0 +1,27 @@ +/* Copyright 2022 HorrorTroll <https://github.com/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 <http://www.gnu.org/licenses/>. + */ + +#include "led/flower_blooming/flower_blooming.h" + +static HSV FLOWER_BLOOMING_math(HSV hsv, uint8_t i, uint8_t time) { + if (g_led_config.point[i].y > k_rgb_matrix_center.y) + hsv.h = g_led_config.point[i].x * 3 - g_led_config.point[i].y * 3 + time; + else + hsv.h = g_led_config.point[i].x * 3 - g_led_config.point[i].y * 3 - time; + return hsv; +} + +bool FLOWER_BLOOMING(effect_params_t* params) { return effect_runner_bloom(params, &FLOWER_BLOOMING_math); } diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/led/flower_blooming/flower_blooming.h b/keyboards/horrortroll/handwired_k552/keymaps/default/led/flower_blooming/flower_blooming.h new file mode 100644 index 0000000000..941dab975a --- /dev/null +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/led/flower_blooming/flower_blooming.h @@ -0,0 +1,20 @@ +#pragma once + +typedef HSV (*flower_blooming_f)(HSV hsv, uint8_t i, uint8_t time); + +bool effect_runner_bloom(effect_params_t* params, flower_blooming_f effect_func) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 10, 1)); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + if (g_led_config.point[i].y > k_rgb_matrix_center.y) { + RGB bgr = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); + rgb_matrix_set_color(i, bgr.b, bgr.g, bgr.r); + } else { + RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + } + return rgb_matrix_check_finished_leds(led_max); +} diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/led/kitt.c b/keyboards/horrortroll/handwired_k552/keymaps/default/led/kitt.c index 823eb5839b..dadbe48223 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/led/kitt.c +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/led/kitt.c @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/led/random_breath_rainbow.c b/keyboards/horrortroll/handwired_k552/keymaps/default/led/random_breath_rainbow.c index 29c447c61a..ba1ca55faf 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/led/random_breath_rainbow.c +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/led/random_breath_rainbow.c @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/oled/oled_stuff.h b/keyboards/horrortroll/handwired_k552/keymaps/default/oled/oled_stuff.h index 9d8d629179..1160c7ab44 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/oled/oled_stuff.h +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/oled/oled_stuff.h @@ -15,8 +15,8 @@ */ // OLED animation -#include "lib/bongocat.c" -#include "lib/galaxy.c" +#include "lib/bongocat.h" +#include "lib/galaxy.h" #include "lib/wave.c" #ifdef OLED_ENABLE diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/readme.md b/keyboards/horrortroll/handwired_k552/keymaps/default/readme.md index c8f9c1f8ec..546581ab28 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/readme.md +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/readme.md @@ -4,7 +4,7 @@ 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]) +- FLower Blooming - 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) diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/rgb_matrix_user.inc b/keyboards/horrortroll/handwired_k552/keymaps/default/rgb_matrix_user.inc index 38edbae993..1817465030 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/rgb_matrix_user.inc +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/rgb_matrix_user.inc @@ -1,14 +1,14 @@ RGB_MATRIX_EFFECT(CUSTOM_GRADIENT) -RGB_MATRIX_EFFECT(DIAGONAL) RGB_MATRIX_EFFECT(COOL_DIAGONAL) +RGB_MATRIX_EFFECT(FLOWER_BLOOMING) 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/flower_blooming/flower_blooming.c" #include "led/kitt.c" #include "led/random_breath_rainbow.c" diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/rules.mk b/keyboards/horrortroll/handwired_k552/keymaps/default/rules.mk index 6245023e80..45aa4a911d 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/rules.mk +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/rules.mk @@ -1 +1,4 @@ +SRC += lib/bongocat.c +SRC += lib/galaxy.c + RGB_MATRIX_CUSTOM_USER = yes diff --git a/keyboards/horrortroll/handwired_k552/keymaps/via/config.h b/keyboards/horrortroll/handwired_k552/keymaps/via/config.h index a36ce468bc..07730f01ff 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/via/config.h +++ b/keyboards/horrortroll/handwired_k552/keymaps/via/config.h @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 diff --git a/keyboards/horrortroll/handwired_k552/keymaps/via/keymap.c b/keyboards/horrortroll/handwired_k552/keymaps/via/keymap.c index 6e06466d22..3208b56544 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/via/keymap.c +++ b/keyboards/horrortroll/handwired_k552/keymaps/via/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 @@ -88,7 +88,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ [_FN] = LAYOUT_tkl_ansi( - QK_BOOT, 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, + QK_BOOT, 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, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/horrortroll/handwired_k552/keymaps/via/keymap_stuff.h b/keyboards/horrortroll/handwired_k552/keymaps/via/keymap_stuff.h index 5d854b9396..cc93f18207 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/via/keymap_stuff.h +++ b/keyboards/horrortroll/handwired_k552/keymaps/via/keymap_stuff.h @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 @@ -27,9 +27,9 @@ // entirely and just use numbers. enum layer_names { - _BASE = 0, - _WAVE = 1, - _FN = 2 + _BASE, + _WAVE, + _FN, }; // For CUSTOM_GRADIENT @@ -212,12 +212,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { 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_FLOWER_BLOOMING); + return false; + case RGB_MATRIX_CUSTOM_FLOWER_BLOOMING: rgb_matrix_mode(RGB_MATRIX_CUSTOM_KITT); return false; case RGB_MATRIX_CUSTOM_KITT: diff --git a/keyboards/horrortroll/handwired_k552/keymaps/via/led/cool_diagonal.c b/keyboards/horrortroll/handwired_k552/keymaps/via/led/cool_diagonal.c index 2c518a5431..a5bf960d45 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/via/led/cool_diagonal.c +++ b/keyboards/horrortroll/handwired_k552/keymaps/via/led/cool_diagonal.c @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 diff --git a/keyboards/horrortroll/handwired_k552/keymaps/via/led/custom_gradient.c b/keyboards/horrortroll/handwired_k552/keymaps/via/led/custom_gradient.c index 0d7acd7e8b..af6173d250 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/via/led/custom_gradient.c +++ b/keyboards/horrortroll/handwired_k552/keymaps/via/led/custom_gradient.c @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 diff --git a/keyboards/horrortroll/handwired_k552/keymaps/via/led/flower_blooming/flower_blooming.c b/keyboards/horrortroll/handwired_k552/keymaps/via/led/flower_blooming/flower_blooming.c new file mode 100644 index 0000000000..add83149cc --- /dev/null +++ b/keyboards/horrortroll/handwired_k552/keymaps/via/led/flower_blooming/flower_blooming.c @@ -0,0 +1,27 @@ +/* Copyright 2022 HorrorTroll <https://github.com/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 <http://www.gnu.org/licenses/>. + */ + +#include "led/flower_blooming/flower_blooming.h" + +static HSV FLOWER_BLOOMING_math(HSV hsv, uint8_t i, uint8_t time) { + if (g_led_config.point[i].y > k_rgb_matrix_center.y) + hsv.h = g_led_config.point[i].x * 3 - g_led_config.point[i].y * 3 + time; + else + hsv.h = g_led_config.point[i].x * 3 - g_led_config.point[i].y * 3 - time; + return hsv; +} + +bool FLOWER_BLOOMING(effect_params_t* params) { return effect_runner_bloom(params, &FLOWER_BLOOMING_math); } diff --git a/keyboards/horrortroll/handwired_k552/keymaps/via/led/flower_blooming/flower_blooming.h b/keyboards/horrortroll/handwired_k552/keymaps/via/led/flower_blooming/flower_blooming.h new file mode 100644 index 0000000000..941dab975a --- /dev/null +++ b/keyboards/horrortroll/handwired_k552/keymaps/via/led/flower_blooming/flower_blooming.h @@ -0,0 +1,20 @@ +#pragma once + +typedef HSV (*flower_blooming_f)(HSV hsv, uint8_t i, uint8_t time); + +bool effect_runner_bloom(effect_params_t* params, flower_blooming_f effect_func) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 10, 1)); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + if (g_led_config.point[i].y > k_rgb_matrix_center.y) { + RGB bgr = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); + rgb_matrix_set_color(i, bgr.b, bgr.g, bgr.r); + } else { + RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + } + return rgb_matrix_check_finished_leds(led_max); +} diff --git a/keyboards/horrortroll/handwired_k552/keymaps/via/led/kitt.c b/keyboards/horrortroll/handwired_k552/keymaps/via/led/kitt.c index 823eb5839b..dadbe48223 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/via/led/kitt.c +++ b/keyboards/horrortroll/handwired_k552/keymaps/via/led/kitt.c @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 diff --git a/keyboards/horrortroll/handwired_k552/keymaps/via/led/random_breath_rainbow.c b/keyboards/horrortroll/handwired_k552/keymaps/via/led/random_breath_rainbow.c index 29c447c61a..ba1ca55faf 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/via/led/random_breath_rainbow.c +++ b/keyboards/horrortroll/handwired_k552/keymaps/via/led/random_breath_rainbow.c @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 diff --git a/keyboards/horrortroll/handwired_k552/keymaps/via/oled/oled_stuff.h b/keyboards/horrortroll/handwired_k552/keymaps/via/oled/oled_stuff.h index 9d8d629179..ea098bf555 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/via/oled/oled_stuff.h +++ b/keyboards/horrortroll/handwired_k552/keymaps/via/oled/oled_stuff.h @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 @@ -15,8 +15,8 @@ */ // OLED animation -#include "lib/bongocat.c" -#include "lib/galaxy.c" +#include "lib/bongocat.h" +#include "lib/galaxy.h" #include "lib/wave.c" #ifdef OLED_ENABLE diff --git a/keyboards/horrortroll/handwired_k552/keymaps/via/readme.md b/keyboards/horrortroll/handwired_k552/keymaps/via/readme.md index c8f9c1f8ec..546581ab28 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/via/readme.md +++ b/keyboards/horrortroll/handwired_k552/keymaps/via/readme.md @@ -4,7 +4,7 @@ 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]) +- FLower Blooming - 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) diff --git a/keyboards/horrortroll/handwired_k552/keymaps/via/rgb_matrix_user.inc b/keyboards/horrortroll/handwired_k552/keymaps/via/rgb_matrix_user.inc index 38edbae993..1817465030 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/via/rgb_matrix_user.inc +++ b/keyboards/horrortroll/handwired_k552/keymaps/via/rgb_matrix_user.inc @@ -1,14 +1,14 @@ RGB_MATRIX_EFFECT(CUSTOM_GRADIENT) -RGB_MATRIX_EFFECT(DIAGONAL) RGB_MATRIX_EFFECT(COOL_DIAGONAL) +RGB_MATRIX_EFFECT(FLOWER_BLOOMING) 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/flower_blooming/flower_blooming.c" #include "led/kitt.c" #include "led/random_breath_rainbow.c" diff --git a/keyboards/horrortroll/handwired_k552/keymaps/via/rules.mk b/keyboards/horrortroll/handwired_k552/keymaps/via/rules.mk index d475530c87..db9ec2aee1 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/via/rules.mk +++ b/keyboards/horrortroll/handwired_k552/keymaps/via/rules.mk @@ -1,3 +1,6 @@ +SRC += lib/bongocat.c +SRC += lib/galaxy.c + VIA_ENABLE = yes RGB_MATRIX_CUSTOM_USER = yes diff --git a/keyboards/horrortroll/handwired_k552/lib/bongocat.c b/keyboards/horrortroll/handwired_k552/lib/bongocat.c index fbde9c911a..6510223b22 100644 --- a/keyboards/horrortroll/handwired_k552/lib/bongocat.c +++ b/keyboards/horrortroll/handwired_k552/lib/bongocat.c @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 @@ -14,6 +14,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "quantum.h" + // WPM-responsive animation stuff here # define IDLE_FRAMES 5 # define IDLE_SPEED 10 // below this wpm value your animation will idle @@ -43,7 +45,7 @@ uint8_t current_tap_frame = 0; // 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) { +void render_bongocat(void) { static const char PROGMEM idle[IDLE_FRAMES][ANIM_SIZE] = { { //Idle 1 - 128x32 diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/led/diagonal.c b/keyboards/horrortroll/handwired_k552/lib/bongocat.h index 19e3791bd6..65ceabc682 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/led/diagonal.c +++ b/keyboards/horrortroll/handwired_k552/lib/bongocat.h @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 @@ -14,9 +14,4 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -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); } +void render_bongocat(void); diff --git a/keyboards/horrortroll/handwired_k552/lib/galaxy.c b/keyboards/horrortroll/handwired_k552/lib/galaxy.c index 5cc340dded..04885b8085 100644 --- a/keyboards/horrortroll/handwired_k552/lib/galaxy.c +++ b/keyboards/horrortroll/handwired_k552/lib/galaxy.c @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 @@ -14,9 +14,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "quantum.h" + # define ANIM_SIZE 636 // number of bytes in array, minimize for adequate firmware size, max is 1024 -static void render_galaxy(void) { +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, diff --git a/keyboards/horrortroll/handwired_k552/keymaps/via/led/diagonal.c b/keyboards/horrortroll/handwired_k552/lib/galaxy.h index 19e3791bd6..54ce2ad90a 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/via/led/diagonal.c +++ b/keyboards/horrortroll/handwired_k552/lib/galaxy.h @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 @@ -14,9 +14,4 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -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); } +void render_galaxy(void); diff --git a/keyboards/horrortroll/handwired_k552/lib/glcdfont.c b/keyboards/horrortroll/handwired_k552/lib/glcdfont.c index 23bfd92d72..7e7ca17e21 100644 --- a/keyboards/horrortroll/handwired_k552/lib/glcdfont.c +++ b/keyboards/horrortroll/handwired_k552/lib/glcdfont.c @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 diff --git a/keyboards/horrortroll/handwired_k552/lib/logo.c b/keyboards/horrortroll/handwired_k552/lib/logo.c index 2e05555af2..3931fdf455 100644 --- a/keyboards/horrortroll/handwired_k552/lib/logo.c +++ b/keyboards/horrortroll/handwired_k552/lib/logo.c @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 @@ -14,9 +14,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "quantum.h" + # define ANIM_SIZE 636 // number of bytes in array, minimize for adequate firmware size, max is 1024 -static void render_logo(void) { +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, diff --git a/keyboards/horrortroll/handwired_k552/lib/logo.h b/keyboards/horrortroll/handwired_k552/lib/logo.h new file mode 100644 index 0000000000..5a917ae820 --- /dev/null +++ b/keyboards/horrortroll/handwired_k552/lib/logo.h @@ -0,0 +1,17 @@ +/* Copyright 2022 HorrorTroll <https://github.com/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 <http://www.gnu.org/licenses/>. + */ + +void render_logo(void); diff --git a/keyboards/horrortroll/handwired_k552/mcuconf.h b/keyboards/horrortroll/handwired_k552/mcuconf.h index c9970fa28b..88bd6f4846 100644 --- a/keyboards/horrortroll/handwired_k552/mcuconf.h +++ b/keyboards/horrortroll/handwired_k552/mcuconf.h @@ -1,4 +1,4 @@ -/* Copyright 2021 HorrorTroll <https://github.com/HorrorTroll> +/* Copyright 2022 HorrorTroll <https://github.com/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 @@ -25,3 +25,9 @@ #undef STM32_I2C_USE_I2C2 #define STM32_I2C_USE_I2C2 TRUE + +#undef STM32_SPI_USE_SPI1 +#define STM32_SPI_USE_SPI1 TRUE + +#undef STM32_SPI_USE_SPI2 +#define STM32_SPI_USE_SPI2 FALSE
\ No newline at end of file diff --git a/keyboards/horrortroll/handwired_k552/readme.md b/keyboards/horrortroll/handwired_k552/readme.md index e45cab9f9c..f92fe22ca8 100644 --- a/keyboards/horrortroll/handwired_k552/readme.md +++ b/keyboards/horrortroll/handwired_k552/readme.md @@ -17,6 +17,6 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to 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 +* **Bootmagic reset**: Hold down the key at (0,0) 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 `QK_BOOT` if it is available diff --git a/keyboards/horrortroll/handwired_k552/rules.mk b/keyboards/horrortroll/handwired_k552/rules.mk index f29c92f64c..9a91a7a379 100644 --- a/keyboards/horrortroll/handwired_k552/rules.mk +++ b/keyboards/horrortroll/handwired_k552/rules.mk @@ -1,11 +1,17 @@ +SRC += lib/logo.c + # MCU name MCU = STM32F103 -MCU_LDSCRIPT = k552_f103 -BOARD = k552 - # Bootloader selection -BOOTLOADER = stm32duino +# Cannot use `BOOTLOADER = stm32duino` due to the need to override +# `MCU_LDSCRIPT`, therefore all parameters need to be specified here manually. +OPT_DEFS += -DBOOTLOADER_STM32DUINO +MCU_LDSCRIPT = STM32F103xC_stm32duino_bootloader +BOARD = STM32_F103_STM32DUINO +BOOTLOADER_TYPE = stm32duino +DFU_ARGS = -d 1EAF:0003 -a 2 -R +DFU_SUFFIX_ARGS = -v 1EAF -p 0003 # Build Options # change yes to no to disable @@ -19,8 +25,9 @@ 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 -LTO_ENABLE = yes + +# Enter lower-power sleep mode when on the ChibiOS idle thread +OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE # RGB Matrix enabled RGB_MATRIX_ENABLE = yes @@ -31,4 +38,8 @@ OLED_ENABLE = yes OLED_DRIVER = SSD1306 WPM_ENABLE = yes +# Wear-levelling driver +EEPROM_DRIVER = wear_leveling +WEAR_LEVELING_DRIVER = spi_flash + LAYOUTS = tkl_ansi |