MCPcopy Create free account
hub / github.com/RetiredWizard/PyDOS / hal_write_command

Method hal_write_command

cpython/lib/circuitpython_i2c_lcd.py:60–73  ·  view source on GitHub ↗

Writes a command to the LCD. Data is latched on the falling edge of E.

(self, cmd)

Source from the content-addressed store, hash-verified

58 self.i2c.writeto(self.i2c_addr, bytearray([0]))
59
60 def hal_write_command(self, cmd):
61 """Writes a command to the LCD.
62
63 Data is latched on the falling edge of E.
64 """
65 byte = ((self.backlight << SHIFT_BACKLIGHT) | (((cmd >> 4) & 0x0f) << SHIFT_DATA))
66 self.i2c.writeto(self.i2c_addr, bytearray([byte | MASK_E]))
67 self.i2c.writeto(self.i2c_addr, bytearray([byte]))
68 byte = ((self.backlight << SHIFT_BACKLIGHT) | ((cmd & 0x0f) << SHIFT_DATA))
69 self.i2c.writeto(self.i2c_addr, bytearray([byte | MASK_E]))
70 self.i2c.writeto(self.i2c_addr, bytearray([byte]))
71 if cmd <= 3:
72 # The home and clear commands require a worst case delay of 4.1 msec
73 sleep(0.005)
74
75 def hal_write_data(self, data):
76 """Write data to the LCD."""

Callers 2

lcdScrollFunction · 0.95
__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected