From e780a61671f060e5a00868fb3382c304d72f1618 Mon Sep 17 00:00:00 2001 From: Manna Harbour <51143715+manna-harbour@users.noreply.github.com> Date: Fri, 14 Oct 2022 16:59:20 +1100 Subject: [PATCH] Add option to invert IL0323 display Co-authored-by: Cem Aksoylar --- app/module/drivers/display/Kconfig.il0323 | 6 +++++- app/module/drivers/display/il0323.c | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/module/drivers/display/Kconfig.il0323 b/app/module/drivers/display/Kconfig.il0323 index f3308c16..1f23d6c0 100644 --- a/app/module/drivers/display/Kconfig.il0323 +++ b/app/module/drivers/display/Kconfig.il0323 @@ -8,4 +8,8 @@ config IL0323 depends on SPI depends on HEAP_MEM_POOL_SIZE != 0 help - Enable driver for IL0323 compatible controller. \ No newline at end of file + Enable driver for IL0323 compatible controller. + +config IL0323_INVERT + bool "Invert display" + default n diff --git a/app/module/drivers/display/il0323.c b/app/module/drivers/display/il0323.c index 6555e5c1..924a06ec 100644 --- a/app/module/drivers/display/il0323.c +++ b/app/module/drivers/display/il0323.c @@ -242,8 +242,12 @@ static void il0323_get_capabilities(const struct device *dev, struct display_cap memset(caps, 0, sizeof(struct display_capabilities)); caps->x_resolution = EPD_PANEL_WIDTH; 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; +#endif 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) { - if (pf == PIXEL_FORMAT_MONO10) { + if ((pf == PIXEL_FORMAT_MONO10) || (pf == PIXEL_FORMAT_MONO10)) { return 0; }