In my code I change interrupt from rising to falling edge inside interrupt service routine.
It seems to be working, but is it safe the way I do it?
This is the ISR I use :
/* Interrupt routines */
void Isr_SensorRising()
{
detachInterrupt(0);
attachInterrupt(0, Isr_SensorFalling, FALLING);
start = mmTaktCount;
frontDetected = true;
}
void Isr_SensorFalling()
{
detachInterrupt(0);
attachInterrupt(0, Isr_SensorRising, RISING);
length = mmTaktCount - start
endDetected = true;
}
void Isr_mmTaktPulse()
{
mmTaktCount ++;
}