volatile tempo var and handling

pull/9/head
midilab 2 years ago
parent a6da23104b
commit 9932baf937
  1. 11
      src/uClock.cpp
  2. 3
      src/uClock.h

@ -166,8 +166,8 @@ void uClockClass::pause()
void uClockClass::setTimerTempo(float bpm)
{
// 96 ppqn resolution
tick_us_interval = (60000000 / 24 / bpm);
tick_hertz_interval = 1/((float)tick_us_interval/1000000);
uint32_t tick_us_interval = (60000000 / 24 / bpm);
float tick_hertz_interval = 1/((float)tick_us_interval/1000000);
#if defined(ARDUINO_ARCH_AVR)
uint32_t ocr;
@ -221,9 +221,12 @@ void uClockClass::setTempo(float bpm)
return;
}
setTimerTempo(bpm);
ATOMIC(
tempo = bpm
)
tempo = bpm;
setTimerTempo(tempo);
}
float inline uClockClass::freqToBpm(uint32_t freq)

@ -84,9 +84,6 @@ class uClockClass {
uint32_t last_interval;
uint32_t sync_interval;
uint32_t tick_us_interval;
float tick_hertz_interval;
float tempo;
uint32_t start_timer;
uint8_t mode;

Loading…
Cancel
Save