summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2018-02-27 10:37:10 -0800
committerGitHub <noreply@github.com>2018-02-27 10:37:10 -0800
commit5eb3b208e8d612e2b50bc6e402a2a8901c72640d (patch)
tree6b099cb4036b0398c50a9e02e0c3f4a17a69d188
parent586be2eb222fda72349ed8e85d715402f947b816 (diff)
parente42209a6b21ac840208139f8cf07f14015754e51 (diff)
Merge pull request #647 from siddacious/samd51g_timer_fix
fixes timer number assumptions for samd51s for issue #646
-rw-r--r--ports/atmel-samd/timers.c18
-rw-r--r--ports/atmel-samd/timers.h2
2 files changed, 17 insertions, 3 deletions
diff --git a/ports/atmel-samd/timers.c b/ports/atmel-samd/timers.c
index 7b5d06cb0..2e8541f24 100644
--- a/ports/atmel-samd/timers.c
+++ b/ports/atmel-samd/timers.c
@@ -73,8 +73,16 @@ const uint8_t tc_gclk_ids[TC_INST_NUM] = {TC0_GCLK_ID,
TC7_GCLK_ID,
#endif
};
-const uint8_t tcc_gclk_ids[5] = {TCC0_GCLK_ID, TCC1_GCLK_ID, TCC2_GCLK_ID, TCC3_GCLK_ID,
- TCC4_GCLK_ID};
+const uint8_t tcc_gclk_ids[TCC_INST_NUM] = {TCC0_GCLK_ID,
+ TCC1_GCLK_ID,
+ TCC2_GCLK_ID,
+#ifdef TCC3_GCLK_ID
+ TCC3_GCLK_ID,
+#endif
+#ifdef TCC4_GCLK_ID
+ TCC4_GCLK_ID
+#endif
+ };
#endif
Tc* const tc_insts[TC_INST_NUM] = TC_INSTS;
Tcc* const tcc_insts[TCC_INST_NUM] = TCC_INSTS;
@@ -89,9 +97,15 @@ IRQn_Type const tc_irq[TC_INST_NUM] = {
#ifdef TC2
TC2_IRQn,
#endif
+#ifdef TC3
TC3_IRQn,
+#endif
+#ifdef TC4
TC4_IRQn,
+#endif
+#ifdef TC5
TC5_IRQn,
+#endif
#ifdef TC6
TC6_IRQn,
#endif
diff --git a/ports/atmel-samd/timers.h b/ports/atmel-samd/timers.h
index a22ec7484..bb3ab5ee7 100644
--- a/ports/atmel-samd/timers.h
+++ b/ports/atmel-samd/timers.h
@@ -36,7 +36,7 @@ const uint8_t tcc_gclk_ids[3];
#ifdef SAMD51
const uint8_t tcc_cc_num[5];
const uint8_t tc_gclk_ids[TC_INST_NUM];
-const uint8_t tcc_gclk_ids[5];
+const uint8_t tcc_gclk_ids[TCC_INST_NUM];
#endif
Tc* const tc_insts[TC_INST_NUM];
Tcc* const tcc_insts[TCC_INST_NUM];