diff --git a/drivers/display/Kconfig.ssd1306 b/drivers/display/Kconfig.ssd1306 index 443e096ed84..af7992b09b4 100644 --- a/drivers/display/Kconfig.ssd1306 +++ b/drivers/display/Kconfig.ssd1306 @@ -35,9 +35,4 @@ config SSD1306_SH1106_COMPATIBLE endchoice -config SSD1306_REVERSE_MODE - bool "SSD1306 reverse mode" - help - SSD1306 reverse video mode. - endif # SSD1306 diff --git a/drivers/display/ssd1306.c b/drivers/display/ssd1306.c index de237931984..f0b9fccd5d4 100644 --- a/drivers/display/ssd1306.c +++ b/drivers/display/ssd1306.c @@ -47,6 +47,7 @@ struct ssd1306_config { bool segment_remap; bool com_invdir; bool com_sequential; + bool color_inversion; int ready_time_ms; }; @@ -340,11 +341,8 @@ static int ssd1306_init_device(const struct device *dev) uint8_t cmd_buf[] = { SSD1306_SET_ENTIRE_DISPLAY_OFF, -#ifdef CONFIG_SSD1306_REVERSE_MODE - SSD1306_SET_REVERSE_DISPLAY, -#else - SSD1306_SET_NORMAL_DISPLAY, -#endif + (config->color_inversion ? SSD1306_SET_REVERSE_DISPLAY + : SSD1306_SET_NORMAL_DISPLAY), }; /* Reset if pin connected */ @@ -439,6 +437,7 @@ static const struct ssd1306_config ssd1306_config = { .com_invdir = DT_INST_PROP(0, com_invdir), .com_sequential = DT_INST_PROP(0, com_sequential), .prechargep = DT_INST_PROP(0, prechargep), + .color_inversion = DT_INST_PROP(0, inversion_on), .ready_time_ms = DT_INST_PROP(0, ready_time_ms), }; diff --git a/dts/bindings/display/solomon,ssd1306fb-common.yaml b/dts/bindings/display/solomon,ssd1306fb-common.yaml index bba993a58c8..c4e82d84324 100644 --- a/dts/bindings/display/solomon,ssd1306fb-common.yaml +++ b/dts/bindings/display/solomon,ssd1306fb-common.yaml @@ -49,6 +49,10 @@ properties: If connected directly the MCU pin should be configured as active low. + inversion-on: + type: boolean + description: Turn on display color inverting + ready-time-ms: type: int default: 10