I recognise that by default interrupts do not run inside interrupts, but I also know that there are lines of AVR code which one can include within a sketch to enable interrupts or disable them at points where they would not normally be enabled/disabled. I also know that I2C is pretty low down (25th) in priority on standard arduino uno atmega328p devices.
I wanted to ask about allowing I2c Interrupts to occur within a D2 pin (2nd priority) interrupt.
Inside an interrupt interrupts are usually disabled but the flags for interrupts can still be set. I can perhaps clear other flags within the interrupt if this helps avoid priority issues. I can also use
EIFR = 1; // clear flag for interrupt 0 (D2 on Uno)
to ensure that the d" interrupt doesn't run a second time immediately afterwards.
Is doing this feasible or are there unforeseen complicatons likely to occur? I can understand the chaos that can occur if an interrupt allows it's own types of interrupts inside it, but in the case of an I2C interrupt (either the receive or getting requested from type, assuming the uno is a slave I2c device) what could generally go wrong, so long as I'm happy to accept some risk that the d" interrupt might not run quite as desired every time but outweighed by the I2C interrupt always working properly.
I'm not sure whether the default I2C library for the arduino has dependencies on any other interrupts (timing perhaps?), if so is it feasible to also enable those necessary interrupts within a D2 interrupt?
I have looked over https://gammon.com.au/interrupts and while it discusses enabling interrupts within interrupts it doesn't seem to give any information specific to I2C.