Skip to content

Commit 5eb3b20

Browse files
authored
Merge pull request #647 from siddacious/samd51g_timer_fix
fixes timer number assumptions for samd51s for issue #646
2 parents 586be2e + e42209a commit 5eb3b20

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

ports/atmel-samd/timers.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,16 @@ const uint8_t tc_gclk_ids[TC_INST_NUM] = {TC0_GCLK_ID,
7373
TC7_GCLK_ID,
7474
#endif
7575
};
76-
const uint8_t tcc_gclk_ids[5] = {TCC0_GCLK_ID, TCC1_GCLK_ID, TCC2_GCLK_ID, TCC3_GCLK_ID,
77-
TCC4_GCLK_ID};
76+
const uint8_t tcc_gclk_ids[TCC_INST_NUM] = {TCC0_GCLK_ID,
77+
TCC1_GCLK_ID,
78+
TCC2_GCLK_ID,
79+
#ifdef TCC3_GCLK_ID
80+
TCC3_GCLK_ID,
81+
#endif
82+
#ifdef TCC4_GCLK_ID
83+
TCC4_GCLK_ID
84+
#endif
85+
};
7886
#endif
7987
Tc* const tc_insts[TC_INST_NUM] = TC_INSTS;
8088
Tcc* const tcc_insts[TCC_INST_NUM] = TCC_INSTS;
@@ -89,9 +97,15 @@ IRQn_Type const tc_irq[TC_INST_NUM] = {
8997
#ifdef TC2
9098
TC2_IRQn,
9199
#endif
100+
#ifdef TC3
92101
TC3_IRQn,
102+
#endif
103+
#ifdef TC4
93104
TC4_IRQn,
105+
#endif
106+
#ifdef TC5
94107
TC5_IRQn,
108+
#endif
95109
#ifdef TC6
96110
TC6_IRQn,
97111
#endif

ports/atmel-samd/timers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const uint8_t tcc_gclk_ids[3];
3636
#ifdef SAMD51
3737
const uint8_t tcc_cc_num[5];
3838
const uint8_t tc_gclk_ids[TC_INST_NUM];
39-
const uint8_t tcc_gclk_ids[5];
39+
const uint8_t tcc_gclk_ids[TCC_INST_NUM];
4040
#endif
4141
Tc* const tc_insts[TC_INST_NUM];
4242
Tcc* const tcc_insts[TCC_INST_NUM];

0 commit comments

Comments
 (0)