is a read/write from/to an uint8_t atomic?

JosAH:

PeterH:
You are enabling interrupts within an interrupt handler? That is a big red flag.

No it isn't, I know what I'm doing (<--- famous last words :wink: My interrupt function is triggered by a falling edge and then it starts decoding an IR signal from a digital pin; that can takes several milli seconds (I simply poll that pin in the interrupt function) and I want the millis() etc. interrupts to go on. At the start of my function I've detached it from the particular interrupt because I don't want it to be called recursively by another falling edge on that pin. b.t.w. I only enable interrupts after I've detached my function from that falling edge interrupt.

Instead of polling the IR receiver in the ISR, why don't you leave the interrupt attached, and at each interrupt:

  • call micros() to get the current time
  • calculate the time since the previous edge, so that you can decode the next bit
  • store the time you got from micros(), ready for the next interrupt