TAP_Exit

Topfield Documentation

void TAP_Exit();

It ends the TAP application. This function SHOULD be called to finish the TAP application in TSR mode.

Additional Documentation

TAP_Exit returns (having set a flag first) to the calling code - you should ensure that the return path back up to returning out of TAP_EventHandler is valid if you have done cleanup before calling TAP_Exit.

The firmware seems to actually unload the TAP just before the first IDLE_EVENT after the TAP_Exit call. It's unclear whether it is possible for another type of event (i.e. key press) to arrive between calling TAP_Exit and the next IDLE event. Good coding practice would suggest setting an internal flag when calling TAP_Exit and returning immediately from TAP_EventHandler if this flag is set.