While I was able to use the SD card on my BastMobile’s Keyboard Featherwing, my other BastWAN devices don’t have an SD card, or an EEPROM. There was a plan to add Flash memory to the board but that was scrapped. So I went dumpster diving, almost literally, and dug up some EEPROMs I had from an old project. These ATMEL 24C512 chips came loose for most of them, but I have a few that came on breakout boards. So I’m thinking Pavel, Pablo and Simon could do with some storage for settings and whatnot.
I used to have a home-grown library to manage multiple EEPROM chips as a single storage, but in between computer crashes and upgrades, I seem to have lost it. Oops. So meanwhile I’m using the SparkFun External EEPROM library. However, since there’s no definition for the BastWAN in the library’s header. It says:
#pragma GCC error "This platform doesn't have a wire buffer size defined. Please contribute to this library!"
I went digging around. Wire.h uses RingBuffer.h. There the buffersize is defined as:
#define SERIAL_BUFFER_SIZE 64
So let’s do that. We need to add the following lines to the library around line 60:
#elif defined(_VARIANT_ELECTRONICCATS_BASTWAN_)
#define I2C_BUFFER_LENGTH_RX SERIAL_BUFFER_SIZE
#define I2C_BUFFER_LENGTH_TX SERIAL_BUFFER_SIZE
The code is pretty straightforward, using the library’s functions to read the memory’s contents, displaying a few 256-byte pages. As usual, the code is on GitHub.
Leave a comment