zephyr/samples/subsys/zbus/runtime_obs_registration
Daniel Leung 9776cb1a39 samples: zbus: runtime_obs_registration: fix running on QEMU
() This makes the stack for both consumer and producer threads
   larger to avoid stack corruption and overflow.

() Limit to 1 CPU to preserve ordering of output for twister.

() Remove the platform_exclude as they are passing now.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-02-20 10:53:25 +01:00
..
src samples: zbus: runtime_obs_registration: fix running on QEMU 2023-02-20 10:53:25 +01:00
CMakeLists.txt
prj.conf samples: zbus: runtime_obs_registration: fix running on QEMU 2023-02-20 10:53:25 +01:00
README.rst
sample.yaml samples: zbus: runtime_obs_registration: fix running on QEMU 2023-02-20 10:53:25 +01:00

.. _zbus-runtime-obs-registration-sample:

Runtime observer registration sample
####################################

Overview
********
The sample illustrates a way of using the runtime observer registration feature. The developer can understand how to use static and runtime observer registration with this sample.

In this sample, we have the threads producer and consumer. In the middle of the communication, we have the filter responsible for filtering the data generated by the producer. In a loop, the code activates the filter. After 5 seconds, the filter is disabled, and the filter bypass is enabled. At last, 5 seconds later, the filter bypass is disabled, and the loop repeats everything.

Building and Running
********************

This project outputs to the console.  It can be built and executed
on QEMU as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/subsys/zbus/runtime_obs_registration
   :host-os: unix
   :board: qemu_x86
   :goals: run

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

.. code-block:: console

    I: System started
    I: Activating filter
    I:  >-- Raw data fetched
    I:  -|- Filtering data
    I:  --> Consuming data: Acc x=0, y=0, z=0
    I:  >-- Raw data fetched
    I:  -|- Filtering data
    I:  --> Consuming data: Acc x=2, y=2, z=2
    I:  >-- Raw data fetched
    I:  -|- Filtering data
    I:  --> Consuming data: Acc x=0, y=0, z=0
    I:  >-- Raw data fetched
    I:  -|- Filtering data
    I:  --> Consuming data: Acc x=4, y=4, z=4
    I:  >-- Raw data fetched
    I:  -|- Filtering data
    I:  --> Consuming data: Acc x=0, y=0, z=0
    I: Deactivating filter
    I: Bypass filter
    I:  >-- Raw data fetched
    I:  --> Consuming data: Acc x=6, y=6, z=6
    I:  >-- Raw data fetched
    I:  --> Consuming data: Acc x=7, y=7, z=7
    I:  >-- Raw data fetched
    I:  --> Consuming data: Acc x=8, y=8, z=8
    I:  >-- Raw data fetched
    I:  --> Consuming data: Acc x=9, y=9, z=9
    I:  >-- Raw data fetched
    I:  --> Consuming data: Acc x=10, y=10, z=10
    I: Disable bypass filter
    I:  >-- Raw data fetched
    I:  >-- Raw data fetched
    I:  >-- Raw data fetched
    I:  >-- Raw data fetched
    I:  >-- Raw data fetched

    <continues>

Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.