zephyr/samples/boards/ti/cc13x2_cc26x2/system_off
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
..
src includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h> 2022-09-05 16:31:47 +02:00
CMakeLists.txt
README.rst
prj.conf
sample.yaml

README.rst

.. _ti-cc13x2_cc26x2-system-off-sample:

cc13x2_cc26x2 System Off demo
#############################

Overview
********

This sample can be used for basic power measurement and as an example of
the various sleep modes on TI CC13x2/CC26x2 platforms.  The functional
behavior is:

* Busy-wait for 5 seconds
* Sleep for 2 milliseconds (Idle mode)
* Sleep for 3 seconds (Standby mode)
* Turn the system off after enabling wakeup through a button press
  (Shutdown mode)

A power monitor (e.g. `EnergyTrace <http://www.ti.com/tool/ENERGYTRACE>`_)
can be used to distinguish among these states.

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

This application uses the CC13x2/CC26x2 LaunchPad for the demo.

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

.. zephyr-app-commands::
   :zephyr-app: samples/boards/cc13x2_cc26x2/system_off
   :board: cc1352r1_launchxl
   :goals: build flash
   :compact:

After flashing the device, run the code:

1. Unplug the USB cable from the LaunchPad and reconnect it to fully
   power-cycle it.
2. Open UART terminal.
3. Hit the Reset button on the LaunchPad.
4. Device will turn off the external flash, which is on by default, to
   reduce power consumption.
5. Device will demonstrate active, idle and standby modes.
6. Device will explicitly turn itself off by going into shutdown mode.
   Press Button 1 to wake the device and restart the application as if
   it had been powered back on.

Sample Output
=================

cc1352rl_launchxl output
------------------------

.. code-block:: console

        *** Booting Zephyr OS build zephyr-v2.2.0-664-gd774727cc66e  ***

        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