doc: Use new Sphinx extension for code samples
Use the new code-sample directive and roles in a few places to demonstrate how it works. Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit is contained in:
parent
e7829752ae
commit
5832f6ed5f
9 changed files with 33 additions and 28 deletions
|
@ -169,7 +169,7 @@ the board are working properly with Zephyr:
|
||||||
- :ref:`blinky-sample`
|
- :ref:`blinky-sample`
|
||||||
- :ref:`button-sample`
|
- :ref:`button-sample`
|
||||||
- :ref:`fade-led-sample`
|
- :ref:`fade-led-sample`
|
||||||
- :ref:`blink-led-sample`
|
- :ref:`pwm-blinky-sample`
|
||||||
- :ref:`96b_carbon_multi_thread_blinky`
|
- :ref:`96b_carbon_multi_thread_blinky`
|
||||||
|
|
||||||
You can build and flash the examples to make sure Zephyr is running correctly on
|
You can build and flash the examples to make sure Zephyr is running correctly on
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
.. _blinky-sample:
|
.. zephyr:code-sample:: blinky-sample
|
||||||
|
:name: Blinky
|
||||||
|
:relevant-api: gpio_interface
|
||||||
|
|
||||||
Blinky
|
Blink an LED forever using the GPIO API.
|
||||||
######
|
|
||||||
|
|
||||||
Overview
|
Overview
|
||||||
********
|
********
|
||||||
|
@ -15,7 +16,7 @@ The source code shows how to:
|
||||||
#. Configure the GPIO pin as an output
|
#. Configure the GPIO pin as an output
|
||||||
#. Toggle the pin forever
|
#. Toggle the pin forever
|
||||||
|
|
||||||
See :ref:`pwm-blinky-sample` for a similar sample that uses the PWM API instead.
|
See :zephyr:code-sample:`pwm-blinky-sample` for a similar sample that uses the PWM API instead.
|
||||||
|
|
||||||
.. _blinky-sample-requirements:
|
.. _blinky-sample-requirements:
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
.. _blink-led-sample:
|
.. zephyr:code-sample:: pwm-blinky-sample
|
||||||
.. _pwm-blinky-sample:
|
:name: PWM Blinky
|
||||||
|
:relevant-api: pwm_interface
|
||||||
|
|
||||||
PWM Blinky
|
Blink an LED using the PWM API.
|
||||||
##########
|
|
||||||
|
|
||||||
Overview
|
Overview
|
||||||
********
|
********
|
||||||
|
|
||||||
This application blinks a LED using the :ref:`PWM API <pwm_api>`. See
|
This application blinks an LED using the :ref:`PWM API <pwm_api>`. See
|
||||||
:ref:`blinky-sample` for a GPIO-based sample.
|
:zephyr:code-sample:`blinky-sample` for a GPIO-based sample.
|
||||||
|
|
||||||
The LED starts blinking at a 1 Hz frequency. The frequency doubles every 4
|
The LED starts blinking at a 1 Hz frequency. The frequency doubles every 4
|
||||||
seconds until it reaches 128 Hz. The frequency will then be halved every 4
|
seconds until it reaches 128 Hz. The frequency will then be halved every 4
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
.. _button-sample:
|
.. zephyr:code-sample:: button-sample
|
||||||
|
:name: Button
|
||||||
|
:relevant-api: gpio_interface
|
||||||
|
|
||||||
Button
|
Handle GPIO inputs with interrupts.
|
||||||
######
|
|
||||||
|
|
||||||
Overview
|
Overview
|
||||||
********
|
********
|
||||||
|
@ -27,7 +28,7 @@ You may see additional build errors if the ``sw0`` alias exists, but is not
|
||||||
properly defined.
|
properly defined.
|
||||||
|
|
||||||
The sample additionally supports an optional ``led0`` devicetree alias. This is
|
The sample additionally supports an optional ``led0`` devicetree alias. This is
|
||||||
the same alias used by the :ref:`blinky-sample`. If this is provided, the LED
|
the same alias used by the :zephyr:code-sample:`blinky-sample`. If this is provided, the LED
|
||||||
will be turned on when the button is pressed, and turned off off when it is
|
will be turned on when the button is pressed, and turned off off when it is
|
||||||
released.
|
released.
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ Requirements and Wiring
|
||||||
***********************
|
***********************
|
||||||
|
|
||||||
This sample has the same requirements and wiring considerations as the
|
This sample has the same requirements and wiring considerations as the
|
||||||
:ref:`pwm-blinky-sample`.
|
:zephyr:code-sample:`pwm-blinky-sample`.
|
||||||
|
|
||||||
Building and Running
|
Building and Running
|
||||||
********************
|
********************
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
.. _system_hashmap:
|
.. zephyr:code-sample:: system_hashmap
|
||||||
|
:name: System Hashmap
|
||||||
|
:relevant-api: hashmap_apis
|
||||||
|
|
||||||
System Hashmap
|
Insert, replace, and remove entries in a hashmap.
|
||||||
##############
|
|
||||||
|
|
||||||
Overview
|
Overview
|
||||||
********
|
********
|
||||||
|
|
|
@ -25,8 +25,8 @@ Requirements
|
||||||
************
|
************
|
||||||
|
|
||||||
* Two boards with Bluetooth Low Energy support
|
* Two boards with Bluetooth Low Energy support
|
||||||
* Two boards with a push button connected via a GPIO pin, see :ref:`Button
|
* Two boards with a push button connected via a GPIO pin, see :zephyr:code-sample:`button-sample`
|
||||||
sample <button-sample>` for more details
|
for more details
|
||||||
|
|
||||||
Building and Running
|
Building and Running
|
||||||
********************
|
********************
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
.. _samples_kernel_condvar:
|
.. zephyr:code-sample:: kernel-condvar
|
||||||
|
:name: Condition Variables
|
||||||
|
:relevant-api: condvar_apis
|
||||||
|
|
||||||
Condition Variables
|
Manipulate condition variables in a multithreaded application.
|
||||||
###################
|
|
||||||
|
|
||||||
Overview
|
Overview
|
||||||
********
|
********
|
||||||
|
|
||||||
This sample demonstrates the usage of condition variables in a
|
This sample demonstrates the usage of :ref:`condition variables <condvar>` in a
|
||||||
multithreaded application. Condition variables are used with a mutex
|
multithreaded application. Condition variables are used with a mutex
|
||||||
to signal changing states (conditions) from one thread to another
|
to signal changing states (conditions) from one thread to another
|
||||||
thread. A thread uses a condition variable to wait for a condition to
|
thread. A thread uses a condition variable to wait for a condition to
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
.. _synchronization_sample:
|
.. zephyr:code-sample:: synchronization_sample
|
||||||
|
:name: Synchronization Sample
|
||||||
|
:relevant-api: thread_apis semaphore_apis
|
||||||
|
|
||||||
Synchronization Sample
|
Manipulate basic kernel synchronization primitives.
|
||||||
######################
|
|
||||||
|
|
||||||
Overview
|
Overview
|
||||||
********
|
********
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue