modm API documentation
modm::atomic::Flag Class Reference

Flag to signal events between interrupts and the main-loop. More...

#include <modm/architecture/driver/atomic/flag.hpp>

Public Member Functions

 Flag (bool state=false)
 
 Flag (const Flag &other)
 
Flag & operator= (const Flag &other)
 
bool test () const
 Check state of the flag.
 
void set ()
 Set flag.
 
void reset ()
 Clear flag.
 
bool testAndSet (bool value)
 Sets the flag to a new value and returns the old one.
 

Detailed Description

Flag to signal events between interrupts and the main-loop.

This class is quite handy when exchanging flags between a interrupt routine and the main-loop.

ISR() {
...
isrFlag.set();
}
function() {
bool flag = isrFlag.testAndSet(false);
...
}
Author
Fabian Greif

The documentation for this class was generated from the following files: