JohnDoneth / hd44780-driver

Implementation of the embedded-hal traits for the HD44780.
MIT License
37 stars 40 forks source link

Custom Characters #55

Open ColinTimBarndt opened 2 weeks ago

ColinTimBarndt commented 2 weeks ago

This pull request allows defining custom characters. Closes #8.

This branch is currently based on #54 just for convenience, but I can rebase it onto the current version as it doesn't touch anything changed in that PR.

photo_2024-09-17_06-44-15 The custom character here is the diamond shape.

The current implementation has the drawback that it will reset the cursor position. This is required to change the writing mode from CHRAM back to DDRAM and we are currently not keeping track of the cursor position.

JohnDoneth commented 1 week ago

It would be nice to have a second opinion on this. Should we keep track of the cursor or just accept resetting the position?

Interesting. It might make sense to see how other implementations in other languages like C handle this in their libraries?

ColinTimBarndt commented 1 week ago

I actually haven't looked at other implementations until now. It appears that the status includes the current DDRAM address. I would combine this PR with adding status fetching in that case, which would eliminate two problems at once.

https://github.com/duinoWitchery/hd44780/blob/27fd9d3809a92e744eef60b13dfcf4096c91cbe8/hd44780.cpp#L734

Though, this would first require implementing reading from the bus, which should be a separate PR.