From a3d53fbb2cc55eebed5e33f4c9969053b67b2d3f Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sun, 29 Jul 2018 12:17:51 -0400 Subject: [PATCH] Define wait() in fusee-primary/secondary --- fusee/fusee-primary/src/utils.c | 7 +++++++ fusee/fusee-secondary/src/utils.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/fusee/fusee-primary/src/utils.c b/fusee/fusee-primary/src/utils.c index 1ffe4b249..823e4ea00 100644 --- a/fusee/fusee-primary/src/utils.c +++ b/fusee/fusee-primary/src/utils.c @@ -13,6 +13,13 @@ #include +void wait(uint32_t microseconds) { + uint32_t old_time = TIMERUS_CNTR_1US_0; + while (TIMERUS_CNTR_1US_0 - old_time <= microseconds) { + /* Spin-lock. */ + } +} + __attribute__((noreturn)) void watchdog_reboot(void) { volatile watchdog_timers_t *wdt = GET_WDT(4); wdt->PATTERN = WDT_REBOOT_PATTERN; diff --git a/fusee/fusee-secondary/src/utils.c b/fusee/fusee-secondary/src/utils.c index d5f6bebf2..4aee48cf6 100644 --- a/fusee/fusee-secondary/src/utils.c +++ b/fusee/fusee-secondary/src/utils.c @@ -12,6 +12,13 @@ #include #include +void wait(uint32_t microseconds) { + uint32_t old_time = TIMERUS_CNTR_1US_0; + while (TIMERUS_CNTR_1US_0 - old_time <= microseconds) { + /* Spin-lock. */ + } +} + __attribute__((noreturn)) void watchdog_reboot(void) { volatile watchdog_timers_t *wdt = GET_WDT(4); wdt->PATTERN = WDT_REBOOT_PATTERN;