+ i = 0
+ while i < len(init_sequence):
+ command = init_sequence[i]
+ data_size = init_sequence[i + 1]
+ delay = (data_size & DELAY) != 0
+ data_size &= ~DELAY
+ while self._core.begin_transaction():
+ pass
+
+ if self._core.data_as_commands:
+ full_command = bytearray(data_size + 1)
+ full_command[0] = command
+ full_command[1:] = init_sequence[i + 2 : i + 2 + data_size]
+ self._core.send(
+ DISPLAY_COMMAND,
+ CHIP_SELECT_TOGGLE_EVERY_BYTE,
+ full_command,
+ )
+ else:
+ self._core.send(
+ DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, bytes([command])
+ )
+ self._core.send(
+ DISPLAY_DATA,
+ CHIP_SELECT_UNTOUCHED,
+ init_sequence[i + 2 : i + 2 + data_size],
+ )
+ self._core.end_transaction()
+ delay_time_ms = 10
+ if delay:
+ data_size += 1
+ delay_time_ms = init_sequence[i + 1 + data_size]
+ if delay_time_ms == 255:
+ delay_time_ms = 500
+ time.sleep(delay_time_ms / 1000)
+ i += 2 + data_size