Mark Gottscho / HardwareTimersLib

Fork of HardwareTimersLib by Mark Gottscho

Revision:
14:960fbd85909f
Parent:
13:3564122e9c10
--- a/HardwareTimer.cpp	Tue Mar 11 05:49:26 2014 +0000
+++ b/HardwareTimer.cpp	Sun Mar 16 01:08:20 2014 +0000
@@ -84,7 +84,12 @@
         
     if (__enabled)
         disable();
-    __user_fptr = new FunctionPointer(tptr, mptr);
+        
+    //set user function pointer
+    if (__user_fptr != NULL)
+        delete __user_fptr;
+    if (tptr != NULL && mptr != NULL)
+        __user_fptr = new FunctionPointer(tptr, mptr);
 
     __init_timer(); //Do hardware-specific initialization