zephyr/samples/modules/nanopb
Benjamin Cabé f6c232ec2e samples: modules: use zephyr:code-sample directive
Describe the samples using code-sample directive in preparation for
upcoming changes to the Zephyr documentation that will be leveraging
the provided description and metadata.

Also fixed a couple invalid or missing table of contents to have
proper document hierarchy.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-09-02 11:51:37 +02:00
..
src samples: modules: nanopb: display buffer content of correct size 2024-08-30 11:58:50 -04:00
CMakeLists.txt samples: modules: nanopb: Demonstrate skipping fields with Kconfig 2024-03-01 10:21:34 +00:00
Kconfig samples: modules: nanopb: Demonstrate skipping fields with Kconfig 2024-03-01 10:21:34 +00:00
README.rst samples: modules: use zephyr:code-sample directive 2024-09-02 11:51:37 +02:00
prj.conf
sample.yaml samples misc: Use hwmv2 native targets identifiers 2024-03-15 16:13:12 +01:00

README.rst

.. zephyr:code-sample:: nanopb
   :name: Nanopb

   Serialize and deserialize structured data using the nanopb module.

Overview
********

A simple protocol buffer sample using :ref:`nanopb_reference` for serializing structured data
to platform independent raw buffers or streams.

The structured data to encode/decode is presented as follows:

.. code-block:: proto

   syntax = "proto3";

   message SimpleMessage {
       int32 lucky_number = 1;
       bytes buffer = 2;
       int32 unlucky_number = 3;
   }

Configuration
*************

This sample uses two configuration options to modify the behavior.

* :kconfig:option:`CONFIG_SAMPLE_BUFFER_SIZE` sets the ``buffer`` field's size
* :kconfig:option:`CONFIG_SAMPLE_UNLUCKY_NUMBER` either enables or disables the ``unlucky_number``
  field.

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

This application can be built as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/modules/nanopb
   :host-os: unix
   :board: qemu_x86
   :goals: run
   :compact: