drivers: display: ssd1306: replace SSD1306_REVERSE_MODE by property
When multiple devices are connected, the SSD1306_REVERSE_MODE setting cannot switch for each device. Add an equivalent setting to the devicetree properties to replace it. Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
This commit is contained in:
parent
237c2aaa79
commit
91d750ea94
3 changed files with 8 additions and 10 deletions
|
@ -35,9 +35,4 @@ config SSD1306_SH1106_COMPATIBLE
|
|||
|
||||
endchoice
|
||||
|
||||
config SSD1306_REVERSE_MODE
|
||||
bool "SSD1306 reverse mode"
|
||||
help
|
||||
SSD1306 reverse video mode.
|
||||
|
||||
endif # SSD1306
|
||||
|
|
|
@ -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),
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue