Archived
Template
1
0
This repository has been archived on 2024-01-25. You can view files and clone it, but cannot push or open issues or pull requests.
XFT/src/template.c

52 lines
1.1 KiB
C
Raw Normal View History

2023-07-11 12:27:35 +02:00
/**
* @author Rémi Heredero
* @version 1.0.0
* @date July 2023
* @file ${FILENAME}.c
*/
#include "${FILENAME}.h"
void ${FILENAME}_init(${FILENAME}* me){
me->state = ST${FN}_INIT;
}
void ${FILENAME}_startBehaviour(${FILENAME}* me){
POST(me, &${FILENAME}_processEvent, ev${FN}init, 0, 0);
}
bool ${FILENAME}_processEvent(Event* ev) {
bool processed = false;
${FILENAME}* me = (${FILENAME}*)Event_getTarget(ev);
switch (me->state) { // onState
case ST${FN}_INIT:
2023-07-11 15:03:17 +02:00
if (ev->id == ev${FN}init) {}
2023-07-11 12:27:35 +02:00
break;
{STATES}
}
if(oldState != me->state){
switch (oldState) { // onExit
case ST${FN}_INIT:
break;
{STATES}
}
switch (me->state) { // onEntry
case ST${FN}_INIT:
break;
{STATES}
}
processed = true;
}
return processed;
}
void ${FILENAME}_set{VAR}(${FILENAME}*me, uint16_t t) {
me->tON = t;
}
2023-07-11 15:03:17 +02:00
void ${FILENAME}_emit${EVENT}(${FILENAME}*me, uint16_t t) {
POST(me, &${FILENAME}_processEvent, ev${FN}${EVENT}, t, 0);
2023-07-11 12:27:35 +02:00
}