12345678910111213141516 |
- /**
- * Delay
- * no interrupt, clk = sysclk/8
- * не проверял пока.
- */
- inline void _delay_us(uint32_t us) {
- if (us > 0xFFFFFFUL) {
- us = 0xFFFFFFUL;
- }
- us *= (STM32_HCLK/8);
- SysTick->LOAD = us;
- SysTick->VAL = 0;
- SysTick->CTRL = SysTick_CTRL_ENABLE_Msk;
- while (!(SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk));
- SysTick->CTRL = 0;
- }
|