FreeRTOS advanced programming for NXP Rapid-IoT

Document created by Theophile Leroy Employee on Nov 2, 2018Last modified by Theophile Leroy Employee on Nov 2, 2018
Version 2Show Document
  • View in full screen mode

Dear NXP Rapid-IoT users,


Here is another example demonstrating FreeRTOS capabilities for NXP Rapid-IoT and how to display menus using the ui manager module.


(please find the attached code below)


Note: This is an advanced example and requires C code programming skills as well as some background in real-time system programming.

For more information about FreeRTOS see the API reference guide.


This example demonstrates how to use basic multi-task features in order to handle a multi-screen environment application.

In this example you will find three screens:


Welcome Screen

(T3 / Top Touch)

Temperature screen

(T2 / Right Touch)

Humidity screen

(T4 / Left Touch)


Four tasks are created :


  • UiManager task: Handle touch buttons event and screen transitions
  • Main screen task: Display the main screen
  • Temperature screen task: Display the temperature measurements from ENS210 sensor
  • Humidity screen task: Display the humidity measurements from ENS210 sensor


  • + mutex-semaphore is implemented to handle shared resources between tasks (Display & sensors)


Screens are described in an object-oriented manner to easily manage them in the task's code:


.navigation describe how the menu transition will behave

.title & .image will be used to display correct information

.start/stopTaskFunction will be used to create/pause the according measurement&display task.

static guiScreen_t
    gui_example1b_mainScreen =
        .navigation =
            .up     = NULL,
            .down   = NULL,
            .left   = &gui_example1b_humScreen,
            .right  = &gui_example1b_tempScreen
        .title = "Welcome !",
        .image = nxp_logo,

        .startTaskFunction  = &gui_example1b_mainScreen_StartTask,
        .stopTaskFunction = &gui_example1b_mainScreen_StopTask

Source code is located under "/source" folder

- example_1b.c/h

- main.c (main_task entry point l.272)


Ui manager code is located under "/ui_manager" folder

- ui_manager.c/h



To import project into MCUXpresso :

   - Import project(s) from file system...

   - Choose archive, then select the downloaded archive



Please, feel free to take a deep look into the code, tinker and develop your own application.


Don't hesitate to share with us any questions/remarks you may have.