qpcpp/doxygen/snippets/qep_qhsm_use.cpp
MMS 34cdcc7929 7.0.0rc1
major release 7.0.0 release candidate 1
2022-04-19 19:23:30 -04:00

19 lines
454 B
C++

#include "qep.hpp" // QEP public interface
#include "calc.h" // Calc HSM derived from QHsm
Calc Calc::inst; // a single instance of Calc HSM
int main() {
Calc::inst.init(0U); // trigger initial transition
for (;;) { // event loop
QP::QEvt e;
. . .
// wait for the next event and assign it to the event object e
. . .
Calc::inst.dispatch(&e, 0U); // dispatch the event
}
return 0;
}