uc1701: make contrast configurable
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
9bd3e80421
commit
2e16be224e
|
@ -1217,6 +1217,9 @@
|
||||||
#a0_pin:
|
#a0_pin:
|
||||||
# The pins connected to an uc1701 type lcd. These parameters must be
|
# The pins connected to an uc1701 type lcd. These parameters must be
|
||||||
# provided when using an uc1701 display.
|
# provided when using an uc1701 display.
|
||||||
|
#contrast: 40
|
||||||
|
# The contrast to set when using a uc1701 type display. The value may
|
||||||
|
# range from 0 to 63. Default is 40.
|
||||||
#cs_pin:
|
#cs_pin:
|
||||||
#dc_pin:
|
#dc_pin:
|
||||||
#spi_bus:
|
#spi_bus:
|
||||||
|
|
|
@ -153,6 +153,7 @@ class I2C:
|
||||||
class UC1701(DisplayBase):
|
class UC1701(DisplayBase):
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
DisplayBase.__init__(self, SPI4wire(config, "a0_pin"))
|
DisplayBase.__init__(self, SPI4wire(config, "a0_pin"))
|
||||||
|
self.contrast = config.getint('contrast', 40, minval=0, maxval=63)
|
||||||
def init(self):
|
def init(self):
|
||||||
init_cmds = [0xE2, # System reset
|
init_cmds = [0xE2, # System reset
|
||||||
0x40, # Set display to start at line 0
|
0x40, # Set display to start at line 0
|
||||||
|
@ -166,7 +167,7 @@ class UC1701(DisplayBase):
|
||||||
0x00, # Booster ratio value (4x)
|
0x00, # Booster ratio value (4x)
|
||||||
0x23, # Set resistor ratio (3)
|
0x23, # Set resistor ratio (3)
|
||||||
0x81, # Set Electronic Volume
|
0x81, # Set Electronic Volume
|
||||||
0x28, # Electronic volume value (40)
|
self.contrast, # Electronic Volume value
|
||||||
0xAC, # Set static indicator off
|
0xAC, # Set static indicator off
|
||||||
0x00, # NOP
|
0x00, # NOP
|
||||||
0xA6, # Disable Inverse
|
0xA6, # Disable Inverse
|
||||||
|
|
Loading…
Reference in New Issue