summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott.shawcroft@gmail.com>2017-06-09 17:15:31 -0700
committerScott Shawcroft <scott.shawcroft@gmail.com>2017-06-09 17:15:31 -0700
commit3658c922708109effce79864046581d1c8d927e7 (patch)
treed1c9b93825530931fc696c79534cd02082a51929
parent9434db07b2d931132b440dc0dc574b384e74d61b (diff)
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.
-rw-r--r--atmel-samd/common-hal/pulseio/PWMOut.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/atmel-samd/common-hal/pulseio/PWMOut.c b/atmel-samd/common-hal/pulseio/PWMOut.c
index ff61965a7..a98bf37ad 100644
--- a/atmel-samd/common-hal/pulseio/PWMOut.c
+++ b/atmel-samd/common-hal/pulseio/PWMOut.c
@@ -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;