diff --git a/src/platforms/stm32.h b/src/platforms/stm32.h index 857bfbe..5d4b906 100644 --- a/src/platforms/stm32.h +++ b/src/platforms/stm32.h @@ -1,7 +1,7 @@ #include #if !defined(STM32_CORE_VERSION) || (STM32_CORE_VERSION < 0x01090000) - #error "Due to API change, this library is compatible with STM32_CORE_VERSION >= 0x01090000. Please update your stm32duino core." + #error "Due to API change, this library is compatible with STM32_CORE_VERSION >= 0x01090000. Please update/install stm32duino core." #endif #if defined(TIM1) @@ -10,7 +10,7 @@ TIM_TypeDef * TimerInstance = TIM2; #endif -// Instantiate HardwareTimer object. Thanks to 'new' instanciation, HardwareTimer is not destructed when setup() function is finished. +// instantiate HardwareTimer object HardwareTimer * _uclockTimer = new HardwareTimer(TimerInstance); #define ATOMIC(X) noInterrupts(); X; interrupts(); diff --git a/src/uClock.cpp b/src/uClock.cpp index eb6ac75..f204a4f 100755 --- a/src/uClock.cpp +++ b/src/uClock.cpp @@ -58,20 +58,23 @@ #include "platforms/stm32.h" #endif +// +// Platform specific timer setup/control +// +// initTimer(uint32_t us_interval) and setTimer(uint32_t us_interval) +// are called from architecture specific module included at the +// header of this file void uclockInitTimer() { // begin at 120bpm (20833us) - const uint32_t init_clock = 20833; - // called from architecture specific module - initTimer(init_clock); + initTimer(20833); } void setTimerTempo(float bpm) { // convert bpm float into 96 ppqn resolution microseconds interval - uint32_t tick_us_interval = (60000000 / 24 / bpm); - // called from architecture specific module - setTimer(tick_us_interval); + uint32_t us_interval = (60000000 / 24 / bpm); + setTimer(us_interval); } namespace umodular { namespace clock {