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 <jtkuliga@gmail.com>
This commit is contained in:
parent
55de1c9719
commit
91a14dcc50
2 changed files with 10 additions and 0 deletions
|
|
@ -70,6 +70,7 @@ struct auxdisplay_hd44780_config {
|
||||||
uint8_t line_addresses[4];
|
uint8_t line_addresses[4];
|
||||||
uint16_t enable_line_rise_delay;
|
uint16_t enable_line_rise_delay;
|
||||||
uint16_t enable_line_fall_delay;
|
uint16_t enable_line_fall_delay;
|
||||||
|
uint16_t rs_line_delay;
|
||||||
uint16_t clear_delay;
|
uint16_t clear_delay;
|
||||||
uint16_t boot_delay;
|
uint16_t boot_delay;
|
||||||
};
|
};
|
||||||
|
|
@ -96,6 +97,7 @@ static void auxdisplay_hd44780_command(const struct device *dev, bool rs, uint8_
|
||||||
int8_t ncommands = (mode == AUXDISPLAY_HD44780_MODE_4_BIT) ? 2 : 1;
|
int8_t ncommands = (mode == AUXDISPLAY_HD44780_MODE_4_BIT) ? 2 : 1;
|
||||||
|
|
||||||
gpio_pin_set_dt(&config->rs_gpio, rs);
|
gpio_pin_set_dt(&config->rs_gpio, rs);
|
||||||
|
k_sleep(K_NSEC(config->rs_line_delay));
|
||||||
|
|
||||||
while (ncommands--) {
|
while (ncommands--) {
|
||||||
for (int8_t line = 7; line >= lsb_line; --line) {
|
for (int8_t line = 7; line >= lsb_line; --line) {
|
||||||
|
|
@ -569,6 +571,7 @@ static const struct auxdisplay_driver_api auxdisplay_hd44780_auxdisplay_api = {
|
||||||
.backlight_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, backlight_gpios, {0}), \
|
.backlight_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, backlight_gpios, {0}), \
|
||||||
.enable_line_rise_delay = DT_INST_PROP(inst, enable_line_rise_delay_ns), \
|
.enable_line_rise_delay = DT_INST_PROP(inst, enable_line_rise_delay_ns), \
|
||||||
.enable_line_fall_delay = DT_INST_PROP(inst, enable_line_fall_delay_ns), \
|
.enable_line_fall_delay = DT_INST_PROP(inst, enable_line_fall_delay_ns), \
|
||||||
|
.rs_line_delay = DT_INST_PROP(inst, rs_line_delay_ns), \
|
||||||
.clear_delay = DT_INST_PROP(inst, clear_command_delay_us), \
|
.clear_delay = DT_INST_PROP(inst, clear_command_delay_us), \
|
||||||
.boot_delay = DT_INST_PROP(inst, boot_delay_ms), \
|
.boot_delay = DT_INST_PROP(inst, boot_delay_ms), \
|
||||||
}; \
|
}; \
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,13 @@ properties:
|
||||||
Delay time (in ns) to wait after enable line falls before sending
|
Delay time (in ns) to wait after enable line falls before sending
|
||||||
another command. Default is as per Hitachi HD44780 specification.
|
another command. Default is as per Hitachi HD44780 specification.
|
||||||
|
|
||||||
|
rs-line-delay-ns:
|
||||||
|
type: int
|
||||||
|
default: 60
|
||||||
|
description: |
|
||||||
|
Delay time (in ns) to wait after rs/rw line state has been set up before
|
||||||
|
sending another command. Default is as per Hitachi HD44780 specification.
|
||||||
|
|
||||||
clear-command-delay-us:
|
clear-command-delay-us:
|
||||||
type: int
|
type: int
|
||||||
default: 5000
|
default: 5000
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue