From dc6a7f8799a187b3dba58ac8b37338975a675dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Tue, 11 Jul 2023 15:03:17 +0200 Subject: [PATCH] add time for event --- src/template.c | 8 +++----- src/template.h | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/template.c b/src/template.c index abb8840..67f396e 100644 --- a/src/template.c +++ b/src/template.c @@ -20,9 +20,7 @@ bool ${FILENAME}_processEvent(Event* ev) { ${FILENAME}* me = (${FILENAME}*)Event_getTarget(ev); switch (me->state) { // onState case ST${FN}_INIT: - if (ev->id == ev${FN}init) { - me->state = ST${FN}_{WAIT_STATE}; - } + if (ev->id == ev${FN}init) {} break; {STATES} } @@ -49,6 +47,6 @@ void ${FILENAME}_set{VAR}(${FILENAME}*me, uint16_t t) { me->tON = t; } -void ${FILENAME}_emit${EVENT}(${FILENAME}*me) { - POST(me, &${FILENAME}_processEvent, ev${FN}${EVENT}, 0, 0); +void ${FILENAME}_emit${EVENT}(${FILENAME}*me, uint16_t t) { + POST(me, &${FILENAME}_processEvent, ev${FN}${EVENT}, t, 0); } \ No newline at end of file diff --git a/src/template.h b/src/template.h index f6bda9d..46c652f 100644 --- a/src/template.h +++ b/src/template.h @@ -47,8 +47,9 @@ void ${FILENAME}_set{TIMEON}(${FILENAME}*me, uint16_t t); /** * Emit the ${EVENT} event * @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