From 169050853af858fb21544c530624367792d1a36b Mon Sep 17 00:00:00 2001 From: travis-farmer Date: Sun, 22 Oct 2023 11:19:07 -0400 Subject: [PATCH] possible HA DCC waveform running on pins 8 and 9 --- DCCTimerGiga.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/DCCTimerGiga.cpp b/DCCTimerGiga.cpp index 5afc3ad..5c4034d 100644 --- a/DCCTimerGiga.cpp +++ b/DCCTimerGiga.cpp @@ -242,25 +242,25 @@ bool DCCTimer::isPWMPin(byte pin) { void DCCTimer::setPWM(byte pin, bool high) { switch (pin) { - case 12: + case 9: if (!tim3ModeHA) { - timerAux.setMode(1, TIMER_OUTPUT_COMPARE_INACTIVE, 13); + timerAux.setMode(1, TIMER_OUTPUT_COMPARE_INACTIVE, 9); tim3ModeHA = true; } if (high) - TIM3->CCMR1 = (TIM3->CCMR1 & ~TIM_CCMR1_OC1M_Msk) | TIM_CCMR1_OC1M_0; + TIM17->CCMR1 = (TIM17->CCMR1 & ~TIM_CCMR1_OC1M_Msk) | TIM_CCMR1_OC1M_0; else - TIM3->CCMR1 = (TIM3->CCMR1 & ~TIM_CCMR1_OC1M_Msk) | TIM_CCMR1_OC1M_1; + TIM17->CCMR1 = (TIM17->CCMR1 & ~TIM_CCMR1_OC1M_Msk) | TIM_CCMR1_OC1M_1; break; - case 13: + case 8: if (!tim2ModeHA) { - timer.setMode(1, TIMER_OUTPUT_COMPARE_INACTIVE, 12); + timer.setMode(1, TIMER_OUTPUT_COMPARE_INACTIVE, 8); tim2ModeHA = true; } if (high) - TIM2->CCMR1 = (TIM2->CCMR1 & ~TIM_CCMR1_OC1M_Msk) | TIM_CCMR1_OC1M_0; + TIM16->CCMR1 = (TIM16->CCMR1 & ~TIM_CCMR1_OC1M_Msk) | TIM_CCMR1_OC1M_0; else - TIM2->CCMR1 = (TIM2->CCMR1 & ~TIM_CCMR1_OC1M_Msk) | TIM_CCMR1_OC1M_1; + TIM16->CCMR1 = (TIM16->CCMR1 & ~TIM_CCMR1_OC1M_Msk) | TIM_CCMR1_OC1M_1; break; } }