From a2b18b75d4bc68aa93edf67509185cb6e18f596b Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 16 Feb 2018 10:05:28 -0800 Subject: Fix loops and comma style. --- ports/atmel-samd/common-hal/pulseio/PWMOut.c | 2 +- ports/atmel-samd/common-hal/pulseio/PulseOut.c | 2 +- ports/atmel-samd/timers.c | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ports/atmel-samd/common-hal/pulseio/PWMOut.c b/ports/atmel-samd/common-hal/pulseio/PWMOut.c index cbcdeb03c..c68ea6985 100644 --- a/ports/atmel-samd/common-hal/pulseio/PWMOut.c +++ b/ports/atmel-samd/common-hal/pulseio/PWMOut.c @@ -156,7 +156,7 @@ void common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, direction = 1; start = 0; } - for (uint8_t i = start; i >= 0 && i < NUM_TIMERS_PER_PIN && timer == NULL; i += direction) { + for (int8_t i = start; i >= 0 && i < NUM_TIMERS_PER_PIN && timer == NULL; i += direction) { const pin_timer_t* t = &pin->timer[i]; if ((!t->is_tc && t->index >= TCC_INST_NUM) || (t->is_tc && t->index >= TC_INST_NUM)) { diff --git a/ports/atmel-samd/common-hal/pulseio/PulseOut.c b/ports/atmel-samd/common-hal/pulseio/PulseOut.c index d0cf8e666..95b0bbee0 100644 --- a/ports/atmel-samd/common-hal/pulseio/PulseOut.c +++ b/ports/atmel-samd/common-hal/pulseio/PulseOut.c @@ -98,7 +98,7 @@ void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self, if (refcount == 0) { // Find a spare timer. Tc *tc = NULL; - uint8_t index = TC_INST_NUM - 1; + int8_t index = TC_INST_NUM - 1; for (; index >= 0; index--) { if (tc_insts[index]->COUNT16.CTRLA.bit.ENABLE == 0) { tc = tc_insts[index]; diff --git a/ports/atmel-samd/timers.c b/ports/atmel-samd/timers.c index 7b85c5b26..7b5d06cb0 100644 --- a/ports/atmel-samd/timers.c +++ b/ports/atmel-samd/timers.c @@ -46,10 +46,10 @@ const uint8_t tc_gclk_ids[TC_INST_NUM] = {TC3_GCLK_ID, TC4_GCLK_ID, TC5_GCLK_ID, #ifdef TC6_GCLK_ID - , TC6_GCLK_ID + TC6_GCLK_ID, #endif #ifdef TC7_GCLK_ID - , TC7_GCLK_ID + TC7_GCLK_ID, #endif }; const uint8_t tcc_gclk_ids[3] = {TCC0_GCLK_ID, TCC1_GCLK_ID, TCC2_GCLK_ID}; @@ -59,18 +59,18 @@ const uint8_t tcc_cc_num[5] = {6, 4, 3, 2, 2}; const uint8_t tc_gclk_ids[TC_INST_NUM] = {TC0_GCLK_ID, TC1_GCLK_ID, TC2_GCLK_ID, - TC3_GCLK_ID + TC3_GCLK_ID, #ifdef TC4_GCLK_ID - , TC4_GCLK_ID + TC4_GCLK_ID, #endif #ifdef TC5_GCLK_ID - , TC5_GCLK_ID + TC5_GCLK_ID, #endif #ifdef TC6_GCLK_ID - , TC6_GCLK_ID + TC6_GCLK_ID, #endif #ifdef TC7_GCLK_ID - , TC7_GCLK_ID + TC7_GCLK_ID, #endif }; const uint8_t tcc_gclk_ids[5] = {TCC0_GCLK_ID, TCC1_GCLK_ID, TCC2_GCLK_ID, TCC3_GCLK_ID, @@ -91,12 +91,12 @@ IRQn_Type const tc_irq[TC_INST_NUM] = { #endif TC3_IRQn, TC4_IRQn, - TC5_IRQn + TC5_IRQn, #ifdef TC6 - , TC6_IRQn + TC6_IRQn, #endif #ifdef TC7 - , TC7_IRQn + TC7_IRQn, #endif }; -- cgit v1.2.3