diff options
author | Nick Brassel <nick@tzarc.org> | 2022-09-19 07:30:08 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-19 07:30:08 +1000 |
commit | 1849897444629403fc2e473da6d6f74f8f4f1b8c (patch) | |
tree | 6eeb53a35498b557dfc1e09031d11894ceb21209 /drivers/painter/generic/qp_rgb565_surface.h | |
parent | e9bdc4eeb14b12d49d7841c5a0090a68c25ff7ae (diff) |
[QP] Add RGB565 surface. Docs clarification, cleanup, tabsification, and reordering. (#18396)
Diffstat (limited to 'drivers/painter/generic/qp_rgb565_surface.h')
-rw-r--r-- | drivers/painter/generic/qp_rgb565_surface.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/painter/generic/qp_rgb565_surface.h b/drivers/painter/generic/qp_rgb565_surface.h new file mode 100644 index 0000000000..19e919bb91 --- /dev/null +++ b/drivers/painter/generic/qp_rgb565_surface.h @@ -0,0 +1,42 @@ +// Copyright 2022 Nick Brassel (@tzarc) +// SPDX-License-Identifier: GPL-2.0-or-later +#include "qp_internal.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Quantum Painter RGB565 surface configurables (add to your keyboard's config.h) + +#ifndef RGB565_SURFACE_NUM_DEVICES +/** + * @def This controls the maximum number of surface devices that Quantum Painter can use at any one time. + * Increasing this number allows for multiple framebuffers to be used. Each requires its own RAM allocation. + */ +# define RGB565_SURFACE_NUM_DEVICES 1 +#endif + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Forward declarations + +#ifdef QUANTUM_PAINTER_RGB565_SURFACE_ENABLE +/** + * Factory method for an RGB565 surface (aka framebuffer). + * + * @param panel_width[in] the width of the display panel + * @param panel_height[in] the height of the display panel + * @param buffer[in] pointer to a preallocated buffer of size `(sizeof(uint16_t) * panel_width * panel_height)` + * @return the device handle used with all drawing routines in Quantum Painter + */ +painter_device_t qp_rgb565_make_surface(uint16_t panel_width, uint16_t panel_height, void *buffer); + +/** + * Helper method to draw the dirty contents of the framebuffer to the target device. + * + * After successful completion, the dirty area is reset. + * + * @param surface[in] the surface to copy from + * @param display[in] the display to copy into + * @param x[in] the x-location of the original position of the framebuffer + * @param y[in] the y-location of the original position of the framebuffer + * @return whether the draw operation completed successfully + */ +bool qp_rgb565_surface_draw(painter_device_t surface, painter_device_t display, uint16_t x, uint16_t y); +#endif // QUANTUM_PAINTER_RGB565_SURFACE_ENABLE |