template <typename period_t>
bool begin(callback_t funct, period_t period) {
uint32_t cycles = cyclesFromPeriod(period);
return cycles >= 17 ? beginCycles(funct, cycles) : false;
}
// Change the timer's interval. The current interval is completed
// as previously configured, and then the next interval begins with
// with this new setting.
void update(unsigned int microseconds) {
if (microseconds == 0 || microseconds > MAX_PERIOD) return;
uint32_t cycles = (24000000 / 1000000) * microseconds - 1;
if (cycles < 17) return;
if (channel) channel->LDVAL = cycles;
}
// Change the timer's interval. The current interval is completed
// as previously configured, and then the next interval begins with
// with this new setting.
template <typename period_t>
void update(period_t period){
uint32_t cycles = cyclesFromPeriod(period);
if (cycles < 17) return;
if (channel) channel->LDVAL = cycles;
}