adafruit / ArduinoCore-samd

116 stars 119 forks source link

Fix tone on SAMD51 #257

Closed hathach closed 4 years ago

hathach commented 4 years ago

commit 1e9a669f07cce881c2861dfbc330cc0c5a0115d3 tries to use TC0 for tone, and TC1 for Servo. However, the servo remain unchanged (keep using TC0) causing the resource conflict. This PR does

Tone.cpp void TC0_Handler (void) attribute ((weak, alias("Tone_Handler")));


It is kind of weird, the compiler could pick either  Dummy_Handler or Tone_Handler in a rather random way. In my testing If using TC2 for tone, Tone_Handler is picked, however, using TC0 the Dummy_Handler is picked. It probably depends on the order of link file/archive etc .. It is hard to tell. So yeah, I think it is better to use strong symbol in this case.

@ladyada let's me know if you want to change the allocation of TC0/TC1 for tone/servo 
fix #255