Search code examples
cframeworksstate-machinemplabpic32

How to exchange data between two apps (state machines) in MPLAB Harmony framework?


I'm implementing multiple state machines that run in parallel using the MPLAB Harmony framework, but some of my state machines need to get a message when the another applications state machine enters a specific state. I could not find any information considering any "correct" or framework provided way of doing this kind of simple data exchange between state machines in the framework.

So basically, how do I exchange information about the event of state machine moving to a specific state (boolean type information, two possible values either in specific state or not in specific state) to another applications state machine whose operation depends on the the state of the other state machine. Is there a framework provided way of achieving this kind of simple information exchange? I'm writing my applications in C for the 32 bit Microchip microcontrollers.


Solution

  • Look into using the FreeRTOS provided by Harmony. They have a data set called queues that would be perfect for what you are describing. I use them in my ISRs to queue data that a task periodically acts upon once the buffer is complete.