mirror of
https://github.com/QuantumLeaps/qpc.git
synced 2025-01-14 06:43:19 +08:00
20 lines
627 B
C
20 lines
627 B
C
QState Table_initial(Table * const me, QEvt const *) {
|
|
uint8_t n;
|
|
|
|
QS_SIG_DICTIONARY(HUNGRY_SIG, me); /* output signal dictionary QS record */
|
|
QS_SIG_DICTIONARY(DONE_SIG, me); /* output signal dictionary QS record */
|
|
QS_SIG_DICTIONARY(EAT_SIG, 0); /* output signal dictionary QS record */
|
|
|
|
QS_FUN_DICTIONARY(&Table_serving);
|
|
|
|
QActive_subscribe(&me->super, HUNGRY_SIG);
|
|
QActive_subscribe(&me->super, DONE_SIG);
|
|
QActive_subscribe(&me->super, TERMINATE_SIG);
|
|
|
|
for (n = 0U; n < N; ++n) {
|
|
me->fork[n] = FREE;
|
|
me->isHungry[n] = 0U;
|
|
}
|
|
return Q_TRAN(&Table_serving);
|
|
}
|