Hi,
I'm trying to implement a state machine but I am having issues with the task.
I simply have two states: SLEEP and RX and I want to do
1) stay in SLEEP for T1 sec
2) after T1 sec go to RX
3) stay in RX for T2 sec (if something is received, aka interrupt on a pin, process data)
All these things work independently in my code. But I don't know how to properly activate the task
int const SLEEP = 1;
int const RX = 2;
extern void stateMachineTask(TTASKTABLE *ptrTaskTable){
switch (iState) {
case 0 :
steupIinterruptHandler();
iState = 1;
uTaskerMonoTimer('C', (DELAY_LIMIT) (0.5 * SEC), UTASKER_ACTIVATE);
break;
case SLEEP :
deactivate_data_processing();
// do sleep operations here
iState = RX;
uTaskerMonoTimer('C', (DELAY_LIMIT) (T1 * SEC), UTASKER_ACTIVATE);
break;
case RX :
activate_data_processing();
//if received interrupt, process data
iState = SLEEP;
uTaskerMonoTimer('C', (DELAY_LIMIT) (T2 * SEC), UTASKER_ACTIVATE);
break;
}
}
My major problem is that the interrupt is not triggered (it normally works). If I can suspend/resume the whole task that's fine too, but I don't know how to do it