Hugo Pristauz / Mbed 2 deprecated S13_TOF_GAP

Dependencies:   BLE_API X_NUCLEO_6180XA1 mbed

Fork of BLE_HeartRate_IDB0XA1 by ST

Revision:
27:32267cee7cb8
Parent:
22:d467526abc4a
Child:
28:86a594313434
--- a/bricks/blink.cpp	Sat Jan 07 15:38:15 2017 +0000
+++ b/bricks/blink.cpp	Sat Jan 14 08:43:14 2017 +0000
@@ -3,18 +3,18 @@
 // Function morse() is one way for running LED1 with a blinking sequence using
 // a busy wait, until the sequence is completed.
 //
-//    morse(" x xxx x    ");        send one time morse sequence, interval = 0.2
-//    morse(" x xxx x    ",0.5);    send one time morse sequence, interval = 0.5
+//    morse(o," x xxx x    ");      send one time morse sequence, interval = 0.2
+//    morse(o," x xxx x    ",0.5);  send one time morse sequence, interval = 0.5
 //
-// Function morse() got the additional feature to stop an ongoing timer based
+// Function morse(o) got the additional feature to stop an ongoing timer based
 // blinking sequence.
 //    
 // The alternative is to setup an ever repeating blink sequence via LED1 using
 // function blink(), which is non waiting.
 //
-//    blink(" x xxx x    ");        repeating blink sequence, interval = 0.2
-//    blink(" x xxx x    ",0.5);    repeating blink sequence, interval = 0.5
-//    blink(0);                     stops blinking sequence
+//    blink(o," x xxx x    ");      repeating blink sequence, interval = 0.2
+//    blink(o," x xxx x    ",0.5);  repeating blink sequence, interval = 0.5
+//    blink(o);                     stops blinking sequence
 //
 
 #include "bricks/target.h"
@@ -34,7 +34,7 @@
    static const char *sequence = 0;     // next morse sequence for repeats
        
 
-   void morse(const char *pattern, double interval)
+   void morse(O&o,const char *pattern, double interval)
    {
        pointer = 0;                     // disable ticker based blinking
        sequence = 0;                    // set also empty sequence
@@ -48,13 +48,13 @@
           
 // callback for LED1 ticker controlled blinking   
            
-   static void callback(void)
+   static void cbBlinker(void)         // blinker callback
    {
        if (pointer != 0)
       {
          if (*pointer == 0)
          {
-            pointer = sequence;         // reset pointer to followup sequence
+            pointer = sequence;        // reset pointer to followup sequence
          }
         
          if (*pointer)
@@ -64,19 +64,19 @@
       }
    }
    
-   void blink(const char *pattern, const char* next, double interval)
+   void blink(O&o,const char *pattern, const char* next, double interval) 
    {
       pointer = 0;                      // stop current activities
       led = LED_OFF;                    // reset led with LED_OFF
       
       sequence = next;                  // init morse sequence   
          
-      ticker.attach(callback,interval); // next LED state after every interval
+      ticker.attach(cbBlinker,interval);// next LED state after every interval
       pointer = pattern;                // enable callback activty
    }  
 
-   void blink(const char *pattern, double interval)
+   void blink(O&o, const char *pattern, double interval)
    {
-       blink(pattern,pattern,interval);
+       blink(o,pattern,pattern,interval);
    }
    
\ No newline at end of file