In an IOT project with the frdm-kw41z I need to implement several sensors. These sensors make use of I2C or UART or an analogue input.
As this device is an end device I have chosen to use Thread as the network mesh.
As this is an end device it’s obvious to make use of an RTOS. While one sensor is waiting on data from its serial interface another sensor can start its task.
As it is not possible to select a separate middleware Thread driver. I started the project from an example: “frdmkw41z_wireless_examples_thread_low_power_end_device_freertos”.
In the example the “APP_Handler” calls in a loop the “NWKU_MsgHandler”. So far the principle is clear. But when I want to implement my own “taskMsgQueu_t” types I get lost in the complexity of this example. Especially because this code is barely documented.
What is the best way to implement my own RTOS task events and a static events table and what parameters?
Am I supposed to add my events in the “aStaticEventsTable” in the file “event_manager_globals.c”?
How do I best set the priority of my tasks without interfering with, for ex. the TMR_Task, Mac_Task, THR_Task…?
What task is managing the time-period the end device to go in sleep mode or to start measuring?
As the SDK provides a serial manager I opt to use that one to implement UART and I2C communication. Though the serial manager lacks the parameter READ or WRITE for I2C communication.