Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 896 Bytes

a_simple_example.rst

File metadata and controls

25 lines (19 loc) · 896 Bytes
.. sectionauthor::
   Copyright (c) 2020, Remi Andruccioli <[email protected]>

A simple example

Instead of the traditional "Hello world", we show here a simple clock application.

This application demonstrates a simple clock that prints the time every second on the serial port.

.. literalinclude:: ../example-programs/clock24.c
    :language: c

In this code sample, the main function is executed at system startup. In this function we configure the serial port to enable serial transmission and configure the speed of the transmission. Then we configure a single task to run. The entry point for this task is the function ClockTask. We configure this task to be real-time cyclic, with a period of 50 time units (time slices), and a completion time of 25 time units (time slices).