Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/driver/hd44780/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ where
self.send_command_to_controller(controller, LCD_CMD_DISPLAYCONTROL | display_control)?;
self.send_command_to_controller(controller, LCD_CMD_ENTRYMODESET | display_mode)?;
self.send_command_to_controller(controller, LCD_CMD_CLEARDISPLAY)?;
self.device_config().delay.delay_ms(2);
self.send_command_to_controller(controller, LCD_CMD_RETURNHOME)?;
self.device_config().delay.delay_ms(2);
}
// set up the display
self.set_backlight(true)?;
Expand Down Expand Up @@ -143,8 +145,10 @@ where
self.set_rs(rs_setting);
self.set_rw(false);

// now write the low nibble
self.set_data(value & 0x0F);
// first write value without the enable strobe
// to ensure that the address set-up time t_AS = 40 ns is observed
self.write_bits_to_gpio()?;
Comment on lines +149 to +151
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the pre-enable write_bits_to_gpio changes every nibble write from two I²C transactions to three, but the mock expectations (e.g. test_generic_hd44780_pcf8574t_init in src/driver/hd44780.rs) still expect two. As written, the test suite will fail and the behavior change isn’t covered. Update the mocks to include the new writes and add a test that captures the t_AS setup write.

Please update the unit tests to reflect your change here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, do you have some kind of automation for updating these tests? I feel like they kind of have the vibe of snapshot tests a la insta...

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run:

cargo test

To see what tests are failing (there are a few), and then figure out why. If you used codex or claude, note that there is a AGENTS.md already in the repo.

self.set_enable(true, controller)?;
self.write_bits_to_gpio()?;
self.set_enable(false, controller)?;
Expand Down