Skip to content

Commit eab4867

Browse files
committed
Remove dead replaced code
As requested, I removed the dead code that was replaced
1 parent 02a0939 commit eab4867

File tree

1 file changed

+5
-18
lines changed
  • ports/mimxrt10xx/common-hal/pwmio

1 file changed

+5
-18
lines changed

ports/mimxrt10xx/common-hal/pwmio/PWMOut.c

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@ void debug_print_flexpwm_registers(PWM_Type *base) {
101101
base->FSTS, base->FFILT, base->FTST, base->FCTRL2);
102102
for (uint8_t i = 0; i < 4; i++) {
103103
mp_printf(&mp_plat_print,
104-
"\t\t(%u) INIT:%x CTRL2:%x CTRL:%x VAL0:%x VAL1:%x VAL2:%x VAL3:%x VAL4:%x VAL5:%x OCTRL:%x DTCNT0:%x DTCNT1:%x\n", i,
104+
"\t\t(%u) INIT:%x CTRL2:%x CTRL:%x VAL0:%x VAL1:%x VAL2:%x VAL3:%x VAL4:%x VAL5:%x OCTRL:%x DTCNT0:%x DTCNT1:%x DISMAP: %x %x\n", i,
105105
base->SM[i].INIT, base->SM[i].CTRL2, base->SM[i].CTRL, base->SM[i].VAL0, base->SM[i].VAL1, base->SM[i].VAL2,
106-
base->SM[i].VAL3, base->SM[i].VAL4, base->SM[i].VAL5, base->SM[i].OCTRL, base->SM[i].DTCNT0, base->SM[i].DTCNT1);
106+
base->SM[i].VAL3, base->SM[i].VAL4, base->SM[i].VAL5, base->SM[i].OCTRL, base->SM[i].DTCNT0, base->SM[i].DTCNT1,
107+
base->SM[i].DISMAP[0], base->SM[i].DISMAP[1]);
107108
}
108109

109110
}
@@ -183,23 +184,11 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t *self,
183184
self->pwm->pwm->SM[self->pwm->submodule].DISMAP[1] = 0;
184185

185186
DBGPrintf(&mp_plat_print, "\tCall PWM_SetupPwm %p %x %u\n", self->pwm->pwm, self->pwm->submodule);
186-
#if 0
187+
// ========================================================================================================
187188
// Not calling the PWM_SetupPwm as it was setup to only work for PWM output on chan A and B but not X
188189
// I have done some experimenting, probably could try others, but again they do not work with X.
189190
// Most of the code checks to see if A if not, then it assume B.
190-
pwm_signal_param_t pwmSignal = {
191-
.pwmChannel = self->pwm->channel,
192-
.level = kPWM_HighTrue,
193-
.dutyCyclePercent = 0, // avoid an initial transient
194-
.deadtimeValue = 0, // allow 100% duty cycle
195-
};
196-
status_t status = PWM_SetupPwm(self->pwm->pwm, self->pwm->submodule, &pwmSignal, 1, kPWM_EdgeAligned, frequency, PWM_SRC_CLK_FREQ);
197-
198-
if (status != kStatus_Success) {
199-
return PWMOUT_INITIALIZATION_ERROR;
200-
}
201-
#else
202-
// ========================================================================================================
191+
//
203192
// Instead I set it up to work similar to what the Teensy 4.x code does.
204193
//
205194
// That is we set the PWM_CTRL_FULL_MASK, which then uses base->SM[submodule].VAL1 to control
@@ -237,8 +226,6 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t *self,
237226
}
238227
debug_print_flexpwm_registers(self->pwm->pwm);
239228

240-
#endif
241-
242229
PWM_SetPwmLdok(self->pwm->pwm, 1 << self->pwm->submodule, true);
243230

244231
PWM_StartTimer(self->pwm->pwm, 1 << self->pwm->submodule);

0 commit comments

Comments
 (0)