zephyr/samples/boards/nrf52/power_mgr
Piotr Mienkowski 17b08ceca5 power: clean up system power managment function names
This commit cleans up names of system power management functions by
assuring that:
- all functions start with 'sys_pm_' prefix
- API functions which should not be exposed to the user start with '_'
- name of the function hints at its purpose

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-03-26 13:27:55 -04:00
..
src power: clean up system power managment function names 2019-03-26 13:27:55 -04:00
CMakeLists.txt cmake: increase minimal required version to 3.13.1 2019-01-03 11:51:29 -05:00
Kconfig power: rename Low Power States to Sleep States 2019-03-26 13:27:55 -04:00
README.rst power: rename Low Power States to Sleep States 2019-03-26 13:27:55 -04:00
prj.conf power: rename Low Power States to Sleep States 2019-03-26 13:27:55 -04:00
prj_tickless.conf power: rename Low Power States to Sleep States 2019-03-26 13:27:55 -04:00
sample.yaml power: rename Low Power States to Sleep States 2019-03-26 13:27:55 -04:00

README.rst

.. _nrf5x-power-mgr-sample:

nRF5x Power management demo
###########################

Overview
********

This sample demonstrates a power manager app that uses the Zephyr
power management infrastructure to enter into Low Power state.

This app will cycle through the following power schemes each time the system
enters idle state:

1. Low Power State: Low Power State could be SoC, board and/or application
   specific. Being in this state is transparent to devices. SOC and devices
   do not lose context in this Mode. This example implements two Low Power
   states, which are signaled using LEDs on the development kit:

   A. LED1: [X], LED2: [X]: System is active, no low power state is selected.
   B. LED1: [X], LED2: [ ]: System is idle, and the SYS_POWER_STATE_SLEEP_2
      state is selected.
   C. LED1: [ ], LED2: [ ]: System is idle, and the SYS_POWER_STATE_SLEEP_3
      state is selected.

2. Deep Sleep: This Power State is mapped to SYSTEM OFF state. In this mode
   all devices on board get suspended. All devices and SOC lose context on
   wake up.

The power mode selection is done automatically by residency-based policy
implemented by the Zephyr Power Management Subsystem.

Requirements
************

This application uses nRF51 DK or nRF52 DK board for the demo.

Building, Flashing and Running
******************************

.. zephyr-app-commands::
   :zephyr-app: samples/boards/nrf52/power_mgr
   :board: nrf52_pca10040
   :goals: build flash
   :compact:

Running:

1. Open UART terminal.
2. Power Cycle Device.
3. Device will enter into Low Power Modes.
4. Press Button 1 on device to enter deep sleep state.
5. Press Button 2 on device to wake up from deep sleep state.


Sample Output
=================
nRF52 core output
-----------------

.. code-block:: console

  *** Power Management Demo on nrf52_pca10040 ***
  Demo Description
  Application creates idleness, due to which System Idle Thread is
  scheduled and it enters into various Low Power States.

  <-- App doing busy wait for 10 Sec -->

  <-- App going to sleep for 10 Sec -->
  --> Entering to SYS_POWER_STATE_SLEEP_2 state.
  --> Exited from SYS_POWER_STATE_SLEEP_2 state.

  <-- App doing busy wait for 10 Sec -->

  <-- App going to sleep for 30 Sec -->
  --> Entering to SYS_POWER_STATE_SLEEP_3 state.
  --> Exited from SYS_POWER_STATE_SLEEP_3 state.

  <-- Disabling SYS_POWER_STATE_SLEEP_3 state --->

  <-- App doing busy wait for 10 Sec -->

  <-- App going to sleep for 10 Sec -->
  --> Entering to SYS_POWER_STATE_SLEEP_2 state.
  --> Exited from SYS_POWER_STATE_SLEEP_2 state.

  <-- App doing busy wait for 10 Sec -->

  <-- App going to sleep for 30 Sec -->
  --> Entering to SYS_POWER_STATE_SLEEP_2 state.
  --> Exited from SYS_POWER_STATE_SLEEP_2 state.

  <-- Enabling SYS_POWER_STATE_SLEEP_3 state --->
  <-- Disabling SYS_POWER_STATE_SLEEP_2 state --->

  <-- App doing busy wait for 10 Sec -->

  <-- App going to sleep for 10 Sec -->

  <-- App doing busy wait for 10 Sec -->

  <-- App going to sleep for 30 Sec -->
  --> Entering to SYS_POWER_STATE_SLEEP_3 state.
  --> Exited from SYS_POWER_STATE_SLEEP_3 state.

  <-- Enabling SYS_POWER_STATE_SLEEP_2 state --->
  <-- Forcing SYS_POWER_STATE_SLEEP_3 state --->

  <-- App doing busy wait for 10 Sec -->

  <-- App going to sleep for 10 Sec -->