From 02525f683e7ad1a2f032dfe8663b0303d1714a7d Mon Sep 17 00:00:00 2001 From: HorrorTroll Date: Sun, 11 May 2025 01:26:50 +0700 Subject: [PATCH] Allow LVGL onekey keymap to be able compile for other board (#25005) --- .../handwired/onekey/at_start_f415/config.h | 14 ++++++++++++ .../handwired/onekey/at_start_f415/halconf.h | 3 +++ .../onekey/at_start_f415/keyboard.json | 2 +- .../handwired/onekey/at_start_f415/mcuconf.h | 3 +++ keyboards/handwired/onekey/kb2040/config.h | 10 +++++++++ keyboards/handwired/onekey/kb2040/halconf.h | 22 +++++++++++++++++++ keyboards/handwired/onekey/kb2040/mcuconf.h | 3 +++ .../handwired/onekey/keymaps/lvgl/config.h | 15 ------------- .../handwired/onekey/keymaps/lvgl/halconf.h | 12 ---------- .../handwired/onekey/keymaps/lvgl/mcuconf.h | 9 -------- keyboards/handwired/onekey/rp2040/config.h | 11 ++++++++++ keyboards/handwired/onekey/rp2040/halconf.h | 5 +++++ keyboards/handwired/onekey/rp2040/mcuconf.h | 3 +++ 13 files changed, 75 insertions(+), 37 deletions(-) create mode 100644 keyboards/handwired/onekey/kb2040/halconf.h delete mode 100644 keyboards/handwired/onekey/keymaps/lvgl/config.h delete mode 100644 keyboards/handwired/onekey/keymaps/lvgl/halconf.h delete mode 100644 keyboards/handwired/onekey/keymaps/lvgl/mcuconf.h diff --git a/keyboards/handwired/onekey/at_start_f415/config.h b/keyboards/handwired/onekey/at_start_f415/config.h index 41aece900cf..7e41e7da897 100644 --- a/keyboards/handwired/onekey/at_start_f415/config.h +++ b/keyboards/handwired/onekey/at_start_f415/config.h @@ -4,11 +4,25 @@ #pragma once +/* ADC pin */ #define ADC_PIN A0 +/* Backlight configs */ #define BACKLIGHT_PWM_DRIVER PWMD5 #define BACKLIGHT_PWM_CHANNEL 1 +/* LCD configs */ +#define LCD_RST_PIN A2 +#define LCD_DC_PIN A3 +#define LCD_CS_PIN A4 + +/* SPI pins */ +#define SPI_DRIVER SPID1 +#define SPI_SCK_PIN A5 +#define SPI_MOSI_PIN A7 +#define SPI_MISO_PIN A6 + +/* Haptic configs */ #define SOLENOID_PIN B12 #define SOLENOID_PINS { B12, B13, B14, B15 } #define SOLENOID_PINS_ACTIVE_STATE { high, high, low } diff --git a/keyboards/handwired/onekey/at_start_f415/halconf.h b/keyboards/handwired/onekey/at_start_f415/halconf.h index e3c075936dc..1fc1b548a2f 100644 --- a/keyboards/handwired/onekey/at_start_f415/halconf.h +++ b/keyboards/handwired/onekey/at_start_f415/halconf.h @@ -10,4 +10,7 @@ #define HAL_USE_PWM TRUE +#define HAL_USE_SPI TRUE +#define SPI_USE_WAIT TRUE + #include_next diff --git a/keyboards/handwired/onekey/at_start_f415/keyboard.json b/keyboards/handwired/onekey/at_start_f415/keyboard.json index 6e5683a4742..8024e776a83 100644 --- a/keyboards/handwired/onekey/at_start_f415/keyboard.json +++ b/keyboards/handwired/onekey/at_start_f415/keyboard.json @@ -16,7 +16,7 @@ }, "ws2812": { "pin": "B0" - } + }, "apa102": { "data_pin": "B0", "clock_pin": "B1" diff --git a/keyboards/handwired/onekey/at_start_f415/mcuconf.h b/keyboards/handwired/onekey/at_start_f415/mcuconf.h index 246f6762d32..8f6333ca010 100644 --- a/keyboards/handwired/onekey/at_start_f415/mcuconf.h +++ b/keyboards/handwired/onekey/at_start_f415/mcuconf.h @@ -14,3 +14,6 @@ #undef AT32_PWM_USE_TMR5 #define AT32_PWM_USE_TMR5 TRUE + +#undef AT32_SPI_USE_SPI1 +#define AT32_SPI_USE_SPI1 TRUE diff --git a/keyboards/handwired/onekey/kb2040/config.h b/keyboards/handwired/onekey/kb2040/config.h index e9c4eef273c..a9508bc4ccb 100644 --- a/keyboards/handwired/onekey/kb2040/config.h +++ b/keyboards/handwired/onekey/kb2040/config.h @@ -16,3 +16,13 @@ #define I2C1_SDA_PIN GP12 #define I2C1_SCL_PIN GP13 +/* LCD configs */ +#define LCD_RST_PIN GP0 +#define LCD_DC_PIN GP1 +#define LCD_CS_PIN GP2 + +/* SPI pins */ +#define SPI_DRIVER SPID0 +#define SPI_SCK_PIN GP18 +#define SPI_MOSI_PIN GP19 +#define SPI_MISO_PIN GP20 diff --git a/keyboards/handwired/onekey/kb2040/halconf.h b/keyboards/handwired/onekey/kb2040/halconf.h new file mode 100644 index 00000000000..ce781aa3747 --- /dev/null +++ b/keyboards/handwired/onekey/kb2040/halconf.h @@ -0,0 +1,22 @@ +/* Copyright 2020 QMK + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define HAL_USE_SPI TRUE +#define SPI_USE_WAIT TRUE + +#include_next diff --git a/keyboards/handwired/onekey/kb2040/mcuconf.h b/keyboards/handwired/onekey/kb2040/mcuconf.h index 57e58e14d78..cc44ce77c37 100644 --- a/keyboards/handwired/onekey/kb2040/mcuconf.h +++ b/keyboards/handwired/onekey/kb2040/mcuconf.h @@ -22,3 +22,6 @@ #undef RP_I2C_USE_I2C1 #define RP_I2C_USE_I2C1 TRUE + +#undef RP_SPI_USE_SPI0 +#define RP_SPI_USE_SPI0 TRUE diff --git a/keyboards/handwired/onekey/keymaps/lvgl/config.h b/keyboards/handwired/onekey/keymaps/lvgl/config.h deleted file mode 100644 index 38bb5d0cf35..00000000000 --- a/keyboards/handwired/onekey/keymaps/lvgl/config.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2022 Jose Pablo Ramirez (@jpe230) -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -/* SPI pins */ -#define SPI_DRIVER SPID0 -#define SPI_SCK_PIN GP18 -#define SPI_MOSI_PIN GP19 -#define SPI_MISO_PIN GP20 - -/* LCD Configuration */ -#define LCD_RST_PIN GP0 -#define LCD_DC_PIN GP1 -#define LCD_CS_PIN GP2 diff --git a/keyboards/handwired/onekey/keymaps/lvgl/halconf.h b/keyboards/handwired/onekey/keymaps/lvgl/halconf.h deleted file mode 100644 index 27646bb3f51..00000000000 --- a/keyboards/handwired/onekey/keymaps/lvgl/halconf.h +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2022 Jose Pablo Ramirez (@jpe230) -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include_next - -#undef HAL_USE_SPI -#define HAL_USE_SPI TRUE - -#undef SPI_USE_WAIT -#define SPI_USE_WAIT TRUE diff --git a/keyboards/handwired/onekey/keymaps/lvgl/mcuconf.h b/keyboards/handwired/onekey/keymaps/lvgl/mcuconf.h deleted file mode 100644 index bff74867ff0..00000000000 --- a/keyboards/handwired/onekey/keymaps/lvgl/mcuconf.h +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2022 Jose Pablo Ramirez (@jpe230) -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include_next - -#undef RP_SPI_USE_SPI0 -#define RP_SPI_USE_SPI0 TRUE diff --git a/keyboards/handwired/onekey/rp2040/config.h b/keyboards/handwired/onekey/rp2040/config.h index 0030e97b0fe..974fc688d3c 100644 --- a/keyboards/handwired/onekey/rp2040/config.h +++ b/keyboards/handwired/onekey/rp2040/config.h @@ -17,3 +17,14 @@ #define AUDIO_PWM_CHANNEL RP2040_PWM_CHANNEL_A #define ADC_PIN GP26 + +/* LCD configs */ +#define LCD_RST_PIN GP0 +#define LCD_DC_PIN GP1 +#define LCD_CS_PIN GP2 + +/* SPI pins */ +#define SPI_DRIVER SPID0 +#define SPI_SCK_PIN GP18 +#define SPI_MOSI_PIN GP19 +#define SPI_MISO_PIN GP20 diff --git a/keyboards/handwired/onekey/rp2040/halconf.h b/keyboards/handwired/onekey/rp2040/halconf.h index ec56be2263f..da4a49b5c19 100644 --- a/keyboards/handwired/onekey/rp2040/halconf.h +++ b/keyboards/handwired/onekey/rp2040/halconf.h @@ -4,7 +4,12 @@ #pragma once #define HAL_USE_I2C TRUE + #define HAL_USE_PWM TRUE + #define HAL_USE_ADC TRUE +#define HAL_USE_SPI TRUE +#define SPI_USE_WAIT TRUE + #include_next diff --git a/keyboards/handwired/onekey/rp2040/mcuconf.h b/keyboards/handwired/onekey/rp2040/mcuconf.h index e24a0d4f24e..c1d22657ca0 100644 --- a/keyboards/handwired/onekey/rp2040/mcuconf.h +++ b/keyboards/handwired/onekey/rp2040/mcuconf.h @@ -10,3 +10,6 @@ #undef RP_PWM_USE_PWM4 #define RP_PWM_USE_PWM4 TRUE + +#undef RP_SPI_USE_SPI0 +#define RP_SPI_USE_SPI0 TRUE