1
0
Fork 0
forked from forks/qmk_firmware

Refactor entire Handwired K552 keyboard (#18066)

This commit is contained in:
HorrorTroll 2022-12-30 08:04:01 +07:00 committed by GitHub
parent 87cace28a6
commit 724aa3a4b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 230 additions and 295 deletions

View file

@ -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 * 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 * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* #include_next <board.h>
* 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 #undef STM32F103xB
#define STM32F103xE
#define CH_CFG_ST_TIMEDELTA 0
#include_next <chconf.h>

View file

@ -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) {
}

View file

@ -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_ */

View file

@ -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

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by
@ -22,9 +22,9 @@
#define MATRIX_ROWS 6 #define MATRIX_ROWS 6
#define MATRIX_COLS 17 #define MATRIX_COLS 17
/* key matrix pins */ /* Key matrix pins */
#define MATRIX_ROW_PINS { C12, C10, A10, A8, C8, C9 } #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 */ /* COL2ROW or ROW2COL */
#define DIODE_DIRECTION ROW2COL #define DIODE_DIRECTION ROW2COL
@ -33,23 +33,29 @@
#define DEBOUNCE 5 #define DEBOUNCE 5
/* Bootmagic reset */ /* Bootmagic reset */
#define BOOTMAGIC_LITE_ROW 4 #define BOOTMAGIC_LITE_ROW 0
#define BOOTMAGIC_LITE_COLUMN 6 #define BOOTMAGIC_LITE_COLUMN 0
/* Forcing to use NKRO instead 6KRO */ /* Forcing to use NKRO instead 6KRO */
#define FORCE_NKRO #define FORCE_NKRO
/* EEPROM size */ // SPI configuration
#define EEPROM_PAGE_SIZE #define SPI_DRIVER SPID1
#define FEE_PAGE_SIZE 0x800 #define SPI_SCK_PIN A5
#define FEE_PAGE_COUNT 4 #define SPI_MOSI_PIN A7
#define SPI_MISO_PIN A6
#define FEE_MCU_FLASH_SIZE_IGNORE_CHECK // Flash configuration
#define FEE_MCU_FLASH_SIZE \ #define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN A2
({ \ #define EXTERNAL_FLASH_SPI_CLOCK_DIVISOR 16
uint16_t flash_size = *(uint16_t*)FLASHSIZE_BASE; \ #define EXTERNAL_FLASH_PAGE_SIZE 256
(flash_size <= 512) ? flash_size : 512; \ #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 #ifdef OLED_ENABLE
/* Mapping I2C2 for OLED */ /* Mapping I2C2 for OLED */

View file

@ -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 * 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 * 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_I2C TRUE
#define HAL_USE_SPI TRUE
#define SPI_USE_WAIT TRUE
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#include_next <halconf.h> #include_next <halconf.h>

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by
@ -17,7 +17,7 @@
#include "handwired_k552.h" #include "handwired_k552.h"
// OLED animation // OLED animation
#include "lib/logo.c" #include "lib/logo.h"
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
led_config_t g_led_config = { { led_config_t g_led_config = { {

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by

View file

@ -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 * 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 * 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 */ /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */
[_FN] = LAYOUT_tkl_ansi( [_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, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SPD, RGB_SPI, _______, RGB_C_E, _______, _______,
_______, G1_HUD, G1_HUI, G1_SAD, G1_SAI, G1_VAD, G1_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, TG(_WAVE), _______, 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, _______, _______, _______, _______, _______, _______, _______, G2_HUD, G2_HUI, G2_SAD, G2_SAI, G2_VAD, G2_VAI, _______, _______, _______, _______, _______, _______,

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by
@ -27,9 +27,9 @@
// entirely and just use numbers. // entirely and just use numbers.
enum layer_names { enum layer_names {
_BASE = 0, _BASE,
_WAVE = 1, _WAVE,
_FN = 2 _FN,
}; };
// For CUSTOM_GRADIENT // For CUSTOM_GRADIENT
@ -212,12 +212,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) { if (record->event.pressed) {
switch (rgb_matrix_get_mode()) { switch (rgb_matrix_get_mode()) {
case RGB_MATRIX_CUSTOM_CUSTOM_GRADIENT: 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); rgb_matrix_mode(RGB_MATRIX_CUSTOM_COOL_DIAGONAL);
return false; return false;
case RGB_MATRIX_CUSTOM_COOL_DIAGONAL: 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); rgb_matrix_mode(RGB_MATRIX_CUSTOM_KITT);
return false; return false;
case RGB_MATRIX_CUSTOM_KITT: case RGB_MATRIX_CUSTOM_KITT:

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by

View file

@ -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); }

View file

@ -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);
}

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by

View file

@ -15,8 +15,8 @@
*/ */
// OLED animation // OLED animation
#include "lib/bongocat.c" #include "lib/bongocat.h"
#include "lib/galaxy.c" #include "lib/galaxy.h"
#include "lib/wave.c" #include "lib/wave.c"
#ifdef OLED_ENABLE #ifdef OLED_ENABLE

View file

@ -4,7 +4,7 @@ Keymap is default 87 qwerty, TKL layout
It have new LED effect: It have new LED effect:
- Custom gradient (ported from SirTimmyTimbit code [https://github.com/SirTimmyTimbit/customizable-gradient-effect-for-drop-alt]) - 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]) - 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/]) - 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) - Random breath rainbow (based from daed code [https://github.com/daed/qmk_firmware/blob/master/keyboards/massdrop/alt/keymaps/daed] and modify by me)

View file

@ -1,14 +1,14 @@
RGB_MATRIX_EFFECT(CUSTOM_GRADIENT) RGB_MATRIX_EFFECT(CUSTOM_GRADIENT)
RGB_MATRIX_EFFECT(DIAGONAL)
RGB_MATRIX_EFFECT(COOL_DIAGONAL) RGB_MATRIX_EFFECT(COOL_DIAGONAL)
RGB_MATRIX_EFFECT(FLOWER_BLOOMING)
RGB_MATRIX_EFFECT(KITT) RGB_MATRIX_EFFECT(KITT)
RGB_MATRIX_EFFECT(RANDOM_BREATH_RAINBOW) RGB_MATRIX_EFFECT(RANDOM_BREATH_RAINBOW)
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#include "led/custom_gradient.c" #include "led/custom_gradient.c"
#include "led/diagonal.c"
#include "led/cool_diagonal.c" #include "led/cool_diagonal.c"
#include "led/flower_blooming/flower_blooming.c"
#include "led/kitt.c" #include "led/kitt.c"
#include "led/random_breath_rainbow.c" #include "led/random_breath_rainbow.c"

View file

@ -1 +1,4 @@
SRC += lib/bongocat.c
SRC += lib/galaxy.c
RGB_MATRIX_CUSTOM_USER = yes RGB_MATRIX_CUSTOM_USER = yes

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by

View file

@ -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 * 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 * 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 */ /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */
[_FN] = LAYOUT_tkl_ansi( [_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, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SPD, RGB_SPI, _______, RGB_C_E, _______, _______,
_______, G1_HUD, G1_HUI, G1_SAD, G1_SAI, G1_VAD, G1_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, TG(_WAVE), _______, 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, _______, _______, _______, _______, _______, _______, _______, G2_HUD, G2_HUI, G2_SAD, G2_SAI, G2_VAD, G2_VAI, _______, _______, _______, _______, _______, _______,

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by
@ -27,9 +27,9 @@
// entirely and just use numbers. // entirely and just use numbers.
enum layer_names { enum layer_names {
_BASE = 0, _BASE,
_WAVE = 1, _WAVE,
_FN = 2 _FN,
}; };
// For CUSTOM_GRADIENT // For CUSTOM_GRADIENT
@ -212,12 +212,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) { if (record->event.pressed) {
switch (rgb_matrix_get_mode()) { switch (rgb_matrix_get_mode()) {
case RGB_MATRIX_CUSTOM_CUSTOM_GRADIENT: 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); rgb_matrix_mode(RGB_MATRIX_CUSTOM_COOL_DIAGONAL);
return false; return false;
case RGB_MATRIX_CUSTOM_COOL_DIAGONAL: 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); rgb_matrix_mode(RGB_MATRIX_CUSTOM_KITT);
return false; return false;
case RGB_MATRIX_CUSTOM_KITT: case RGB_MATRIX_CUSTOM_KITT:

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by

View file

@ -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); }

View file

@ -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);
}

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by
@ -15,8 +15,8 @@
*/ */
// OLED animation // OLED animation
#include "lib/bongocat.c" #include "lib/bongocat.h"
#include "lib/galaxy.c" #include "lib/galaxy.h"
#include "lib/wave.c" #include "lib/wave.c"
#ifdef OLED_ENABLE #ifdef OLED_ENABLE

View file

@ -4,7 +4,7 @@ Keymap is default 87 qwerty, TKL layout
It have new LED effect: It have new LED effect:
- Custom gradient (ported from SirTimmyTimbit code [https://github.com/SirTimmyTimbit/customizable-gradient-effect-for-drop-alt]) - 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]) - 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/]) - 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) - Random breath rainbow (based from daed code [https://github.com/daed/qmk_firmware/blob/master/keyboards/massdrop/alt/keymaps/daed] and modify by me)

View file

@ -1,14 +1,14 @@
RGB_MATRIX_EFFECT(CUSTOM_GRADIENT) RGB_MATRIX_EFFECT(CUSTOM_GRADIENT)
RGB_MATRIX_EFFECT(DIAGONAL)
RGB_MATRIX_EFFECT(COOL_DIAGONAL) RGB_MATRIX_EFFECT(COOL_DIAGONAL)
RGB_MATRIX_EFFECT(FLOWER_BLOOMING)
RGB_MATRIX_EFFECT(KITT) RGB_MATRIX_EFFECT(KITT)
RGB_MATRIX_EFFECT(RANDOM_BREATH_RAINBOW) RGB_MATRIX_EFFECT(RANDOM_BREATH_RAINBOW)
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#include "led/custom_gradient.c" #include "led/custom_gradient.c"
#include "led/diagonal.c"
#include "led/cool_diagonal.c" #include "led/cool_diagonal.c"
#include "led/flower_blooming/flower_blooming.c"
#include "led/kitt.c" #include "led/kitt.c"
#include "led/random_breath_rainbow.c" #include "led/random_breath_rainbow.c"

View file

@ -1,3 +1,6 @@
SRC += lib/bongocat.c
SRC += lib/galaxy.c
VIA_ENABLE = yes VIA_ENABLE = yes
RGB_MATRIX_CUSTOM_USER = yes RGB_MATRIX_CUSTOM_USER = yes

View file

@ -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 * 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 * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "quantum.h"
// WPM-responsive animation stuff here // WPM-responsive animation stuff here
# define IDLE_FRAMES 5 # define IDLE_FRAMES 5
# define IDLE_SPEED 10 // below this wpm value your animation will idle # 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- // 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 // replace numbers in brackets with your own
// if you start getting errors when compiling make sure you didn't accedentally delete a bracket // 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] = { static const char PROGMEM idle[IDLE_FRAMES][ANIM_SIZE] = {
{ {
//Idle 1 - 128x32 //Idle 1 - 128x32

View file

@ -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 * 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 * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
static HSV DIAGONAL_math(HSV hsv, uint8_t i, uint8_t time) { void render_bongocat(void);
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); }

View file

@ -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 * 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 * 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/>. * 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 # 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] = { static const char PROGMEM galaxy[][ANIM_SIZE] = {
{ {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x80, 0xc8, 0xe8, 0x49, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x80, 0xc8, 0xe8, 0x49, 0x72,

View file

@ -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 * 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 * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
static HSV DIAGONAL_math(HSV hsv, uint8_t i, uint8_t time) { void render_galaxy(void);
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); }

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by

View file

@ -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 * 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 * 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/>. * 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 # 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] = { static const char PROGMEM redragon[][ANIM_SIZE] = {
{ {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xc0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xc0, 0xc0, 0x80,

View file

@ -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);

View file

@ -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 * 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 * it under the terms of the GNU General Public License as published by
@ -25,3 +25,9 @@
#undef STM32_I2C_USE_I2C2 #undef STM32_I2C_USE_I2C2
#define STM32_I2C_USE_I2C2 TRUE #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

View file

@ -17,6 +17,6 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to
Enter the bootloader in 3 ways: 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 * **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 * **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available

View file

@ -1,11 +1,17 @@
SRC += lib/logo.c
# MCU name # MCU name
MCU = STM32F103 MCU = STM32F103
MCU_LDSCRIPT = k552_f103
BOARD = k552
# Bootloader selection # 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 # Build Options
# change yes to no to disable # change yes to no to disable
@ -19,8 +25,9 @@ NKRO_ENABLE = yes # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output 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 enabled
RGB_MATRIX_ENABLE = yes RGB_MATRIX_ENABLE = yes
@ -31,4 +38,8 @@ OLED_ENABLE = yes
OLED_DRIVER = SSD1306 OLED_DRIVER = SSD1306
WPM_ENABLE = yes WPM_ENABLE = yes
# Wear-levelling driver
EEPROM_DRIVER = wear_leveling
WEAR_LEVELING_DRIVER = spi_flash
LAYOUTS = tkl_ansi LAYOUTS = tkl_ansi