From 0bb20d982b8ae8e426e5bbf6c8f155ec70760c65 Mon Sep 17 00:00:00 2001 From: Sadek Baroudi Date: Sun, 29 Oct 2023 18:54:05 -0700 Subject: [PATCH] added waveshare 22224 display module vik support --- .../fingerpunch/src/display/fp_display.c | 4 +++ .../fingerpunch/src/display/waveshare_22224.c | 28 +++++++++++++++++++ .../fingerpunch/src/display/waveshare_22224.h | 18 ++++++++++++ keyboards/fingerpunch/src/vik/config.h | 12 ++++++++ keyboards/fingerpunch/src/vik/rules.mk | 10 +++++++ keyboards/fingerpunch/svlinky/fp_build.json | 3 +- keyboards/fingerpunch/svlinky/readme.md | 1 + 7 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 keyboards/fingerpunch/src/display/waveshare_22224.c create mode 100644 keyboards/fingerpunch/src/display/waveshare_22224.h diff --git a/keyboards/fingerpunch/src/display/fp_display.c b/keyboards/fingerpunch/src/display/fp_display.c index fef050b8c6..055a8950f6 100644 --- a/keyboards/fingerpunch/src/display/fp_display.c +++ b/keyboards/fingerpunch/src/display/fp_display.c @@ -27,6 +27,10 @@ #include "keyboards/fingerpunch/src/display/gc9a01.h" #endif +#ifdef VIK_WAVESHARE_22224 +#include "keyboards/fingerpunch/src/display/waveshare_22224.h" +#endif + extern painter_device_t fp_qp_disp_device; void fp_post_init_qp(void) { diff --git a/keyboards/fingerpunch/src/display/waveshare_22224.c b/keyboards/fingerpunch/src/display/waveshare_22224.c new file mode 100644 index 0000000000..00f8b7d2aa --- /dev/null +++ b/keyboards/fingerpunch/src/display/waveshare_22224.c @@ -0,0 +1,28 @@ +/* Copyright 2023 Sadek Baroudi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "keyboards/fingerpunch/src/display/fp_display.h" +#include "keyboards/fingerpunch/src/display/waveshare_22224.h" + +#ifdef QUANTUM_PAINTER_ENABLE +#include "qp.h" + +painter_device_t fp_qp_disp_device; + +void fp_qp_init_display(void) { + fp_qp_disp_device = qp_st7789_make_spi_device(FP_QP_DISPLAY_WIDTH, FP_QP_DISPLAY_HEIGHT, DISPLAY_CS_PIN, DISPLAY_DC_PIN, DISPLAY_RST_PIN, 8, 3); +} +#endif \ No newline at end of file diff --git a/keyboards/fingerpunch/src/display/waveshare_22224.h b/keyboards/fingerpunch/src/display/waveshare_22224.h new file mode 100644 index 0000000000..efcd66f07b --- /dev/null +++ b/keyboards/fingerpunch/src/display/waveshare_22224.h @@ -0,0 +1,18 @@ +/* Copyright 2023 Sadek Baroudi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#define FP_QP_DISPLAY_WIDTH 200 +#define FP_QP_DISPLAY_HEIGHT 320 diff --git a/keyboards/fingerpunch/src/vik/config.h b/keyboards/fingerpunch/src/vik/config.h index a7d473d9b2..dd8e807243 100644 --- a/keyboards/fingerpunch/src/vik/config.h +++ b/keyboards/fingerpunch/src/vik/config.h @@ -129,3 +129,15 @@ // To dynamically control the backlight with BL_TOGG keycode #define DISPLAY_RST_PIN VIK_GPIO_2 #endif + +#ifdef VIK_WAVESHARE_22224 + // /* LCD config */ + #define DISPLAY_CS_PIN VIK_SPI_CS + #define DISPLAY_DC_PIN VIK_GPIO_1 + + // To dynamically control the backlight with BL_TOGG keycode + #define BACKLIGHT_PIN VIK_GPIO_2 + + // Must be defined by the keyboard itself, needs a free unused pin for reset + #define DISPLAY_RST_PIN VIK_ST7735_UNUSED_PIN +#endif diff --git a/keyboards/fingerpunch/src/vik/rules.mk b/keyboards/fingerpunch/src/vik/rules.mk index 17e524fa48..9638068b91 100644 --- a/keyboards/fingerpunch/src/vik/rules.mk +++ b/keyboards/fingerpunch/src/vik/rules.mk @@ -9,6 +9,7 @@ # VIK_PMW3360 # VIK_WEACT_ST7735 # VIK_VIK_GC9A01 +# VIK_WAVESHARE_22224 ifeq ($(strip $(VIK_HAPTIC)), yes) HAPTIC_ENABLE = yes @@ -56,6 +57,15 @@ ifeq ($(strip $(VIK_GC9A01)), yes) OPT_DEFS += -DVIK_GC9A01 endif +ifeq ($(strip $(VIK_WAVESHARE_22224)), yes) + QUANTUM_PAINTER_ENABLE = yes + QUANTUM_PAINTER_DRIVERS += st7789_spi + QUANTUM_PAINTER_LVGL_INTEGRATION = yes + SRC += keyboards/fingerpunch/src/display/waveshare_22224.c +# WPM_ENABLE = yes + OPT_DEFS += -DVIK_WAVESHARE_22224 +endif + ifeq ($(strip $(PMW3360_ENABLE)), yes) POINTING_DEVICE_ENABLE := yes POINTING_DEVICE_DRIVER := pmw3360 diff --git a/keyboards/fingerpunch/svlinky/fp_build.json b/keyboards/fingerpunch/svlinky/fp_build.json index 969bfe07cd..8dc0f5467c 100644 --- a/keyboards/fingerpunch/svlinky/fp_build.json +++ b/keyboards/fingerpunch/svlinky/fp_build.json @@ -7,8 +7,9 @@ "VIK_PMW3360", "VIK_WEACT_ST7735", "VIK_GC9A01", + "VIK_WAVESHARE_22224", "VIK_HAPTIC" ], - "user_input": "Which VIK module are you testing? NONE, VIK_PER56_CIRQUE_LEDS, VIK_PER56_PMW3360_LEDS, VIK_PMW3360, VIK_WEACT_ST7735, VIK_GC9A01, VIK_HAPTIC" + "user_input": "Which VIK module are you testing? NONE, VIK_PER56_CIRQUE_LEDS, VIK_PER56_PMW3360_LEDS, VIK_PMW3360, VIK_WEACT_ST7735, VIK_GC9A01, VIK_WAVESHARE_22224, VIK_HAPTIC" } ] diff --git a/keyboards/fingerpunch/svlinky/readme.md b/keyboards/fingerpunch/svlinky/readme.md index 0ef8cd9c98..4a89dc1114 100644 --- a/keyboards/fingerpunch/svlinky/readme.md +++ b/keyboards/fingerpunch/svlinky/readme.md @@ -28,6 +28,7 @@ Options are: VIK_PMW3360=yes VIK_WEACT_ST7735=yes VIK_GC9A01=yes + VIK_WAVESHARE_22224=yes VIK_HAPTIC=yes ```