This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Callback Function from ISR

Recently, I was studying the source file of I2C from the code examples of LPC177x_8x controller.
I came across

void       (*callback)(void);      /**< Pointer to Call back function when transmission complete. "used in interrupt transfer mode" */

I wonder, how a function pointer can be used in a ISR to go to the CallBack function. i mean the Interrupt may be generated on any function and the hardware stores(PUSH) the return address on to stack and will POP back on the completion of ISR.
Note: the function pointer is the member of structure.

The source code file consists of a interrupt handler function [ void I2C_MasterHandler(uint8_t i2cId) ], which can be called from any I2C interrupt handler, passing argument to the function.

PS: No I2C example using interrupt handler is present in the code bundle (or TarBall).

0