Masking I2C/TWI interrupt

Hi everybody,

I'm using the Wire library for I2C communication, in which the Arduino is a slave.
However, I have a time sensitive code in my program, so I don't want to jump to the TWI interrupt routine in that time frame.
I've looked for a way to mask the TWI interrupt, but I can only find timer interrupt masks.

Can anyone help me? Thank you!

You could try something like:

void twi_disable()
{
  TWCR &= ~ _BV(TWIE);
}

void twi_enable()
{
  TWCR |= _BV(TWIE);
}

Cheers!

Ref. 22.9.2 TWCR – TWI Control Register.