summaryrefslogtreecommitdiffstats
path: root/drivers/painter/tft_panel
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2022-09-19 07:30:08 +1000
committerGitHub <noreply@github.com>2022-09-19 07:30:08 +1000
commit1849897444629403fc2e473da6d6f74f8f4f1b8c (patch)
tree6eeb53a35498b557dfc1e09031d11894ceb21209 /drivers/painter/tft_panel
parente9bdc4eeb14b12d49d7841c5a0090a68c25ff7ae (diff)
[QP] Add RGB565 surface. Docs clarification, cleanup, tabsification, and reordering. (#18396)
Diffstat (limited to 'drivers/painter/tft_panel')
-rw-r--r--drivers/painter/tft_panel/qp_tft_panel.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/painter/tft_panel/qp_tft_panel.c b/drivers/painter/tft_panel/qp_tft_panel.c
index ad83b6c792..e7c744ab34 100644
--- a/drivers/painter/tft_panel/qp_tft_panel.c
+++ b/drivers/painter/tft_panel/qp_tft_panel.c
@@ -7,8 +7,6 @@
#include "qp_draw.h"
#include "qp_tft_panel.h"
-#define BYTE_SWAP(x) (((((uint16_t)(x)) >> 8) & 0x00FF) | ((((uint16_t)(x)) << 8) & 0xFF00))
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Quantum Painter API implementations
@@ -94,7 +92,7 @@ bool qp_tft_panel_palette_convert_rgb565_swapped(painter_device_t device, int16_
for (int16_t i = 0; i < palette_size; ++i) {
RGB rgb = hsv_to_rgb_nocie((HSV){palette[i].hsv888.h, palette[i].hsv888.s, palette[i].hsv888.v});
uint16_t rgb565 = (((uint16_t)rgb.r) >> 3) << 11 | (((uint16_t)rgb.g) >> 2) << 5 | (((uint16_t)rgb.b) >> 3);
- palette[i].rgb565 = BYTE_SWAP(rgb565);
+ palette[i].rgb565 = __builtin_bswap16(rgb565);
}
return true;
}