Provide the correct numOfChnls value to FTM_SetupPwm(). Fixes #35. Fixes UltimateHackingKeyboard/bootloader#4.

This commit is contained in:
László Monda
2017-02-28 02:06:56 +01:00
parent 797c51ca7a
commit 1aae668ed5
2 changed files with 2 additions and 5 deletions

View File

@@ -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();
}

View File

@@ -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);