Document tasks.

This commit is contained in:
Brad Nelson
2021-05-21 16:43:15 -07:00
parent 1c65488374
commit 33cf8aaa6f

View File

@ -170,8 +170,9 @@ adc ( pin# -- n ) Analog read pin, result 0-1023
<h5>System</h5>
<pre>
MS ( n -- )
TERMINATE ( n -- ) Call system exit
MS ( n -- ) Pause for some number of milliseconds.
MS-TICKS ( -- n ) Time since start in milliseconds.
TERMINATE ( n -- ) Call system exit.
</pre>
<h5>Files</h5>
@ -356,8 +357,28 @@ esp_intr_free ( handle -- 0/err )
timer_isr_register ( group timer xt arg ret -- 0/err )
</pre>
<h5 id="tasks">Tasks</h5>
These words are inside the <code>TASKS</code> vocabulary.
<pre>
PAUSE ( -- ) Yield to other tasks.
MS ( n -- ) Pause for some number of milliseconds (yields to other tasks).
TASK ( xt dsz rsz "name" -- ) Create a new task with dsz size data stack
and rsz size return stack running xt.
START-TASK ( task -- ) Activate a task.
.TASKS ( -- ) List running tasks.
Example:
tasks
: hi begin ." Time is: " ms-ticks . cr 1000 ms again ;
' hi 100 100 task my-counter
my-counter start-task
</pre>
<h5 id="timers">Timers</h5>
These words are inside the <code>TIMERS</code> vocabulary.
<br/><b>NOTE: These are low level ESP32 timers. For a periodic background
operation, you'll probably want to use <a href="#tasks">TASKS</a>.</b>
<p>High Level words:</p>
<pre>