added stack-based state machine
generate path through states based on signal
Merge pull request #1 from fmjdaniels/master

Device