Archived
Template
1
0

add time for event

This commit is contained in:
Rémi Heredero 2023-07-11 15:03:17 +02:00
parent b0e3d721e0
commit dc6a7f8799
2 changed files with 5 additions and 6 deletions

View File

@ -20,9 +20,7 @@ bool ${FILENAME}_processEvent(Event* ev) {
${FILENAME}* me = (${FILENAME}*)Event_getTarget(ev); ${FILENAME}* me = (${FILENAME}*)Event_getTarget(ev);
switch (me->state) { // onState switch (me->state) { // onState
case ST${FN}_INIT: case ST${FN}_INIT:
if (ev->id == ev${FN}init) { if (ev->id == ev${FN}init) {}
me->state = ST${FN}_{WAIT_STATE};
}
break; break;
{STATES} {STATES}
} }
@ -49,6 +47,6 @@ void ${FILENAME}_set{VAR}(${FILENAME}*me, uint16_t t) {
me->tON = t; me->tON = t;
} }
void ${FILENAME}_emit${EVENT}(${FILENAME}*me) { void ${FILENAME}_emit${EVENT}(${FILENAME}*me, uint16_t t) {
POST(me, &${FILENAME}_processEvent, ev${FN}${EVENT}, 0, 0); POST(me, &${FILENAME}_processEvent, ev${FN}${EVENT}, t, 0);
} }

View File

@ -47,8 +47,9 @@ void ${FILENAME}_set{TIMEON}(${FILENAME}*me, uint16_t t);
/** /**
* Emit the ${EVENT} event * Emit the ${EVENT} event
* @param me the ${FILENAME} itself * @param me the ${FILENAME} itself
* @param t Time to wait before trig the event
*/ */
void ${FILENAME}_emit${EVENT}(${FILENAME}*me); void ${FILENAME}_emit${EVENT}(${FILENAME}*me, uint16_t t);
#endif #endif