FIGnition FUZE Hardware Reference Manual page 12

Table of Contents

Advertisement

The challenge here is in allowing the computer to keep running in the background - this
means the keypad code doesn't run continually as soon as you press a key, but performs
a small amount of processing on every frame. We manage this all in firmware, by imple-
menting the keypad conversion process as a state machine.
A keypad state machine is actually (in FIGnition's case) just a byte variable (the state)
that's used to select which piece of code is executed on every scan (the machine). A state
machine is always one of several straight-line pieces of code that gets executed depend-
ing on the current state: it reads some inputs; sets a new state and perhaps performs a
minor action. State machines are useful for providing the appearance of a thread or task
with a far smaller overhead than for a normal operating system.
So, FIGnition's state machine (in the 'C' function
Key released,
generate single
Key character
No change and help
count-down>0: de-
crease help count-
down by 1.
No change and repeat
count-down>0: de-
crease repeat count-
down by 1.
( Ovals represent the state; arrows show movement from one
state to another; text shows the condition required to move to
KeyState
Released
First key pressed,
Help countdown
set to 16
KeyState
Single
Second Key pressed.
Generate Key pair
character. Set Repeat
countdown to 10.
KeyState
Double
No change and repeat
count-down=0: Generate
repeat character.
Fig 2.7
a different state, with the action in bold)
IntKey
) works like this:
All keys
released
(Help)
No change and help
count-down=0: acti-
vate help.
KeyState
SingleAfterDouble
One Key Re-
leased: Help
No change and help
countdown
count-down>0: de-
set to 16.
crease help count-
down by 1.

Advertisement

Table of Contents
loading

Table of Contents