Skip to content

Commit a0ba735

Browse files
vulporuzarlubos
authored andcommitted
[nrf fromtree] lvgl: Add config to disable monochrome pixel software inversion
In some cases, pixel inversion is managed by the display hardware and software inversion is not required. Signed-off-by: Robin-Charles Guihéneuf <[email protected]> (cherry picked from commit b0715dd)
1 parent dd5d9cf commit a0ba735

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

doc/releases/release-notes-4.2.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ New APIs and options
212212

213213
* :kconfig:option:`CONFIG_NVME_PRP_PAGE_SIZE`
214214

215+
* Other
216+
217+
* :kconfig:option:`CONFIG_LV_Z_COLOR_MONO_HW_INVERSION`
218+
215219
New Boards
216220
**********
217221

modules/lvgl/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ config LV_COLOR_16_SWAP
9494
bool "Swap the 2 bytes of RGB565 color."
9595
depends on LV_COLOR_DEPTH_16
9696

97+
config LV_Z_COLOR_MONO_HW_INVERSION
98+
bool "Hardware pixel inversion (disables software pixel inversion)."
99+
depends on LV_COLOR_DEPTH_1
100+
97101
config LV_Z_FLUSH_THREAD
98102
bool "Flush LVGL frames in a separate thread"
99103
help

modules/lvgl/lvgl_display_mono.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,25 @@ static ALWAYS_INLINE void set_px_at_pos(uint8_t *dst_buf, uint32_t x, uint32_t y
3838
}
3939
}
4040

41+
#ifdef CONFIG_LV_Z_COLOR_MONO_HW_INVERSION
42+
*buf |= BIT(bit);
43+
#else
4144
if (caps->current_pixel_format == PIXEL_FORMAT_MONO10) {
4245
*buf |= BIT(bit);
4346
} else {
4447
*buf &= ~BIT(bit);
4548
}
49+
#endif
4650
}
4751

4852
static void lvgl_transform_buffer(uint8_t **px_map, uint32_t width, uint32_t height,
4953
const struct display_capabilities *caps)
5054
{
55+
#ifdef CONFIG_LV_Z_COLOR_MONO_HW_INVERSION
56+
uint8_t clear_color = 0x00;
57+
#else
5158
uint8_t clear_color = caps->current_pixel_format == PIXEL_FORMAT_MONO10 ? 0x00 : 0xFF;
59+
#endif
5260

5361
memset(mono_conv_buf, clear_color, mono_conv_buf_size);
5462

0 commit comments

Comments
 (0)