diff --git a/right/src/init_peripherials.c b/right/src/init_peripherials.c index 0085c0d..623a618 100644 --- a/right/src/init_peripherials.c +++ b/right/src/init_peripherials.c @@ -53,11 +53,9 @@ void InitPeripherials(void) InitResetButton(); InitMergeSensor(); InitI2c(); + InitTestLed(); #if UHK_PCB_MAJOR_VERSION >= 7 LedPwm_Init(); #endif - InitTestLed(); // This function must not be called before LedPwm_Init() or else the UHK won't - // reenumerate over USB unless disconnecting it, waiting for at least 4 seconds - // and reconnecting it. This is the strangest thing ever! InitI2cWatchdog(); } diff --git a/right/src/led_pwm.c b/right/src/led_pwm.c index e77e6c3..bdd0b95 100644 --- a/right/src/led_pwm.c +++ b/right/src/led_pwm.c @@ -2,7 +2,6 @@ #include "fsl_port.h" void LedPwm_Init() { - CLOCK_EnableClock(LED_PWM_CLOCK); PORT_SetPinMux(LED_PWM_PORT, LED_PWM_PIN, kPORT_MuxAlt4); @@ -15,7 +14,7 @@ void LedPwm_Init() { ftmParam[0].level = kFTM_LowTrue; ftmParam[0].dutyCyclePercent = 100 - INITIAL_DUTY_CYCLE_PERCENT; ftmParam[0].firstEdgeDelayPercent = 0; - FTM_SetupPwm(LED_PWM_FTM_BASEADDR, ftmParam, sizeof(ftmParam), + FTM_SetupPwm(LED_PWM_FTM_BASEADDR, ftmParam, 1, kFTM_EdgeAlignedPwm, FTM_PWM_FREQUENCY, FTM_SOURCE_CLOCK); FTM_StartTimer(LED_PWM_FTM_BASEADDR, kFTM_SystemClock);