artBoffin / ROCKETuC

Library for fast prototyping of micro-controllers through serial protocols

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flags to catch events

artBoffin opened this issue · comments

Create a function that when a particular even happens, such as a threshold being crossed, a flag is set.
The flag stays set until the computer side reads and clears the flag.
This is to catch fast events that may be lost in transmission latency.

So the client will still poll for the flag?

Yes, the client will still ask the microcontroller to return the state of the flag.
But, you bring up a good point.
Should we support both interrupt and flag type events?
Processing, for example, can't really respond to an interrupt event any faster than it could poll for a flag.
As (I don't believe) it supports any sort of ISR on a received packet.

Also: perhaps we should support different types of returns for this type of function, such as:

*Flag (bool true/false - as an int 0/1)
*Last value (int)
*Sum of values since last poll (int)
*Average of values since last poll (int)
*Max value since last poll (int)
*Min value since last poll (int)
*Error (such as int overflow)