File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
ports/atmel-samd/common-hal/pwmio Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 44
44
45
45
# define _TCC_SIZE (unused , n ) TCC ## n ## _SIZE,
46
46
# define TCC_SIZES { REPEAT_MACRO(_TCC_SIZE, 0, TCC_INST_NUM) }
47
+ static const uint8_t tcc_sizes [TCC_INST_NUM ] = TCC_SIZES ;
47
48
48
49
static uint32_t tcc_periods [TCC_INST_NUM ];
49
50
static uint32_t tc_periods [TC_INST_NUM ];
@@ -233,8 +234,7 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t* self,
233
234
resolution = 16 ;
234
235
} else {
235
236
// TCC resolution varies so look it up.
236
- const uint8_t _tcc_sizes [TCC_INST_NUM ] = TCC_SIZES ;
237
- resolution = _tcc_sizes [timer -> index ];
237
+ resolution = tcc_sizes [timer -> index ];
238
238
}
239
239
// First determine the divisor that gets us the highest resolution.
240
240
uint32_t system_clock = common_hal_mcu_processor_get_frequency ();
@@ -421,7 +421,8 @@ void common_hal_pwmio_pwmout_set_frequency(pwmio_pwmout_obj_t* self,
421
421
if (t -> is_tc ) {
422
422
resolution = 16 ;
423
423
} else {
424
- resolution = 24 ;
424
+ // TCC resolution varies so look it up.
425
+ resolution = tcc_sizes [t -> index ];
425
426
}
426
427
uint32_t system_clock = common_hal_mcu_processor_get_frequency ();
427
428
uint32_t new_top ;
You can’t perform that action at this time.
0 commit comments