Change config() in LiquidCrystal_I2C.h from private to protected.

Issue #54 resolved
Ryan Neve created an issue

I have a program which needs to support two different I2C adapters which use different pins. I would like to instantiate the LiquidCrystal_I2C objects globally, but set their parameters in setup() before I call LiquidCrystal_I2C.init(). The cleanest way to do this seems to be create my own class which inherits from LiquidCrystal_I2C and can call config() since it is now protected not private. Of course you could make config() public instead.

Comments (6)

  1. Francisco Malpartida repo owner

    I'll give it a thought. But the idea behind it was to extend functionality through inheritance. I suppose that you are looking to support large LCDs or use 2 LCD to write to them as if they were just one.

  2. Ryan Neve reporter

    It's legacy hardware. My software needs to support two different controllers, but not two at the same time. The only way to currently set pins is at instantiation. I'd like a way to change pin assignments after instantiation. Currently the only way set pins is with config() but it's private.

  3. Chris Torrence

    I'd like to "second" this request. I've got an Arduino script where the LCD address is unknown until runtime (it's usually 0x27 or 0x3F). Right now I had to hack my own version of LiquidCrystal_I2C.h to make config public, but that's not a great long-term solution. Thanks!

  4. Francisco Malpartida repo owner

    Hi folks,

    thanks for sharing your comments. Please take a look at the new integration branch.

    I have moved to public the config method such that a class inheriting from it can overload it.

  5. Francisco Malpartida repo owner

    Resolved on integration branch. Please review and test for closing and putting it into production.

  6. Log in to comment