diff options
author | 2020-07-09 00:01:26 +0200 | |
---|---|---|
committer | 2020-07-09 00:01:50 +0200 | |
commit | ac64691a65e0e62fef10348ecb8582c37f50a7cb (patch) | |
tree | 9739db03a4afc9678b54e6161666dddafcba4395 | |
parent | b01dcb48e1893cb148523c5476a5ab0b0f67c861 (diff) | |
download | cortex-m-ac64691a65e0e62fef10348ecb8582c37f50a7cb.tar.gz cortex-m-ac64691a65e0e62fef10348ecb8582c37f50a7cb.tar.zst cortex-m-ac64691a65e0e62fef10348ecb8582c37f50a7cb.zip |
Better delay description
CC #236
Signed-off-by: Daniel Egger <daniel@eggers-club.de>
-rw-r--r-- | src/asm.rs | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -26,13 +26,16 @@ pub fn bkpt() { /// Blocks the program for *at least* `n` instruction cycles /// -/// This is implemented in assembly so its execution time is the same regardless of the optimization -/// level. +/// This is implemented in assembly so its execution time is independent of the optimization +/// level, however it is dependent on the specific architecture and core configuration. /// -/// NOTE that the delay can take much longer if interrupts are serviced during its execution. +/// NOTE that the delay can take much longer if interrupts are serviced during its execution +/// and the execution time may wary with other factors. This delay is mainly useful for simple +/// timer-less initialisation of peripherals iff accurate timing is not essential. In any other +/// case please use more accurate methods to cause a delay. #[inline] pub fn delay(_n: u32) { - // NOTE(divide by 4) is easier to compute than `/ 3` is it's just a shift (`>> 2`). + // NOTE(divide by 4) is easier to compute than `/ 3` because it's just a shift (`>> 2`). match () { #[cfg(all(cortex_m, feature = "inline-asm"))] () => unsafe { |