Files
hmmmm/src/state.c
2026-02-11 12:18:59 +03:00

58 lines
1.2 KiB
C

#include <stdint.h>
#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;
}