atmel-samd: Reset TCC channel in use array on reset.

This fixes spurious "All timers in use" exceptions. Thanks to
@ladyada for finding this issue.
This commit is contained in:
Scott Shawcroft 2017-06-09 17:15:31 -07:00
parent 9434db07b2
commit 3658c92270

View File

@ -64,6 +64,12 @@ void pwmout_reset(void) {
while (tccs[i]->SYNCBUSY.bit.ENABLE == 1) {
}
}
// TODO(tannewt): Make this depend on the CMSIS.
if (i == 0) {
tcc_channels[i] = 0xf0;
} else {
tcc_channels[i] = 0xfc;
}
tccs[i]->CTRLA.bit.SWRST = 1;
}
Tc *tcs[TC_INST_NUM] = TC_INSTS;