display: Allow the ST7920_DISPLAY parameter to be configured

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-06-21 09:58:35 -04:00
parent 3ac9fc6e63
commit d94c856118
2 changed files with 6 additions and 1 deletions

View File

@ -539,6 +539,10 @@
#sid_pin:
# The pins connected to an st7920 type lcd. These parameters must be
# provided when using an st7920 display.
#chip_delay:
# This parameter specifies the internal command delay (in seconds)
# on st7920 displays. It may be necessary to increase this if the
# display shows garbled data. The default is 0.000020.
# Custom thermistors (one may define any number of sections with a

View File

@ -182,6 +182,7 @@ class ST7920:
self.mcu = mcu
self.oid = self.mcu.create_oid()
self.mcu.add_config_object(self)
self.chip_delay = config.getfloat('chip_delay', ST7920_DELAY, minval=0.)
self.send_data_cmd = self.send_cmds_cmd = None
self.is_extended = False
# framebuffers
@ -196,7 +197,7 @@ class ST7920:
"config_st7920 oid=%u cs_pin=%s sclk_pin=%s sid_pin=%s"
" delay_ticks=%d" % (
self.oid, self.pins[0], self.pins[1], self.pins[2],
self.mcu.seconds_to_clock(ST7920_DELAY)))
self.mcu.seconds_to_clock(self.chip_delay)))
cmd_queue = self.mcu.alloc_command_queue()
self.send_cmds_cmd = self.mcu.lookup_command(
"st7920_send_cmds oid=%c cmds=%*s", cq=cmd_queue)