Skip to content

Commit 91a14dc

Browse files
kuligakartben
authored andcommitted
drivers: auxdisplay: hd44780: add rs-line-delay dt parameter
In order for the driver to be compliant with the timing sequence diagrams presented in the reference manual, the MCU has to wait for some additional period of time while setting both the rs and rw lines. Signed-off-by: Jan Kuliga <[email protected]>
1 parent 55de1c9 commit 91a14dc

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

drivers/auxdisplay/auxdisplay_hd44780.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ struct auxdisplay_hd44780_config {
7070
uint8_t line_addresses[4];
7171
uint16_t enable_line_rise_delay;
7272
uint16_t enable_line_fall_delay;
73+
uint16_t rs_line_delay;
7374
uint16_t clear_delay;
7475
uint16_t boot_delay;
7576
};
@@ -96,6 +97,7 @@ static void auxdisplay_hd44780_command(const struct device *dev, bool rs, uint8_
9697
int8_t ncommands = (mode == AUXDISPLAY_HD44780_MODE_4_BIT) ? 2 : 1;
9798

9899
gpio_pin_set_dt(&config->rs_gpio, rs);
100+
k_sleep(K_NSEC(config->rs_line_delay));
99101

100102
while (ncommands--) {
101103
for (int8_t line = 7; line >= lsb_line; --line) {
@@ -569,6 +571,7 @@ static const struct auxdisplay_driver_api auxdisplay_hd44780_auxdisplay_api = {
569571
.backlight_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, backlight_gpios, {0}), \
570572
.enable_line_rise_delay = DT_INST_PROP(inst, enable_line_rise_delay_ns), \
571573
.enable_line_fall_delay = DT_INST_PROP(inst, enable_line_fall_delay_ns), \
574+
.rs_line_delay = DT_INST_PROP(inst, rs_line_delay_ns), \
572575
.clear_delay = DT_INST_PROP(inst, clear_command_delay_us), \
573576
.boot_delay = DT_INST_PROP(inst, boot_delay_ms), \
574577
}; \

dts/bindings/auxdisplay/hit,hd44780.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ properties:
7070
Delay time (in ns) to wait after enable line falls before sending
7171
another command. Default is as per Hitachi HD44780 specification.
7272
73+
rs-line-delay-ns:
74+
type: int
75+
default: 60
76+
description: |
77+
Delay time (in ns) to wait after rs/rw line state has been set up before
78+
sending another command. Default is as per Hitachi HD44780 specification.
79+
7380
clear-command-delay-us:
7481
type: int
7582
default: 5000

0 commit comments

Comments
 (0)