Просмотр исходного кода

fix double promotion

teensy4-core
Frank 5 лет назад
Родитель
Сommit
bf5b36c9ec
Аккаунт пользователя с таким Email не найден
1 измененных файлов: 2 добавлений и 2 удалений
  1. +2
    -2
      teensy4/IntervalTimer.h

+ 2
- 2
teensy4/IntervalTimer.h Просмотреть файл

} }
bool begin(void (*funct)(), float microseconds) { bool begin(void (*funct)(), float microseconds) {
if (microseconds <= 0 || microseconds > MAX_PERIOD) return false; if (microseconds <= 0 || microseconds > MAX_PERIOD) return false;
uint32_t cycles = (float)(24000000 / 1000000) * microseconds - 0.5;
uint32_t cycles = (float)(24000000 / 1000000) * microseconds - 0.5f;
if (cycles < 17) return false; if (cycles < 17) return false;
return beginCycles(funct, cycles); return beginCycles(funct, cycles);
} }
} }
void update(float microseconds) { void update(float microseconds) {
if (microseconds <= 0 || microseconds > MAX_PERIOD) return; if (microseconds <= 0 || microseconds > MAX_PERIOD) return;
uint32_t cycles = (float)(24000000 / 1000000) * microseconds - 0.5;
uint32_t cycles = (float)(24000000 / 1000000) * microseconds - 0.5f;
if (cycles < 17) return; if (cycles < 17) return;
if (channel) channel->LDVAL = cycles; if (channel) channel->LDVAL = cycles;
} }

Загрузка…
Отмена
Сохранить