AVR C Runtime Library - Patches: patch #6236, Improving _delay_us and _delay_ms
You are not allowed to post comments on this tracker with your current authentication level.
patch #6236: Improving _delay_us and _delay_ms
Submitter: | Florin-Viorel Petrov <fonitzu> | ||
Submitted: | Wed 17 Oct 2007 04:13:24 PM UTC | ||
Category: | None | Priority: | 5 - Normal |
Status: | Done | Privacy: | Public |
Assigned to: | joerg_wunsch | Open/Closed: | Closed |
Attached Files
Depends on the following items: None found
Items that depend on this one: None found
Carbon-Copy List
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follow 4 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2007-10-28 | joerg_wunsch | Status | None | Done | |
Assigned to | None | joerg_wunsch | |||
Open/Closed | Open | Closed | |||
2007-10-17 | fonitzu | Attached File | - | Added delay.h, #14157 |
Powered by Savane 3.13-02a9.
Corresponding source code
_delay_us and _delay_ms are improved with a fall-back functionality, that means, instead of clipping to the maximal possible delay in case of exceeding allowable argument value, they behave so:
_delay_us will call _delay_ms instead
_delay_ms will perform a delay up to 6.55 seconds using a 0.1ms delay loop
This will avoid subtle errors on the user side when one require delays longer than allowed - for example _delay_us(1000) will be compiled as _delay_ms(1) instead.
As proved on my computer, the compiler, using optimizations, will simply replace _delay_us with _delay_ms if it's the case and _delay_ms will be expanded to a small loop only if it's necessary.
Known problems:
- the user will not be informed in a fall-back case
- for _delay_ms it will be always a trade-of between loop resolution (0.1ms now) and induced error (loop counter overhead)