samples: cc13x2_cc26x2: system_off: fix force state usage

This is the same fix as the one introduced in 49520eea57 ("samples: nrf:
system_off: Fix force state usage") for nRF boards. Quoting original
commit:

  The sample cannot spin in an infinity loop because the idle thread
  will not run and consequently the forced state will not be used.

Without this fix, the system doesn't enter SOFT_OFF state:

  *** Booting Zephyr OS build zephyr-v3.0.0-3495-ga456c5274614  ***

  cc1352r1_launchxl system off demo
  Busy-wait 5 s
  Sleep 2000 us (IDLE)
  Sleep 3 s (STANDBY)
  Entering system off (SHUTDOWN); press BUTTON1 to restart
  ERROR: System off failed

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This commit is contained in:
Piotr Dymacz 2022-05-04 15:57:14 +02:00 committed by Carles Cufí
commit e02acca690

View file

@ -69,6 +69,12 @@ void main(void)
*/ */
pm_state_force(0u, &(struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0}); pm_state_force(0u, &(struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0});
/* Now we need to go sleep. This will let the idle thread runs and
* the pm subsystem will use the forced state. To confirm that the
* forced state is used, lets set the same timeout used previously.
*/
k_sleep(K_SECONDS(SLEEP_S));
printk("ERROR: System off failed\n"); printk("ERROR: System off failed\n");
while (true) { while (true) {
/* spin to avoid fall-off behavior */ /* spin to avoid fall-off behavior */