+/*
+ * Theory of operation:
+ *
+ * TM1618 communicates using a bi-directional SPI-like protocol.
+ * The AC unit is sending a stream of commands like this once per ca. 4 ms:
+ *
+ * 00 - set mode: 4 grids, 8 segments
+ * 44 - will write to display memory, no auto-increment
+ * Cx - set memory address to x
+ * yy - data to write, two most-significant bits are always zero
+ * 8B - display ON, duty cycle 10/16
+ *
+ * No read commands are issued, so we can simulate TM1618 using a pure SPI slave.
+ *
+ * Commands are delimited using the STB* (strobe) pin, but since our opto-couplers
+ * are negating, we cannot route this pin to SS (slave select) of our SPI.
+ * We tried triggering an external interrupt by this pin, but it turned out
+ * that the latency is too high.
+ *
+ * Instead, we ignore STB* completely and implement a self-synchronizing receiver:
+ *
+ * - The only byte which can have top 2 bits both set is the Cx command,
+ * so we can use this to find memory addresses and data in the stream.
+ * We can ignore all other commands.
+ *
+ * - Whenever 1 ms passes since the last byte was received, we reset the SPI.
+ * This allows us to recover from misaligned bytes.
+ */
+