handle 'set_timer_handler' on this side, vs samd-periphs.
This commit is contained in:
parent
dafc370d22
commit
55e7c5a41b
@ -252,7 +252,8 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self,
|
||||
tc_gclk = 1;
|
||||
#endif
|
||||
|
||||
turn_on_clocks(true, tc_index, tc_gclk, TC_HANDLER_NO_INTERRUPT);
|
||||
set_timer_handler(true, tc_index, TC_HANDLER_NO_INTERRUPT);
|
||||
turn_on_clocks(true, tc_index, tc_gclk);
|
||||
|
||||
// Don't bother setting the period. We set it before you playback anything.
|
||||
tc_set_enable(t, false);
|
||||
|
@ -235,8 +235,9 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
|
||||
}
|
||||
}
|
||||
|
||||
set_timer_handler(timer->is_tc, timer->index, TC_HANDLER_NO_INTERRUPT);
|
||||
// We use the zeroeth clock on either port to go full speed.
|
||||
turn_on_clocks(timer->is_tc, timer->index, 0, TC_HANDLER_NO_INTERRUPT);
|
||||
turn_on_clocks(timer->is_tc, timer->index, 0);
|
||||
|
||||
if (timer->is_tc) {
|
||||
tc_periods[timer->index] = top;
|
||||
|
@ -113,13 +113,14 @@ void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
|
||||
|
||||
pulseout_tc_index = index;
|
||||
|
||||
set_timer_handler(true, index, TC_HANDLER_PULSEOUT);
|
||||
// We use GCLK0 for SAMD21 and GCLK1 for SAMD51 because they both run at 48mhz making our
|
||||
// math the same across the boards.
|
||||
#ifdef SAMD21
|
||||
turn_on_clocks(true, index, 0, TC_HANDLER_PULSEOUT);
|
||||
turn_on_clocks(true, index, 0);
|
||||
#endif
|
||||
#ifdef SAMD51
|
||||
turn_on_clocks(true, index, 1, TC_HANDLER_PULSEOUT);
|
||||
turn_on_clocks(true, index, 1);
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -34,8 +34,10 @@
|
||||
|
||||
static uint8_t tc_handler[TC_INST_NUM];
|
||||
|
||||
void set_timer_handler(uint8_t index, uint8_t timer_handler) {
|
||||
tc_handler[index] = timer_handler;
|
||||
void set_timer_handler(bool is_tc, uint8_t index, uint8_t timer_handler) {
|
||||
if (is_tc) {
|
||||
tc_handler[index] = timer_handler;
|
||||
}
|
||||
}
|
||||
|
||||
void shared_timer_handler(bool is_tc, uint8_t index) {
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define TC_HANDLER_PULSEOUT 0x1
|
||||
#define TC_HANDLER_FREQUENCYIN 0x2
|
||||
|
||||
void set_timer_handler(uint8_t index, uint8_t timer_handler);
|
||||
void set_timer_handler(bool is_tc, uint8_t index, uint8_t timer_handler);
|
||||
void shared_timer_handler(bool is_tc, uint8_t index);
|
||||
|
||||
#endif // MICROPY_INCLUDED_ATMEL_SAMD_TIMER_HANDLER_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user