def __init__(self, i2c, i2c_addr, num_lines, num_columns):
self.i2c = i2c
self.i2c_addr = i2c_addr
def __init__(self, i2c, i2c_addr, num_lines, num_columns):
self.i2c = i2c
self.i2c_addr = i2c_addr
# Writes an initialization nibble to the LCD.
# This particular function is only used during initialization.
byte = ((nibble >> 4) & 0x0f) << SHIFT_DATA
# Writes an initialization nibble to the LCD.
# This particular function is only used during initialization.
byte = ((nibble >> 4) & 0x0f) << SHIFT_DATA
- self.i2c.writeto(self.i2c_addr, bytearray([byte | MASK_E]))
- self.i2c.writeto(self.i2c_addr, bytearray([byte]))
+ self.i2c.writeto(self.i2c_addr, bytes([byte | MASK_E]))
+ self.i2c.writeto(self.i2c_addr, bytes([byte]))
def hal_write_command(self, cmd):
# Write a command to the LCD. Data is latched on the falling edge of E.
byte = ((self.backlight << SHIFT_BACKLIGHT) |
(((cmd >> 4) & 0x0f) << SHIFT_DATA))
def hal_write_command(self, cmd):
# Write a command to the LCD. Data is latched on the falling edge of E.
byte = ((self.backlight << SHIFT_BACKLIGHT) |
(((cmd >> 4) & 0x0f) << SHIFT_DATA))
- self.i2c.writeto(self.i2c_addr, bytearray([byte | MASK_E]))
- self.i2c.writeto(self.i2c_addr, bytearray([byte]))
+ self.i2c.writeto(self.i2c_addr, bytes([byte | MASK_E]))
+ self.i2c.writeto(self.i2c_addr, bytes([byte]))
- self.i2c.writeto(self.i2c_addr, bytearray([byte | MASK_E]))
- self.i2c.writeto(self.i2c_addr, bytearray([byte]))
+ self.i2c.writeto(self.i2c_addr, bytes([byte | MASK_E]))
+ self.i2c.writeto(self.i2c_addr, bytes([byte]))
- self.i2c.writeto(self.i2c_addr, bytearray([byte | MASK_E]))
- self.i2c.writeto(self.i2c_addr, bytearray([byte]))
+ self.i2c.writeto(self.i2c_addr, bytes([byte | MASK_E]))
+ self.i2c.writeto(self.i2c_addr, bytes([byte]))
- self.i2c.writeto(self.i2c_addr, bytearray([byte | MASK_E]))
- self.i2c.writeto(self.i2c_addr, bytearray([byte]))
+ self.i2c.writeto(self.i2c_addr, bytes([byte | MASK_E]))
+ self.i2c.writeto(self.i2c_addr, bytes([byte]))