Skip to content

Commit

Permalink
Added micros_test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dhylands committed Aug 23, 2014
1 parent 9149623 commit d2c3b60
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions micros_test.py
@@ -0,0 +1,20 @@
import pyb

start = pyb.millis()
count = 0
while True:
pyb.disable_irq()
m = pyb.millis()
u = pyb.micros() & 0x7fffffff
pyb.enable_irq()
m2 = u // 1000
if m2 != m:
if m2 != (m + 1) or (u % 1000) > 100:
print("msec %d usec %d" % (m, u))
count += 1
if (m - start) >= 10000:
print('%4d err = %d' % (m // 1000, count))
start = m
if count > 0:
break

0 comments on commit d2c3b60

Please sign in to comment.