Availability | All terminals |
Description | With RemoveHeartbeatHandler, you can remove a callback function that was previously installed with a call to InstallHeartbeatHandler |
Syntax |
typedef void(*heartbeat_function)(void); int RemoveHeartbeatHandler( heartbeat_function userfunction ); |
Arguments |
heartbeat_function userfunction
The name of the function that is to be removed.
|
Returns | OK, when the handler was actually removed. ERROR if the handler could not be found in the list of installed handlers. |
Remarks | The function searches through the list of installed handlers and if it cannot find the function that was specified, it simply returns without doing anything. |
Example |
// The code fragment below installs a callback function // that is executed by the operating system every 20ms. // The callback makes sure that the red LED is switched // on for a short time every 2 seconds. // (Press function key to uninstall) #include <stdio.h> #include "lib.h" int Callback(void) { static int counter=100; if (--counter == 0) { GoodReadLed(RED,10); counter = 100; return TRUE; // Return TRUE to indicate device needs to wake-up } return TRUE; // Return FALSE to indicate can stay asleep (return DISABLED if the device may power off) } void main( void ) { printf("\nTimer callback"); InstallHeartbeatHandler(Callback); while(1) { if (getchar() == CLR_KEY) RemoveHeartbeatHandler(Callback); } Idle(); } |