Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor entire Handwired K552 keyboard #18066

Merged
merged 5 commits into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
49 changes: 0 additions & 49 deletions keyboards/horrortroll/handwired_k552/boards/k552/board.c

This file was deleted.

145 changes: 0 additions & 145 deletions keyboards/horrortroll/handwired_k552/boards/k552/board.h

This file was deleted.

5 changes: 0 additions & 5 deletions keyboards/horrortroll/handwired_k552/boards/k552/board.mk

This file was deleted.

38 changes: 22 additions & 16 deletions keyboards/horrortroll/handwired_k552/config.h
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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 */
Expand Down
6 changes: 5 additions & 1 deletion keyboards/horrortroll/handwired_k552/halconf.h
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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>
4 changes: 2 additions & 2 deletions keyboards/horrortroll/handwired_k552/handwired_k552.c
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 = { {
Expand Down
2 changes: 1 addition & 1 deletion keyboards/horrortroll/handwired_k552/handwired_k552.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions keyboards/horrortroll/handwired_k552/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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, _______, _______, _______, _______, _______, _______,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -27,9 +27,9 @@
// entirely and just use numbers.

enum layer_names {
_BASE = 0,
_WAVE = 1,
_FN = 2
_BASE,
_WAVE,
_FN,
};

// For CUSTOM_GRADIENT
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading