ISR triggering an event

Upon scheduling the ISR, i read somewhere that the codes residing within should be as little as possible and the recommendation was to create a event from the isr. How do i create such a event that could execute parallell within PhAB so that the widgets still updates?

thanks and regards.

PtAppCreatePulse() will create an event object that you can return from an interrupt handler, to cause your Photon application code to be scheduled. See PtAppAddInput() in the docs to see how to “attach” your Photon code to the Pulse created with PtAppCreatePulse().

You should only write an interrupt handler if you need to to clear the interrupt source for a level sensitive hardware interrupt, otherwise just use InterruptAttachEvent() to cause the OS to deliver the Pulse created with PtAppCreatePulse().


  1. use PtAppCreatePulse() to create an event object.
  2. attach your Photon code to this event using PtAppAddInput()
  3. deliver the event from the interrupt handler (by returning it) to cause the code supplied in (1) to be scheduled.

btw: I am not going to comment on the suitability of an architecture where a GUI app contains an interrupt handler, but others may…