qpcpp/doxygen/snippets/qep_qhsm_use.cpp

19 lines
436 B
C++
Raw Normal View History

2020-10-01 12:50:17 -04:00
#include "qep.hpp" // QEP public interface
2015-12-31 14:56:37 -05:00
#include "calc.h" // Calc HSM derived from QHsm
2012-08-14 18:00:48 -04:00
2015-12-31 14:56:37 -05:00
static Calc l_calc; // an instance of Calc HSM
2012-08-14 18:00:48 -04:00
int main() {
2020-10-01 12:50:17 -04:00
l_calc.init(0U); // trigger initial transition
2012-08-14 18:00:48 -04:00
2015-12-31 14:56:37 -05:00
for (;;) { // event loop
2013-10-10 20:01:51 -04:00
QEvt e;
2012-08-14 18:00:48 -04:00
. . .
// wait for the next event and assign it to the event object e
. . .
2020-10-01 12:50:17 -04:00
l_calc.dispatch(&e, 0U); // dispatch the event
2012-08-14 18:00:48 -04:00
}
return 0;
}