comment notes updates

pull/24/head
midilab 12 months ago
parent 9b7abae36b
commit 69b9467cc1
  1. 4
      src/platforms/stm32.h
  2. 15
      src/uClock.cpp

@ -1,7 +1,7 @@
#include <Arduino.h>
#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();

@ -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 {

Loading…
Cancel
Save