Fix integer size bug for Delay::us

This commit is contained in:
Jan Käberich 2022-06-26 12:46:11 +02:00
parent 69269b4179
commit 4541dcb71b
3 changed files with 15 additions and 7 deletions

View file

@ -35,8 +35,8 @@ void Delay::ms(uint32_t t) {
us(1000);
}
}
void Delay::us(uint32_t t) {
uint64_t start = TIM1->CNT;
void Delay::us(uint16_t t) {
uint16_t start = TIM1->CNT;
while(TIM1->CNT - start < t);
}