Tuesday, April 08, 2008

Getting in a State

The last thing I was looking at before I took my “creative break” was the high level design how the LogStick would operate. The most logical way to represent this for me would seem to be a state machine with the following states:

uploading, logging, dormant, full, configuring

With a quick bit of hacking I put together a state machine function whose main core looks like:

switch (status) {

case uploading:
TRANSITION( dormant )
break;

case logging:
TRANSITION( dormant )
break;

case dormant:
TRANSITION( logging )
break;

case full:
TRANSITION( full )
break;

case configuring:
TRANSITION( dormant )
break;

default:
printf ("Event not caught Error\n");
break;

}

0 Comments:

Post a Comment

<< Home