From 202a1994421063cc75f6c59423f5cbd2d1590143 Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Tue, 30 Jan 2024 21:58:38 +0100 Subject: [PATCH] Module17: added a 100ms sleep after power off to prevent the board from rebooting. Fix #230. --- platform/targets/Module17/platform.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/targets/Module17/platform.c b/platform/targets/Module17/platform.c index 451df584..0ba2f354 100644 --- a/platform/targets/Module17/platform.c +++ b/platform/targets/Module17/platform.c @@ -104,7 +104,13 @@ void platform_terminate() nvm_terminate(); audio_terminate(); + /* + * Cut off the power switch then wait 100ms to allow the 3.3V rail to + * effectively go down to 0V. Without this delay, the board fails to power + * off because the main() function returns, triggering an OS reboot. + */ gpio_clearPin(POWER_SW); + sleepFor(0, 100); } uint16_t platform_getVbat()