Closed alzzxx closed 3 years ago
OK, so after reading for a couple of hours I made an educated guess: the arduino nano 33 BLE is based on an arm MCU, so it uses ring buffer for Wire communication, similar to SAMD21G18A (also arm), so i decided to try this approach and add this:
#elif defined(__SAMD21G18A__) || defined(ARDUINO_ARCH_MBED)
#define I2C_BUFFER_LENGTH_RX SERIAL_BUFFER_SIZE //SAMD21 uses RingBuffer.h
#define I2C_BUFFER_LENGTH_TX SERIAL_BUFFER_SIZE
to line 42 of SparkFun_External_EEPROM.h
and now my code compiles, and I'm able to write and read from EEPROM, obviusly I'll continue to test it, but for now it's working!
"after reading for a couple of hours I made an educated guess" should be the title of all freshman engineering textbooks. Nice work! This is literally what my job entails every day :)
@alzzxx - Assigning the buffer size to the serial buffer size is ok but a bit dangerous. If they don't match you'll get all sorts of bad behavior.
@makin-stuff - Do you know the I2C buffer size of the nRF in Arduino and how to test for the nRF mbed platform?
For now, I've changed the hard pragma error to a warning. Please test v1.0.5.
Subject of the issue
Right now I'm using v1.03 of the library together with an Arduino nano 33 BLE sense with the latest version of the mbed core for arduino (Arduino nRF528x Boards (Mbed OS) v1.3.1) and I'm getting a compilation error because
I2C_BUFFER_LENGTH_RX and _TX
are not defined for this architecture:Your workbench
Steps to reproduce
Well it's simple, the code does not compile with the arduino nano 33 BLE (already tested the EEPROM and the library with Arduino Uno and Arduino Mega and both work OK), the error that I see is:
#pragma GCC error "This platform doesn't have a wire buffer size defined. Please contribute to this library!"
Looking at the library I can see that
I2C_BUFFER_LENGTH_RX and _TX
are not defined for mbed architecture:I'd like to add something like:
or:
but honestly I have no idea how mbed Wire works, so I'm kindly asking for your help! :)
Expected behavior
Well I'd expected that code will move on and not enter into the
#else #pragma
partActual behavior
Goes into
#else
part and does not compile becauseI2C_BUFFER_LENGTH_RX and _TX
are not definedAny help will be greatly appreciated!