mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-24 08:36:14 +01:00
possible HA DCC waveform running on pins 8 and 9
This commit is contained in:
parent
4bc7c2632a
commit
169050853a
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user