diff --git a/doc/releases/release-notes-4.2.rst b/doc/releases/release-notes-4.2.rst index 0514cf8a77d..77e24f2cec0 100644 --- a/doc/releases/release-notes-4.2.rst +++ b/doc/releases/release-notes-4.2.rst @@ -212,6 +212,10 @@ New APIs and options * :kconfig:option:`CONFIG_NVME_PRP_PAGE_SIZE` +* Other + + * :kconfig:option:`CONFIG_LV_Z_COLOR_MONO_HW_INVERSION` + New Boards ********** diff --git a/modules/lvgl/Kconfig b/modules/lvgl/Kconfig index 8084dd11a33..01e1ef004df 100644 --- a/modules/lvgl/Kconfig +++ b/modules/lvgl/Kconfig @@ -94,6 +94,10 @@ config LV_COLOR_16_SWAP bool "Swap the 2 bytes of RGB565 color." depends on LV_COLOR_DEPTH_16 +config LV_Z_COLOR_MONO_HW_INVERSION + bool "Hardware pixel inversion (disables software pixel inversion)." + depends on LV_COLOR_DEPTH_1 + config LV_Z_FLUSH_THREAD bool "Flush LVGL frames in a separate thread" help diff --git a/modules/lvgl/lvgl_display_mono.c b/modules/lvgl/lvgl_display_mono.c index 09b9bfd2337..069a0eea28b 100644 --- a/modules/lvgl/lvgl_display_mono.c +++ b/modules/lvgl/lvgl_display_mono.c @@ -38,17 +38,25 @@ static ALWAYS_INLINE void set_px_at_pos(uint8_t *dst_buf, uint32_t x, uint32_t y } } +#ifdef CONFIG_LV_Z_COLOR_MONO_HW_INVERSION + *buf |= BIT(bit); +#else if (caps->current_pixel_format == PIXEL_FORMAT_MONO10) { *buf |= BIT(bit); } else { *buf &= ~BIT(bit); } +#endif } static void lvgl_transform_buffer(uint8_t **px_map, uint32_t width, uint32_t height, const struct display_capabilities *caps) { +#ifdef CONFIG_LV_Z_COLOR_MONO_HW_INVERSION + uint8_t clear_color = 0x00; +#else uint8_t clear_color = caps->current_pixel_format == PIXEL_FORMAT_MONO10 ? 0x00 : 0xFF; +#endif memset(mono_conv_buf, clear_color, mono_conv_buf_size);