Kaynağa Gözat

Merge pull request #461 from FrankBoesing/patch-7

fix double promotion
teensy4-core
Paul Stoffregen 4 yıl önce
ebeveyn
işleme
61750d5c1f
İşleme yapanın e-posta adresine bağlı hesap yok
4 değiştirilmiş dosya ile 6 ekleme ve 6 silme
  1. +2
    -2
      teensy4/IntervalTimer.h
  2. +1
    -1
      teensy4/Stream.cpp
  3. +1
    -1
      teensy4/nonstd.c
  4. +2
    -2
      teensy4/pwm.c

+ 2
- 2
teensy4/IntervalTimer.h Dosyayı Görüntüle

@@ -65,7 +65,7 @@ public:
}
bool begin(void (*funct)(), float microseconds) {
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;
return beginCycles(funct, cycles);
}
@@ -90,7 +90,7 @@ public:
}
void update(float microseconds) {
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 (channel) channel->LDVAL = cycles;
}

+ 1
- 1
teensy4/Stream.cpp Dosyayı Görüntüle

@@ -197,7 +197,7 @@ float Stream::parseFloat(char skipChar){
else if(c >= '0' && c <= '9') { // is c a digit?
value = value * 10 + c - '0';
if(isFraction)
fraction *= 0.1;
fraction *= 0.1f;
}
read(); // consume the character we got with peek
c = timedPeek();

+ 1
- 1
teensy4/nonstd.c Dosyayı Görüntüle

@@ -163,7 +163,7 @@ char * dtostrf(float val, int width, unsigned int precision, char *buf)

// shift decimal point
while (newPrecision > 0) {
val *= 10.0;
val *= 10.0f;
newPrecision--;
}


+ 2
- 2
teensy4/pwm.c Dosyayı Görüntüle

@@ -119,7 +119,7 @@ void flexpwmFrequency(IMXRT_FLEXPWM_t *p, unsigned int submodule, uint8_t channe
{
uint16_t mask = 1 << submodule;
uint32_t olddiv = p->SM[submodule].VAL1;
uint32_t newdiv = (uint32_t)((float)F_BUS_ACTUAL / frequency + 0.5);
uint32_t newdiv = (uint32_t)((float)F_BUS_ACTUAL / frequency + 0.5f);
uint32_t prescale = 0;
//printf(" div=%lu\n", newdiv);
while (newdiv > 65535 && prescale < 7) {
@@ -158,7 +158,7 @@ void quadtimerWrite(IMXRT_TMR_t *p, unsigned int submodule, uint16_t val)

void quadtimerFrequency(IMXRT_TMR_t *p, unsigned int submodule, float frequency)
{
uint32_t newdiv = (uint32_t)((float)F_BUS_ACTUAL / frequency + 0.5);
uint32_t newdiv = (uint32_t)((float)F_BUS_ACTUAL / frequency + 0.5f);
uint32_t prescale = 0;
//printf(" div=%lu\n", newdiv);
while (newdiv > 65534 && prescale < 7) {

Yükleniyor…
İptal
Kaydet