Arduino functions millis, micros and eventually some more to come

Dependents:   DigitalCamera_OV5642_WIZwiki-W7500 BMC F746NG_TestAll Prelude_OV5642_dev

Arduino basic compatibility millis(), micros(), evtl. more to come.

micros() and millis() are uint32_t and have a correct overflow at 2^32-1. micros() has a granularity/resolution of 50. This can be changed by a define. 1 microsecond is not realistic because every count needs an irq. A resolution of 50 microseconds means 20KHz irq. That should not take away more than 1 percent overall processing time.

Files at this revision

API Documentation at this revision

Comitter:
eduardoG26
Date:
Mon Mar 30 13:50:18 2015 +0000
Parent:
2:215810c8e89e
Commit message:
TICKER_PERIOD_US changed to 50

Changed in this revision

Arduino.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Arduino.cpp	Fri Mar 27 15:36:20 2015 +0000
+++ b/Arduino.cpp	Mon Mar 30 13:50:18 2015 +0000
@@ -33,7 +33,7 @@
 #endif
 
 // Period of IRQ in µs. This is the minimum (!) granularity of micros().
-#define TICKER_PERIOD_US (32uL)
+#define TICKER_PERIOD_US (50uL)
 
 static volatile uint32_t MilliSeconds_u32, MicroSeconds_u32, MicroSecondsLast_u32;