mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Revision:
304:89b9c3a9a045
Parent:
36:ab3ee77451e7
Child:
525:c320967f86b9
--- a/api/Ticker.h	Fri Aug 29 11:45:07 2014 +0100
+++ b/api/Ticker.h	Fri Aug 29 17:15:07 2014 +0100
@@ -83,7 +83,7 @@
      *  @param fptr pointer to the function to be called
      *  @param t the time between calls in micro-seconds
      */
-    void attach_us(void (*fptr)(void), unsigned int t) {
+    void attach_us(void (*fptr)(void), timestamp_t t) {
         _function.attach(fptr);
         setup(t);
     }
@@ -95,21 +95,26 @@
      *  @param t the time between calls in micro-seconds
      */
     template<typename T>
-    void attach_us(T* tptr, void (T::*mptr)(void), unsigned int t) {
+    void attach_us(T* tptr, void (T::*mptr)(void), timestamp_t t) {
         _function.attach(tptr, mptr);
         setup(t);
     }
 
+    virtual ~Ticker() {
+        detach();
+    }
+
     /** Detach the function
      */
     void detach();
 
 protected:
-    void setup(unsigned int t);
+    void setup(timestamp_t t);
     virtual void handler();
 
-    unsigned int _delay;
-    FunctionPointer _function;
+protected:
+    timestamp_t     _delay;     /**< Time delay (in microseconds) for re-setting the multi-shot callback. */
+    FunctionPointer _function;  /**< Callback. */
 };
 
 } // namespace mbed