From 98f790b03aeba3fca6b87716ecadd076bed0c506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Tue, 25 Sep 2018 21:41:17 +0200 Subject: [PATCH] nrf/timer: Fix disabling Timer 1 when using soft PWM. Don't exclude the Timer instance 1 entry from machine_timer_obj[] when using soft PWM. The usage is already checked when creating the Timer, so just create an empty entry. --- ports/nrf/modules/machine/timer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ports/nrf/modules/machine/timer.c b/ports/nrf/modules/machine/timer.c index e5e84a688d..4b7c995397 100644 --- a/ports/nrf/modules/machine/timer.c +++ b/ports/nrf/modules/machine/timer.c @@ -53,7 +53,9 @@ STATIC mp_obj_t machine_timer_callbacks[] = { STATIC const machine_timer_obj_t machine_timer_obj[] = { {{&machine_timer_type}, NRFX_TIMER_INSTANCE(0)}, -#if !defined(MICROPY_PY_MACHINE_SOFT_PWM) || (MICROPY_PY_MACHINE_SOFT_PWM == 0) +#if MICROPY_PY_MACHINE_SOFT_PWM + { }, +#else {{&machine_timer_type}, NRFX_TIMER_INSTANCE(1)}, #endif {{&machine_timer_type}, NRFX_TIMER_INSTANCE(2)},