Add option to invert IL0323 display

Co-authored-by: Cem Aksoylar <caksoylar@gmail.com>
This commit is contained in:
Manna Harbour 2022-10-14 16:59:20 +11:00 committed by hannah
parent 69f7bfb409
commit e780a61671
2 changed files with 11 additions and 3 deletions

View file

@ -9,3 +9,7 @@ config IL0323
depends on HEAP_MEM_POOL_SIZE != 0 depends on HEAP_MEM_POOL_SIZE != 0
help help
Enable driver for IL0323 compatible controller. Enable driver for IL0323 compatible controller.
config IL0323_INVERT
bool "Invert display"
default n

View file

@ -242,8 +242,12 @@ static void il0323_get_capabilities(const struct device *dev, struct display_cap
memset(caps, 0, sizeof(struct display_capabilities)); memset(caps, 0, sizeof(struct display_capabilities));
caps->x_resolution = EPD_PANEL_WIDTH; caps->x_resolution = EPD_PANEL_WIDTH;
caps->y_resolution = EPD_PANEL_HEIGHT; caps->y_resolution = EPD_PANEL_HEIGHT;
caps->supported_pixel_formats = PIXEL_FORMAT_MONO10; caps->supported_pixel_formats = PIXEL_FORMAT_MONO10 | PIXEL_FORMAT_MONO01;
#if IS_ENABLED(CONFIG_IL0323_INVERT)
caps->current_pixel_format = PIXEL_FORMAT_MONO01;
#else
caps->current_pixel_format = PIXEL_FORMAT_MONO10; caps->current_pixel_format = PIXEL_FORMAT_MONO10;
#endif
caps->screen_info = SCREEN_INFO_MONO_MSB_FIRST | SCREEN_INFO_EPD; caps->screen_info = SCREEN_INFO_MONO_MSB_FIRST | SCREEN_INFO_EPD;
} }
@ -254,7 +258,7 @@ static int il0323_set_orientation(const struct device *dev,
} }
static int il0323_set_pixel_format(const struct device *dev, const enum display_pixel_format pf) { static int il0323_set_pixel_format(const struct device *dev, const enum display_pixel_format pf) {
if (pf == PIXEL_FORMAT_MONO10) { if ((pf == PIXEL_FORMAT_MONO10) || (pf == PIXEL_FORMAT_MONO10)) {
return 0; return 0;
} }