adafruit / Adafruit_CircuitPython_CharLCD

Library code for character LCD interfacing
MIT License
69 stars 50 forks source link

Character_LCD set_backlight function is backwards #5

Closed BravoDelta151 closed 5 years ago

BravoDelta151 commented 6 years ago

If you pass True, the value is set to 0 (False) turning the backlight off and you must pass False to turn it on.

Additionally, a quick review of the init function defaults the self.backlight member to None which will cause an exception if you don't pass in the pin and attempt to call set_backlight since None has no 'value' member.

def set_backlight(self, lighton):
      """ Set lighton to turn the charLCD backlight on.
            :param lighton: True to turn backlight on, False to turn off
      """
      if lighton:
        self.backlight.value = 0
      else:
        self.backlight.value = 1
tdicola commented 6 years ago

Yeah I noticed this too and it's not necessarily wrong but rather assuming a common cathode backlight (like from some RGB displays). I'm not familiar with all the types of LCD backlights to make the call on the right way, the Pi version of this library actually lets you specify if the backlight logic is inverted or not (vs. this library that assumes it's inverted). I think ultimately this library might want the same concept of inverted vs. non-inverted backlights (i.e. is backlight hooked up to the LED anode or cathode).

TurbulentCalm commented 6 years ago

Agreed, all my monochrome LCD require this to be set to False to enable the backlight.

ladyada commented 5 years ago

@kattni this is resolved now?

kattni commented 5 years ago

Yep this is fixed in #19