SendOnlySoftwareSerial icon indicating copy to clipboard operation
SendOnlySoftwareSerial copied to clipboard

sei() might be missing

Open schmmi opened this issue 4 years ago • 1 comments

SendOnlySoftwareSerial line 168 disables interrupt. However interrupts are not enabled again. Probably sei() is missing at the end of the function.

schmmi avatar Feb 02 '21 20:02 schmmi

See line 196:

  SREG = oldSREG; // turn interrupts back on

The technique of saving the status register and restoring it is a standard method of turning interrupts back on.

If we used sei() as you suggest, and they were not on anyway then we have now changed interrupts from not on to on. The method of saving and restoring SREG makes sure that the interrupts are back the way they were beforehand.

nickgammon avatar Feb 03 '21 21:02 nickgammon