You are right. I had to change some functions to some ARM equivalents.
I changed the atomic blocks to __disable_irq(); and __enable_irq();
I also had to change some EEPROM read/write functions - luckily I found a library for that.
There is still one error but if not for this error it compiles. Then I believe changing the pin numbers should hopefully make it work.
void i2cInitialize(bool delayFlag)
{
setModuleLed(true);
#if !STM32_MODE_FLAG
Wire.end(); // release I2C pins (SDA & SCL), in case they are "stuck"
#endif
if (delayFlag) // do delay if called via comms monitor
delay(250); // to help bus reset and show longer LED flash
setModuleLed(false);
Wire.begin(i2cAddress); // I2C address setup
Wire.onReceive(i2cReceive); // Trigger 'i2cReceive' function on incoming data
Wire.onRequest(i2cTransmit); // Trigger 'i2cTransmit' function for outgoing data, on master request
#if !STM32_MODE_FLAG
TWAR = (i2cAddress << 1) | 1; // enable broadcasts to be received
#endif
}
The TWAR line throws an error. Am I right in assuming that for Due the Wire.begin() function already takes care of that?
I do not know enough (basically nothing) about the Due.
The general way I2C communication works on the Arduino is that you pass the address of the peripheral in Wire.beginTransmission(address) or in Wire.requestFrom(address, numBytes).