Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of HardwareTimersLib by
Diff: HardwareTimer.cpp
- 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
     
    