Skip to content

Conversation

@wsad4ryba
Copy link

self.command(0x30)
else:
raise ValueError('Invalid data bus mode: {}'.format(self.data_bus_mode))
if self._i2c_expander != 'JHD1804':
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this not applicable to the JHD1804? The way I understand it, a port expander only forwards the commands to the hitachi chip.

Copy link
Owner

Choose a reason for hiding this comment

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

Also, this line doesn't work, see tests

Copy link
Author

Choose a reason for hiding this comment

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

this is not an ordinary i2c expander, but a full driver with built-in i2c, a replacement for the hitachi chip, usually compatible, but the initialization looks different because you do not need to set the 4 or 8 bit communication function:
obraz

Copy link
Author

Choose a reason for hiding this comment

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

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants