A tight BPM clock generator for Arduino platform using hardware timer. AVRs, Teensy and XIAO support
fixed a bpm printing problem within midi monitor examples that freezes the microcontroler.
Bugfixed a problem that freezed Xiao when using TinyUSB from adafruit and uClock library.
Thanks @mightycoco for the coded support/tests and @m-r-m-s for reporting and testing.
Clock generation and sync engine totally rewrited for better performance and timming.
Timer implemented to run from timer0, timer1 or timer2 on AVR boards.
Make use if you want to integrate uClock along with some library that already make use of timer1(the default and preferred uClock timer on avr boards).
You can chose your timer from uClock.cpp a #define code area:
// pickup a avr timer to make use.
// pickup only one!
// try to avoid timer0, only use it if you know what you are doing.
// 0 = delay(), millis() e micros()
// 1 = Servo.h library(any other?)
// 2 = tone()
//#define AVR_TIMER_0
#define AVR_TIMER_1
//#define AVR_TIMER_2
getTempo() fix for slave sync when receiving stop byte. this fix avoids getTempo() returns random tempo after stop byte received.
Thanks Matthew for reporting and debuging it.