#include #include "state.h" uint8_t switchNewEmulState(const uint8_t currentState, const uint8_t controlOp) { switch (currentState) { case EMUL_STATE_STILL: { if(controlOp == EMUL_STATE_OP_START) { return EMUL_STATE_EXEC; } break; } case EMUL_STATE_EXEC: { if(controlOp == EMUL_STATE_OP_PAUSE) { return EMUL_STATE_PAUSE; } else if(controlOp == EMUL_STATE_OP_STOP) { return EMUL_STATE_STOP; } break; } case EMUL_STATE_PAUSE: { if(controlOp == EMUL_STATE_OP_RESUME) { return EMUL_STATE_EXEC; } else if (controlOp == EMUL_STATE_OP_RESET) { return EMUL_STATE_STILL; } break; } case EMUL_STATE_STOP: { if(controlOp == EMUL_STATE_OP_RESET) { return EMUL_STATE_STILL; } break; } default: break; } return currentState; }