idk what the fuck im doing bro

This commit is contained in:
Shmokebud 2025-06-19 16:32:05 -04:00
parent 61f24ed76d
commit 1bcc8f876b
3 changed files with 84 additions and 8 deletions

View file

@ -16,6 +16,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "nyanners.qgf.h"
#include "mouse.qgf.h"
#define display = qp_st7789_make_spi_device(320, 240, LCD_CS_PIN, LCD_DC_PIN, LCD_RST_PIN, LCD_SPI_DIVISOR, 3)
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@ -52,3 +54,40 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
// this function is called whenever there's a layer change
layer_state_t layer_state_set_user(layer_state_t state) {
// lets load a different image based on the current layer
//
// needless to say, change the layer->image mapping as you like
// i've put some random things here
const uint8_t *gfx = NULL;
switch (get_highest_layer(default_layer_state | state)) {
case 0:
gfx = gfx_bao;
break;
case 1:
gfx = gfx_nyanners;
break;
case 2:
gfx = gfx_numi;
break;
case 3:
gfx = gfx_mouse;
break;
default:
break;
}
// if we can't load, exit without drawing
painter_image_handle_t image = qp_load_image_mem(gfx);
if (image != NULL) {
qp_drawimage(display, 0, 0, bao); // fill up the arguments
qp_load_image_mem(image);
}
return state;
}

View file

@ -6,3 +6,7 @@ QUANTUM_PAINTER_DRIVERS += st7789_spi
POINTING_DEVICE_DRIVER = cirque_pinnacle_spi
POINTING_DEVICE_ENABLE = yes
VIALRGB_ENABLE = yes
SRC += bao.qgf.c
SRC += numi.qgf.c
SRC += mouse.qgf.c
SRC += nyanners.qgf.c

View file

@ -169,6 +169,8 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
return true;
}
#endif
#ifdef QUANTUM_PAINTER_ENABLE
#include "bao.qgf.c"
@ -179,8 +181,10 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
static painter_device_t display;
static painter_image_handle_t image;
// st7789 enable, comment out the following line if not using a st7789
painter_device_t qp_st7789_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode);
// gc9a01 enable, comment out the following line if not using a gc9a01
// painter_device_t qp_gc9a01_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode);
void keyboard_post_init_user(void) {
// Customise these values to desired behaviour
@ -195,8 +199,9 @@ uint32_t deferred_init(uint32_t trigger_time, void *cb_arg) {
print("doing stuff\n");
// ##st7789 sc
#endif
reen support, comment out this section if not using a st7789 screen
display = qp_st7789_make_spi_device(320, 240, LCD_CS_PIN, LCD_DC_PIN, LCD_RST_PIN, LCD_SPI_DIVISOR, 3);
if (is_keyboard_left()) {
qp_power(display, true);
@ -204,21 +209,50 @@ reen support, comment out this section if not using a st7789 screen
if (is_keyboard_left()) {
qp_init(display, QP_ROTATION_270);
}
// If using pointing device on right side, comment out following 3 lines
// else {
// qp_init(display, QP_ROTATION_0);
// }
if (is_keyboard_left()) {
image = qp_load_image_mem(gfx_bao);
image = qp_load_image_mem(gfx_nyanners);
image = qp_load_image_mem(gfx_mouse);
image = qp_load_image_mem(gfx_numi);
}
// If using pointing device on right side, comment out following 3 lines
// else {
// image = qp_load_image_mem(gfx_ZodiarkPiLogoSTpink);
// }
//S ##end st7789 screen support
// ##gc9a01 screeen support, comment out this section if not using a gc9a01 screen
// display = qp_gc9a01_make_spi_device(240, 240, LCD_CS_PIN, LCD_DC_PIN, LCD_RST_PIN, LCD_SPI_DIVISOR, 0);
// qp_power(display, true);
// if (is_keyboard_left()) {
// qp_init(display, QP_ROTATION_0);
// }
// If using pointing device on right side, comment out following 3 lines
// else {
// qp_init(display, QP_ROTATION_0);
// }
// if (is_keyboard_left()) {
// image = qp_load_image_mem(gfx_ZodiarkPiLogoGC);
// }
// If using pointing device on right side, comment out following 3 lines
// else {
// image = qp_load_image_mem(gfx_ZodiarkPiLogoGC);
// }
// ##end GC9A01 screeen support
if (image != NULL) {
print("image was not null\n");
if (is_keyboard_left()) {
qp
#endif
_drawimage(display, 0, 0, image);
if (is_keyboard_left()) {qp_drawimage(display, 0, 0, image);
}
// If using pointing device on right side, comment out following 3 lines
// else {
// qp_drawimage(display, 0, 0, image);
// }
}
@ -230,4 +264,3 @@ void keyboard_post_init_kb(void)
debug_enable=true;
defer_exec(3000, deferred_init, NULL);
}
#endif