[new issue] Wire: what's wrong with Wire.onReceive() ?

hi,
I’m trying to configure my Arduino to work as a i2c slave, but I don’t understand what I’m doing wrong:
(IDE 1.5.6)

#define  SLAVE_ADDRESS 0x04
#define  MSGSIZE  30
byte     RecvArray[MSGSIZE]; 
byte     SendArray[MSGSIZE];


void setup() {
   Serial.begin(115200);  
   
   // Wire (i2c)
   Wire.begin(SLAVE_ADDRESS);  //  start Arduino as a I2C slave, addr=0x04 (7-bit coded)
   Wire.onReceive(receiveData);
   Wire.onRequest(sendData);

}


void receiveData() {
    int32_t i;
    byte val;
       
    while(Wire.available()<MSGSIZE) ; // wait for 30  bytes to complete
    i=0;  // init counter var
    while(Wire.available()>0)    // read all bytes
    {
      val=Wire.read();
      RecvArray[i++]=val;
    }

}


// callback for sending data
void sendData()
{
  Wire.write(SendArray, MSGSIZE); // send 30 bytes back to master..
}

I get the compiler error msg:

i2cEV30001.ino: In function ‘void setup()’:
i2cEV30001:368: error: invalid conversion from ‘void ()()’ to 'void ()(int)’ [-fpermissive]
In file included from i2cEV30001.ino:2:0:
C:\Programme\Arduino\hardware\arduino\avr\libraries\Wire/Wire.h:67:10: error: initializing argument 1 of 'void TwoWire::onReceive(void ()(int))’ [-fpermissive]
void onReceive( void (
)(int) );
^
invalid conversion from ‘void ()()’ to 'void ()(int)’ [-fpermissive]

edit:
resolved.

corrected by function call

void receiveData(int16_t byteCount) // although byteCount not used so far

now the code compiles fine on my MEGA,
but the same code for the DUE I again get error messages:

Arduino: 1.6.5 (Windows XP), Platine: “Arduino Due (Programming Port)”

i2cEV30001.ino: In function ‘void setup()’:
i2cEV30001:370: error: invalid conversion from ‘void ()(int16_t) {aka void ()(short int)}’ to ‘void ()(int)’ [-fpermissive]
In file included from i2cEV30001.ino:2:0:
C:\Dokumente und Einstellungen\user1\Anwendungsdaten\Arduino15\packages\arduino\hardware\sam\1.6.4\libraries\Wire/Wire.h:53:7: error: initializing argument 1 of 'void TwoWire::onReceive(void (
)(int))’ [-fpermissive]
void onReceive(void()(int));
^
invalid conversion from 'void (
)(int16_t) {aka void ()(short int)}’ to 'void ()(int)’ [-fpermissive]

edit: hmmmhm, changing 1nt16_t to int seemed to do the trick… :astonished: