summaryrefslogtreecommitdiff
path: root/keyboards/handwired/onekey/keymaps/lvgl
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/handwired/onekey/keymaps/lvgl')
-rw-r--r--keyboards/handwired/onekey/keymaps/lvgl/config.h15
-rw-r--r--keyboards/handwired/onekey/keymaps/lvgl/halconf.h12
-rw-r--r--keyboards/handwired/onekey/keymaps/lvgl/keymap.c50
-rw-r--r--keyboards/handwired/onekey/keymaps/lvgl/mcuconf.h9
-rw-r--r--keyboards/handwired/onekey/keymaps/lvgl/rules.mk3
5 files changed, 89 insertions, 0 deletions
diff --git a/keyboards/handwired/onekey/keymaps/lvgl/config.h b/keyboards/handwired/onekey/keymaps/lvgl/config.h
new file mode 100644
index 0000000000..38bb5d0cf3
--- /dev/null
+++ b/keyboards/handwired/onekey/keymaps/lvgl/config.h
@@ -0,0 +1,15 @@
+// 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
new file mode 100644
index 0000000000..27646bb3f5
--- /dev/null
+++ b/keyboards/handwired/onekey/keymaps/lvgl/halconf.h
@@ -0,0 +1,12 @@
+// Copyright 2022 Jose Pablo Ramirez (@jpe230)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include_next <halconf.h>
+
+#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/keymap.c b/keyboards/handwired/onekey/keymaps/lvgl/keymap.c
new file mode 100644
index 0000000000..be1ba48cf9
--- /dev/null
+++ b/keyboards/handwired/onekey/keymaps/lvgl/keymap.c
@@ -0,0 +1,50 @@
+// Copyright 2022 Jose Pablo Ramirez (@jpe230)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include QMK_KEYBOARD_H
+#include "qp.h"
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ LAYOUT_ortho_1x1(JS_BUTTON0)
+};
+
+painter_device_t lcd;
+
+void lv_example_arc_2(void);
+
+void keyboard_post_init_user(void) {
+ lcd = qp_gc9a01_make_spi_device(240, 240, LCD_CS_PIN, LCD_DC_PIN, LCD_RST_PIN, 4, 0);
+ qp_init(lcd, QP_ROTATION_0);
+ qp_rect(lcd, 0, 0, 239, 319, 0, 255, 255, true);
+
+ if (qp_lvgl_attach(lcd)) {
+ lv_example_arc_2();
+ }
+}
+
+static void set_angle(void* obj, int32_t v) {
+ lv_arc_set_value(obj, v);
+}
+
+/**
+ * Create an arc which acts as a loader.
+ */
+void lv_example_arc_2(void) {
+ /*Create an Arc*/
+ lv_obj_t* arc = lv_arc_create(lv_scr_act());
+ lv_arc_set_rotation(arc, 270);
+ lv_arc_set_bg_angles(arc, 0, 360);
+ lv_obj_remove_style(arc, NULL, LV_PART_KNOB); /*Be sure the knob is not displayed*/
+ lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE); /*To not allow adjusting by click*/
+ lv_obj_center(arc);
+
+ static lv_anim_t a;
+ lv_anim_init(&a);
+ lv_anim_set_var(&a, arc);
+ lv_anim_set_exec_cb(&a, set_angle);
+ lv_anim_set_time(&a, 1000);
+ lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); /*Just for the demo*/
+ lv_anim_set_repeat_delay(&a, 500);
+ lv_anim_set_values(&a, 0, 100);
+ lv_anim_start(&a);
+}
diff --git a/keyboards/handwired/onekey/keymaps/lvgl/mcuconf.h b/keyboards/handwired/onekey/keymaps/lvgl/mcuconf.h
new file mode 100644
index 0000000000..bff74867ff
--- /dev/null
+++ b/keyboards/handwired/onekey/keymaps/lvgl/mcuconf.h
@@ -0,0 +1,9 @@
+// Copyright 2022 Jose Pablo Ramirez (@jpe230)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include_next <mcuconf.h>
+
+#undef RP_SPI_USE_SPI0
+#define RP_SPI_USE_SPI0 TRUE
diff --git a/keyboards/handwired/onekey/keymaps/lvgl/rules.mk b/keyboards/handwired/onekey/keymaps/lvgl/rules.mk
new file mode 100644
index 0000000000..872d12ad6f
--- /dev/null
+++ b/keyboards/handwired/onekey/keymaps/lvgl/rules.mk
@@ -0,0 +1,3 @@
+QUANTUM_PAINTER_ENABLE = yes
+QUANTUM_PAINTER_LVGL_INTEGRATION = yes
+QUANTUM_PAINTER_DRIVERS = gc9a01_spi