2022-04-19 19:23:30 -04:00
|
|
|
// initial pseudostate of the Blinky HSM ......................................
|
|
|
|
Q_STATE_DEF(Blinky, initial) {
|
|
|
|
static_cast<void>(e); // unused parameter
|
|
|
|
|
|
|
|
// arm the time event to expire in half a second and every half second
|
|
|
|
m_timeEvt.armX(BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U);
|
|
|
|
|
|
|
|
return tran(&off);
|
2012-08-14 18:00:48 -04:00
|
|
|
}
|
|
|
|
|
2022-04-19 19:23:30 -04:00
|
|
|
// state handler for the Blinky HSM ..................................
|
|
|
|
Q_STATE_DEF(Blinky, off) {
|
|
|
|
QState status;
|
2012-08-14 18:00:48 -04:00
|
|
|
switch (e->sig) {
|
2022-04-19 19:23:30 -04:00
|
|
|
case Q_ENTRY_SIG: {
|
|
|
|
BSP_ledOff();
|
|
|
|
status = Q_RET_HANDLED;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TIMEOUT_SIG: {
|
|
|
|
status = tran(&on);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
status = super(&top);
|
|
|
|
break;
|
2012-08-14 18:00:48 -04:00
|
|
|
}
|
|
|
|
}
|
2022-04-19 19:23:30 -04:00
|
|
|
return status;
|
2012-08-14 18:00:48 -04:00
|
|
|
}
|