From 1849897444629403fc2e473da6d6f74f8f4f1b8c Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Mon, 19 Sep 2022 07:30:08 +1000 Subject: [QP] Add RGB565 surface. Docs clarification, cleanup, tabsification, and reordering. (#18396) --- drivers/painter/tft_panel/qp_tft_panel.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/painter/tft_panel') 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; } -- cgit v1.2.3