32bb2395c2
Kernel timeouts have always been a 32 bit integer despite the existence of generation macros, and existing code has been inconsistent about using them. Upcoming commits are going to make the timeout arguments opaque, so fix things up to be rigorously correct. Changes include: + Adding a K_TIMEOUT_EQ() macro for code that needs to compare timeout values for equality (e.g. with K_FOREVER or K_NO_WAIT). + Adding a k_msleep() synonym for k_sleep() which can continue to take integral arguments as k_sleep() moves away to timeout arguments. + Pervasively using the K_MSEC(), K_SECONDS(), et. al. macros to generate timeout arguments. + Removing the usage of K_NO_WAIT as the final argument to K_THREAD_DEFINE(). This is just a count of milliseconds and we need to use a zero. This patch include no logic changes and should not affect generated code at all. Signed-off-by: Andy Ross <andrew.j.ross@intel.com> |
||
---|---|---|
.. | ||
src | ||
CMakeLists.txt | ||
README.rst | ||
prj.conf | ||
sample.yaml |
README.rst
.. _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: