31
31
#include "common-hal/pwmio/PWMOut.h"
32
32
#include "shared-bindings/pwmio/PWMOut.h"
33
33
#include "shared-bindings/microcontroller/Processor.h"
34
- #include "shared_timers.h"
35
34
#include "timer_handler.h"
36
35
37
36
#include "atmel_start_pins.h"
@@ -61,25 +60,9 @@ uint8_t tcc_channels[5]; // Set by pwmout_reset() to {0xc0, 0xf0, 0xf8, 0xfc,
61
60
62
61
63
62
void common_hal_pwmio_pwmout_never_reset (pwmio_pwmout_obj_t * self ) {
64
- timer_never_reset (self -> timer -> index , self -> timer -> is_tc );
65
-
66
63
never_reset_pin_number (self -> pin -> number );
67
64
}
68
65
69
- void pwmout_reset (void ) {
70
- // Reset all timers
71
- for (int i = 0 ; i < TCC_INST_NUM ; i ++ ) {
72
- target_tcc_frequencies [i ] = 0 ;
73
- tcc_refcount [i ] = 0 ;
74
- }
75
- for (int i = 0 ; i < TCC_INST_NUM ; i ++ ) {
76
- if (!timer_ok_to_reset (i , false)) {
77
- continue ;
78
- }
79
- tcc_channels [i ] = 0xff << tcc_cc_num [i ];
80
- }
81
- }
82
-
83
66
static uint8_t tcc_channel (const pin_timer_t * t ) {
84
67
// For the SAMD51 this hardcodes the use of OTMX == 0x0, the output matrix mapping, which uses
85
68
// SAMD21-style modulo mapping.
@@ -97,7 +80,6 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t *self,
97
80
uint16_t duty ,
98
81
uint32_t frequency ,
99
82
bool variable_frequency ) {
100
- self -> pin = pin ;
101
83
self -> variable_frequency = variable_frequency ;
102
84
self -> duty_cycle = duty ;
103
85
@@ -242,6 +224,7 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t *self,
242
224
}
243
225
244
226
self -> timer = timer ;
227
+ self -> pin = pin ;
245
228
246
229
gpio_set_pin_function (pin -> number , GPIO_PIN_FUNCTION_E + mux_position );
247
230
@@ -257,7 +240,6 @@ void common_hal_pwmio_pwmout_deinit(pwmio_pwmout_obj_t *self) {
257
240
if (common_hal_pwmio_pwmout_deinited (self )) {
258
241
return ;
259
242
}
260
- timer_reset_ok (self -> timer -> index , self -> timer -> is_tc );
261
243
const pin_timer_t * t = self -> timer ;
262
244
if (t -> is_tc ) {
263
245
Tc * tc = tc_insts [t -> index ];
0 commit comments