From f9f8c6f687dc3c0098fa5f74af70cd0fcc6c14b3 Mon Sep 17 00:00:00 2001 From: luni64 Date: Sun, 2 Aug 2020 14:37:45 +0200 Subject: [PATCH] =?UTF-8?q?getMaxPeriod=20output=20seconds=20instead=20of?= =?UTF-8?q?=20=C2=B5s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Teensy/GPT/GPTChannel.h | 2 +- src/Teensy/PIT4/PITChannel.h | 2 +- src/Teensy/TMR/TMRChannel.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Teensy/GPT/GPTChannel.h b/src/Teensy/GPT/GPTChannel.h index 814254e..2fddadd 100644 --- a/src/Teensy/GPT/GPTChannel.h +++ b/src/Teensy/GPT/GPTChannel.h @@ -110,7 +110,7 @@ namespace TeensyTimerTool float GptChannel::getMaxPeriod() { - uint32_t pid_clock_mhz = (CCM_CSCMR1 & CCM_CSCMR1_PERCLK_CLK_SEL) ? 24 : (F_BUS_ACTUAL / 1000000); + float pid_clock_mhz = (CCM_CSCMR1 & CCM_CSCMR1_PERCLK_CLK_SEL) ? 24E6f : (F_BUS_ACTUAL); return (float)0xFFFF'FFFE / pid_clock_mhz; } diff --git a/src/Teensy/PIT4/PITChannel.h b/src/Teensy/PIT4/PITChannel.h index a2c0453..5d61eb4 100644 --- a/src/Teensy/PIT4/PITChannel.h +++ b/src/Teensy/PIT4/PITChannel.h @@ -131,7 +131,7 @@ namespace TeensyTimerTool float PITChannel::getMaxPeriod() { - return (float)0xFFFF'FFFE / clockFactor; + return (float)0xFFFF'FFFE / clockFactor / 1'000'000; } diff --git a/src/Teensy/TMR/TMRChannel.h b/src/Teensy/TMR/TMRChannel.h index 34ca98f..4e5135f 100644 --- a/src/Teensy/TMR/TMRChannel.h +++ b/src/Teensy/TMR/TMRChannel.h @@ -135,7 +135,7 @@ namespace TeensyTimerTool float TMRChannel::getMaxPeriod() { - return pscValue / 150.0f * 0xFFFE; + return pscValue / 150'000'000.0f * 0xFFFE; } void TMRChannel::_setNextPeriod(const uint16_t cnt)