Update vom 10.05.15

Dependents:   19_Taster_BSW_oo 19_Taster_a

Fork of timer0 by Reinhold Schaefer

Revision:
1:45063f72267b
Parent:
0:bbd867fd30d1
--- a/timer0.cpp	Sat Jul 26 07:27:37 2014 +0000
+++ b/timer0.cpp	Fri Aug 08 16:02:01 2014 +0000
@@ -12,6 +12,8 @@
       CountDownTimers[i].status = 0xFF;
   
     ticker.attach_us(this, &timer0::func, 1000);
+    
+    countMillisecond = 0;
 }
 
 //--------------------------------------------------------
@@ -20,13 +22,16 @@
 {
     uint8_t i;
     
+    countMillisecond++;
+    
     if(counter != 0) counter--;
 
     // ----- count down timers in ms -------------------------------------------------
+    
     for (i=0; i<TIMER0_NUM_COUNTDOWNTIMERS; i++) 
     {
         if (CountDownTimers[i].status == 1) 
-        {       // 10 ms
+        {      
             if (CountDownTimers[i].count_timer > 0)
                 CountDownTimers[i].count_timer -- ;
             if (CountDownTimers[i].count_timer == 0)
@@ -34,6 +39,25 @@
         }
     }
 
+    //---------------------------------------------------------
+    // count down timer für Sekunden
+    
+    if (countMillisecond >= 1000)
+    { 
+        countMillisecond = 0;        // ----- count down timers in Sekunden -------------------------------------------------
+        
+        for (i=0; i<TIMER0_NUM_COUNTDOWNTIMERS; i++) 
+        {
+            if (CountDownTimers[i].status == 2) 
+            {       
+                if (CountDownTimers[i].count_timer > 0)
+                    CountDownTimers[i].count_timer -- ;
+                if (CountDownTimers[i].count_timer == 0)
+                    CountDownTimers[i].status = 0;
+            }
+        }
+    }
+
 }
 
 //--------------------------------------------------------