Skip to content

Commit eeaf08d

Browse files
committed
Update Timer and related for precision + power
Rework out-of-date references to internal 32-bit precision. Copy relevant note on power from Ticker to Timer and Timeout. Resolves ARMmbed/mbed-os#8312
1 parent 4e9ab77 commit eeaf08d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

docs/api/drivers/TimeOut.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ You can create any number of Timeout objects, allowing multiple outstanding inte
88

99
### Warnings and notes
1010

11-
* Timers are based on 32-bit int microsecond counters, so they can only time up to a maximum of 2^31-1 microseconds (30 minutes). They are designed for times between microseconds and seconds. For longer times, you should consider the time() real time clock.
12-
1311
* No blocking code in ISR: avoid any call to wait, infinite while loop or blocking calls in general.
1412

1513
* No printf, malloc or new in ISR: Avoid any call to bulky library functions. In particular, certain library functions (such as printf, malloc and new) are not re-entrant, and their behavior could be corrupted when called from an ISR.
1614

15+
* While a Timeout is running, deep sleep is blocked to maintain accurate timing. If you don't need microsecond precision, consider using the LowPowerTimeout class instead because this does not block deep sleep mode.
16+
1717
### Timeout class reference
1818

1919
[![View code](https://www.mbed.com/embed/?type=library)](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/classmbed_1_1_timeout.html)

docs/api/drivers/Timer.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
<span class="images">![](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/classmbed_1_1_timer.png)<span>Timer class hierarchy</span></span>
44

5-
Use the Timer interface to create, start, stop and read a timer for measuring small times (between microseconds and seconds).
5+
Use the Timer interface to create, start, stop and read a timer for measuring precise times (better than millisecond precision).
66

77
You can independently create, start and stop any number of Timer objects.
88

9-
<span class="notes">**Note:** Timers are based on 32-bit int microsecond counters, so they can only time up to a maximum of 2^31-1 microseconds (30 minutes). They are designed for times between microseconds and seconds. For longer times, use the `time()` real time clock. </span>
9+
### Warnings and notes
10+
11+
* Timers are based on 64-bit unsigned microsecond counters, but for backwards compatibility the `read_ms()` and `read_us()` methods only return 32-bit signed integers. This limits their range before wrapping to 49 days and 35 minutes respectively. Use `read_high_resolution_us()` to access the full range of over 500,000 years.
12+
13+
* While a Timer is running, deep sleep is blocked to maintain accurate timing. If you don't need microsecond precision, consider using the LowPowerTimer class instead because this does not block deep sleep mode.
1014

1115
### Timer class reference
1216

0 commit comments

Comments
 (0)