zephyr/samples/basic/threads
Piotr Mienkowski c0cf714087 samples: threads: update to use new GPIO API
Update sample application to use new GPIO API:
- GPIO flags defined by the devicetree
- replace gpio_pin_write with gpio_pin_set function

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2020-02-05 12:00:36 +01:00
..
src samples: threads: update to use new GPIO API 2020-02-05 12:00:36 +01:00
CMakeLists.txt license: cleanup: add SPDX Apache-2.0 license identifier 2019-04-07 08:45:22 -04:00
prj.conf samples: threads: Fix ASSERTION FAIL without gpio driver 2019-03-03 23:48:11 -05:00
README.rst samples: threads: Rewrite misleading sample 2018-01-08 14:25:11 -05:00
sample.yaml tests: fix test identifiers 2019-12-09 15:53:44 -05:00

.. _96b_carbon_multi_thread_blinky:

Basic Thread Example
####################

Overview
********

This example demonstrates spawning of multiple threads using K_THREAD_DEFINE.

The example works by spawning three threads. The first two threads control a
separate LED. Both of these LEDs (USR1 and USR2) have their individual loop
control and timing logic defined by separate functions.

After either thread toggles its LED, it also pushes information into a
FIFO identifying which thread toggled its LED and how many times it
was done.

The third thread, ``uart_out()``, uses printk (over the UART) to
display the information that comes through the FIFO.

- blink1() controls the USR1 LED that has a 100ms sleep cycle
- blink2() controls the USR2 LED that has a 1000ms sleep cycle

Each thread is then defined at compile time using K_THREAD_DEFINE.

Building
********

.. zephyr-app-commands::
   :zephyr-app: samples/basic/threads
   :board: 96b_carbon
   :goals: build flash
   :compact: