12-06-2020 12:57 PM
Producer Consumer uses queues to pass the commands from one loop to another.
12-07-2020 08:59 AM
@Haddock01 wrote:
I looked at the examples. Nothing that surprise me. Thanx.
I forgot that the computer are Master and the periperials are slaves. The slaves never initate a comm with the application! It makes my life easier. That means that I need two loops. The first main-loop contains a statemachine that takes care of the overall process. The other loop contains a event which initiates a communication with a specific unit. This "comm-loop" gets commands from the main-loop.
Is this model a way to deal with this? (perhaps I should start a new thread about this ..)
If you want to "constantly" talk with your device irregardless of the state machine logic, then this is a great route to go. If not, then you won't be gaining much going to a second loop as it will become a synchronous communication scheme anyways (therefore might as well have the SPI communications in the state machine).
12-07-2020 09:44 AM
I will certainly take this into consideration. Thanx!
Why I thought about a specific loop for COMM was because I have two targets. I imagined a queue of commands and addresses that fed the comm-loop. (we are now speaking about I2C instead of SPI).