LibreVNA/Software/VNA_embedded/Application/Drivers/delay.cpp

17 lines
231 B
C++

#include "delay.hpp"
#include "stm.hpp"
void Delay::ms(uint32_t t) {
while(t--) {
us(1000);
}
}
void Delay::us(uint32_t t) {
TIM1->CNT = 0;
TIM1->CR1 |= TIM_CR1_CEN;
while (TIM1->CNT < t)
;
TIM1->CR1 &= ~TIM_CR1_CEN;
}