Mark Gottscho / HardwareTimersLib

Fork of HardwareTimersLib by Mark Gottscho

Revision:
11:e0442c8b182b
Parent:
9:dff7c891ec77
Child:
12:cb395e4be69e
--- a/Timer_PIT.cpp	Tue Mar 11 04:18:04 2014 +0000
+++ b/Timer_PIT.cpp	Tue Mar 11 04:54:13 2014 +0000
@@ -39,10 +39,14 @@
     uint32_t tick;
     uint32_t count;
 
-    __disable_irq(); //CRITICAL SECTION -- ALL INTERRUPTS MUST BE STOPPED!
+    //__disable_irq(); //CRITICAL SECTION -- ALL INTERRUPTS MUST BE STOPPED!
     tick = PIT->CHANNEL[0].CVAL; //counts down
+    
+    //It is theoretically possible that the timer interrupt is invoked here, between these two lines.
+    //However, the timer doesn't appear to work properly if I put these two in a critical section.
+    
     count = __count;
-    __enable_irq(); //END CRITICAL SECTION
+    //__enable_irq(); //END CRITICAL SECTION
         
     //Convert to ticks
     return (__rolloverValue - tick) + count * __rolloverValue;