The Wire documentation only shows read() to get data from
the I²C stream.
However, Wire inherits from Stream, so it gets access to
all the same functions, like readBytes(), which can read
more than one character.
Replace the innermost loop of the cartridge load by
readBytes instead of calling read() in a loop.
Unity provides constants that reflect the maximum value of integer types,
use it for checking the checksum overflow rather than using 65536 directly.
This makes the intent more clear.
The Arduino will block if sent data too quickly after connection.
Add a new coroutine to force waiting for 1s+ and update the UI
accordingly.
Update some comments throughout.
The EEPROM in the cartridges support 'Fast I²C' at 400kHz.
Testing it out, it seems to work fine despite the high pull-ups,
so update the Arduino code to enjoy the 4x speed-up !
Add the full working Arduino code for cart loading.
Handle the UI elements, connection to the Arduino
and loading the cartridge over serial.
This code should not be shared with students as it
is the full working code for the communication.
The project setup contains README, LICENSE, the full UI and materials.
The PICO-8 side is wired up, but all the Arduino code is absent as
I need to figure out how to carve it out for the students.