enabling Grove - 16x2 LCD (JHD1804)#136
Conversation
| self.command(0x30) | ||
| else: | ||
| raise ValueError('Invalid data bus mode: {}'.format(self.data_bus_mode)) | ||
| if self._i2c_expander != 'JHD1804': |
There was a problem hiding this comment.
Why is this not applicable to the JHD1804? The way I understand it, a port expander only forwards the commands to the hitachi chip.
There was a problem hiding this comment.
Also, this line doesn't work, see tests
There was a problem hiding this comment.
this line doesn't work in tests, but it works in reality. the value of _i2c_expander comes from the CharLCD class, the same as e.g. in the next line if self.data_bus_mode == c.LCD_4BITMODE:, with the difference that data_bus_mode is always defined self.data_bus_mode = c.LCD_4BITMODE (line 153 in i2c.py) while the expander must be defined when creating the object:
if i2c_expander in ['PCF8574', 'MCP23008', 'MCP23017', 'JHD1802']:
self._i2c_expander = i2c_expander
else:
raise NotImplementedError('I2C expander "%s" is not supported.' % i2c_expander)
(i2c.py 131 to 134)
I don't see an expander defined anywhere in the tests, but the object creation still goes through?

Adds another LCD for use:
https://www.seeedstudio.com/Grove-16x2-LCD-White-on-Blue.html