From ac64691a65e0e62fef10348ecb8582c37f50a7cb Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Thu, 9 Jul 2020 00:01:26 +0200 Subject: [PATCH 1/4] Better delay description CC #236 Signed-off-by: Daniel Egger --- src/asm.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/asm.rs b/src/asm.rs index ebd61b32..372924bf 100644 --- a/src/asm.rs +++ b/src/asm.rs @@ -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 { From cab9336edb48855b3797ed87ed856c558ad75c36 Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Thu, 9 Jul 2020 00:14:08 +0200 Subject: [PATCH 2/4] Update src/asm.rs Co-authored-by: Jonas Schievink --- src/asm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/asm.rs b/src/asm.rs index 372924bf..09ef75d6 100644 --- a/src/asm.rs +++ b/src/asm.rs @@ -30,7 +30,7 @@ pub fn bkpt() { /// 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 -/// and the execution time may wary with other factors. This delay is mainly useful for simple +/// and the execution time may vary 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] From dc7e636bbaa0912ac97d0bceac27f0d7675e7023 Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Thu, 9 Jul 2020 00:17:31 +0200 Subject: [PATCH 3/4] Change spelling of initialisation to AE Signed-off-by: Daniel Egger --- src/asm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/asm.rs b/src/asm.rs index 09ef75d6..fb772101 100644 --- a/src/asm.rs +++ b/src/asm.rs @@ -31,7 +31,7 @@ pub fn bkpt() { /// /// NOTE that the delay can take much longer if interrupts are serviced during its execution /// and the execution time may vary with other factors. This delay is mainly useful for simple -/// timer-less initialisation of peripherals iff accurate timing is not essential. In any other +/// timer-less initialization 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) { From 13d9b2f1da30b89f4746b689ad976d773d4f387a Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Thu, 9 Jul 2020 00:34:10 +0200 Subject: [PATCH 4/4] Expand iff and reword last sentence Signed-off-by: Daniel Egger --- src/asm.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/asm.rs b/src/asm.rs index fb772101..39cd8efd 100644 --- a/src/asm.rs +++ b/src/asm.rs @@ -31,8 +31,8 @@ pub fn bkpt() { /// /// NOTE that the delay can take much longer if interrupts are serviced during its execution /// and the execution time may vary with other factors. This delay is mainly useful for simple -/// timer-less initialization of peripherals iff accurate timing is not essential. In any other -/// case please use more accurate methods to cause a delay. +/// timer-less initialization of peripherals if and only if accurate timing is not essential. In +/// any other case please use a more accurate method to produce a delay. #[inline] pub fn delay(_n: u32) { // NOTE(divide by 4) is easier to compute than `/ 3` because it's just a shift (`>> 2`).