Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void _delay_cycles(void *const hw, uint32_t cycles)
- {
- (void)hw;
- uint8_t n = cycles >> 24;
- uint32_t buf = cycles;
- while (n--) {
- SysTick->LOAD = 0xFFFFFF;
- SysTick->VAL = 0xFFFFFF;
- while (!(SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk))
- ;
- buf -= 0xFFFFFF;
- }
- SysTick->LOAD = buf;
- SysTick->VAL = buf;
- while (!(SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk))
- ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement