- def write_cmd_cpy(self, command, *args):
- """Write command to OLED (CircuitPython).
-
- Args:
- command (byte): ILI9341 command code.
- *args (optional bytes): Data to transmit.
- """
- self.dc.value = False
- self.cs.value = False
- # Confirm SPI locked before writing
- while not self.spi.try_lock():
- pass
- self.spi.write(bytearray([command]))
- self.spi.unlock()
- self.cs.value = True
- # Handle any passed data
- if len(args) > 0:
- self.write_data(bytearray(args))
-