We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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).