diff options
Diffstat (limited to 'src/wiring/time.c')
-rw-r--r-- | src/wiring/time.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/wiring/time.c b/src/wiring/time.c index 1a91b5e..164d978 100644 --- a/src/wiring/time.c +++ b/src/wiring/time.c @@ -28,7 +28,7 @@ #include "time.h" #define CYCLES_PER_MICROSECOND 72 -#define THE_SECRET_TO_LIFE_THE_UNIVERSE_AND_EVERYTHING 42 +#define FUDGE 42 extern volatile uint32_t systick_timer_millis; @@ -47,26 +47,13 @@ void delay(unsigned long ms) } -#define MAGIC 4096 -/* HZ = 1000 - * n HZ*/ + +#if 1 void delayMicroseconds(uint32_t us) { uint32_t target; uint32_t last, cur, count; - -#if 0 - asm volatile("mov r0, %[count] \n\t" -"1: \n\t" - "subs r0, r0, #1 \n\t" - "bne 1b" - : - : [count] "r" (count) - : "r0", "cc"); -#endif - -#if 1 /* fudge factor hacky hack hack for function overhead */ - target = us * CYCLES_PER_MICROSECOND - THE_SECRET_TO_LIFE_THE_UNIVERSE_AND_EVERYTHING; + target = us * CYCLES_PER_MICROSECOND - FUDGE; /* Get current count */ last = systick_get_count(); @@ -81,5 +68,5 @@ void delayMicroseconds(uint32_t us) { } last = cur; } -#endif } +#endif |