49 RCC_ClocksTypeDef clocks;
52 RCC_GetClocksFreq(&clocks);
53 us_ticks = clocks.SYSCLK_Frequency / 1000000;
64 CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
67 DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
89 CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
90 last_count = DWT->CYCCNT;
93 uint32_t current_count;
97 CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
98 current_count = DWT->CYCCNT;
101 elapsed += current_count - last_count;
102 last_count = current_count;
106 if (elapsed_uS >= uS)
148 CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
186 CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
197 CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
207 uint32_t diff = later - raw;
uint32_t PIOS_DELAY_DiffuS(uint32_t raw)
Subtract raw time from now and convert to us.
uint32_t PIOS_DELAY_GetuS()
Query the Delay timer for the current uS.
Main PiOS header to include all the compiled in PiOS options.
uint32_t PIOS_DELAY_DiffuS2(uint32_t raw, uint32_t baseline)
Subrtact two raw times and convert to us.
#define PIOS_DEBUG_Assert(test)
uint32_t PIOS_DELAY_GetuSExpired(uint32_t t)
Calculates whether a given time has passed.
uint32_t PIOS_DELAY_GetuSSince(uint32_t t)
Calculate time in microseconds since a previous time.
static uint32_t us_modulo
int32_t PIOS_DELAY_Init(void)
#define PIOS_Assert(test)
int32_t PIOS_DELAY_WaitmS(uint32_t mS)
int32_t PIOS_DELAY_WaituS(uint32_t uS)
uint32_t PIOS_DELAY_GetRaw()
Get the raw delay timer, useful for timing.