diff --git a/docs/src/main-modules/display/color_format.rst b/docs/src/main-modules/display/color_format.rst index 99cf3d0a2e..5ee291da94 100644 --- a/docs/src/main-modules/display/color_format.rst +++ b/docs/src/main-modules/display/color_format.rst @@ -30,12 +30,13 @@ Swapping Endian-ness In case of RGB565 color format it might be required to swap the 2 bytes because the SPI, I2C or 8 bit parallel port periphery sends them in the wrong order. -The ideal solution is to configure the hardware to handle the 16-bit data with a different byte order, -however if this is not possible :cpp:expr:`lv_draw_sw_rgb565_swap(buf, buf_size_in_px)` -can be called in the :ref:`flush_callback` to swap the bytes. +This usually requires calling :cpp:expr:`lv_draw_sw_rgb565_swap(buf, buf_size_in_px)` +inside the :ref:`flush_callback`, implementing a custom function to swap the bytes or +using the correct color format. -If you wish you can also write your own function, or use assembly instructions for -the fastest possible byte swapping. +LVGL supports the :c:macro:`LV_COLOR_FORMAT_RGB565_SWAPPED` color format natively. +By using this color format, no manual byte swapping is needed at all, +simplifying display drivers and eliminating software overhead. Note that this is not about swapping the Red and Blue channel but converting @@ -159,6 +160,7 @@ API .. API equals: LV_COLOR_DEPTH LV_COLOR_FORMAT_ARGB8888 + LV_COLOR_FORMAT_RGB565_SWAPPED lv_display_set_buffers lv_display_set_color_depth lv_display_set_color_format