mattjlewis / diozero

Java Device I/O library that is portable across Single Board Computers and microcontrollers. Tested with Raspberry Pi, Odroid C2, BeagleBone Black, Next Thing CHIP, Asus Tinker Board and Arduinos / Pico. Supports GPIO, I2C, SPI as well as Serial communication. Also known to work with Udoo Quad.
https://www.diozero.com
MIT License
261 stars 59 forks source link

Adding support for slightly different LCD device. #117

Closed EAGrahamJr closed 1 year ago

EAGrahamJr commented 1 year ago

The GH1602-2502 is a super-low-cost 2 line display. This has apparently been included in several "experimenter kits" and uses slightly different bit-commands than the HD44780.

The LcdInterface and LcdConnection interfaces/classes were extracted to share across LCD implementations.

EAGrahamJr commented 1 year ago

Finally found the "real" data-sheet for the device in question.

mattjlewis commented 1 year ago

I’ll take a look this week. Confused as to what it actually is and how it is different to what is already implemented. Freenove is just a company packaging these things. Could be as simple as a variant, eg the I2C backpack (PCF8574AT?).

EAGrahamJr commented 1 year ago

Freenove is just a company packaging these things. Could be as simple as a variant, eg the I2C backpack (PCF8574AT?).

Concur - this has been driving me a little crazy (and why I've left it as a "draft"). I've varied almost all parts of the backpack interaction, but the code here is the only way I've managed to get it to work, between the existing code versus the supplied code from Freenove and from the Pi4J "examples".

EAGrahamJr commented 1 year ago

FYI, this is the constructor I used new HD44780Lcd(new PCF8574LcdConnection(1), 16, 2);

$ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- 27 -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

I've ordered a 4-line display with the same backpack configuration. The Amazon page touts this as a "new version", so I'm supposing there's a difference in the backpack itself (since there's no controls).

EAGrahamJr commented 1 year ago

Still confused - everything points to these being the Hitachi displays, but using the existing HD44780 device is not currently working with these particular devices. (Time to start capturing byte sequences...)