Function Pointer

Function Pointers are a way for the HAL file to call a user defined function. It's a simple callback technique. For example the Write Nonvolatile Memory example uses the debugConsoleIsr Function Pointer.

A Function Pointer is a variable that is defined in the hal file and allows us to abstract away the debug console Interrupt Service Routine. When we want to receive input from the debug console we simply set the debugConsoleIsr function pointer to point to the function we want to call. In the Write Nonvolatile Memory example, this is done with the command debugConsoleIsr = &handleDebugConsoleInterrupt; We then implement our local handleDebugConsoleInterrupt(char) method to process the received bytes.

Refer to the hal file for your hardware (e.g. hal_launchpad.c) for a list of function pointers.