bool32.risingfalling gate
bool32.pulse < short (if gate == 0)
bool32.pulse > short and < long
bool32.pulse > long and < cancel
int32 current stage
spinner short hold start,k-ticks
spinner long hold start and short hold end,k-ticks
spinner cancel and long hold end,k-ticks
int tc;
outlet_no = 0;
outlet_short = 0;
outlet_long = 0;
if (inlet_gate) {
tc++;
if (tc < attr_short)
outlet_stage = 0;
if ((tc >= attr_short) && (tc < attr_long))
outlet_stage = 1;
if ((tc >= attr_long) && (tc < attr_cancel))
outlet_stage = 2;
}
if (!inlet_gate) {
if ((tc > 0) && (tc < attr_short))
outlet_no = 1;
if ((tc >= attr_short) && (tc < attr_long))
outlet_short = 1;
if ((tc >= attr_long) && (tc < attr_cancel))
outlet_long = 1;
tc = 0;
outlet_stage = 0;
}