Moved enums and defines; Event enum added

Moved most enums and defines into the common.h header. An event enum
along with an event buffer struct were also added to the common header.
Event driven states (or nested states)

A triple buffer, or queue, of events now facilitates the message passing
between states and interrupt vectors.

In order to avoid the problem of interleaving important execution, a
binary sequence pattern is used for operations entering the queue from
within an interrupt vector. However, the interrupt vector must handle the
possibility that the main code did not get the last sequence before it
move to the next. However, in most cases, it can be ignored.

Sequence operation: A global variable seq_num indicates the current
sequence number for the main code. The main code uses this value to
determine which event seq* to enqueue new events from. For instance, if
the seq_num is 1, then seq1 event is enqueued into the event buffer, and
then seq1 is set to the empty event. If an interrupt occurs that needs
to parse messages into the queue (currently only the hardware tilt INT),
then the seq0 (opposite sequence number set) is assigned to the event and
the sequence is toggled to indicate that sequence number (changed to
zero).

This method is a good start, but does not currently have a way to handle
interrupted interrupts, or multiple interrupts attempting to enqueue
messages. This may require multiple sequence pairs with buffers; one pair
for each interrupt vector.
Queue modifiers use reference argument for queue

Preparing for the use of multiple queues, the enqueue and get_next
methods accept a pointer to the queue to work on, this allows the easy
use of multiple queues.
\#pragma code; sequence and event buffer merged

The event buffer struct now contains the sequence events and a pointer
to an event. The pointer points to the current event that the should be
used by the main code. This results in a nice wrapper for these
variables.

Also, the execution still locked up more than once for me. After locking
up with the debugger attached, it appears to be doing the same thing it
was before; jumping seemingly randomly between a few instructions. I
searched around and found that I should have a #pragma code after
defining my interrupt vectors. I haven't been able to lock up the
execution since, but I have tested it that thoroughly.
common.h changes missed in last commit

I don't know why I keep missing modified files on this particular
project...
Removed Seq from queue; INT reads tilt

Sequence numbers no longer used, because of course they didn't
work. Instead, the INT for the accelerometer reads the tilt and adjust
parameters directly. Also, the debounce for the tap detection was
increased.
Added startup sequence an LED events
LEDS are Binary counter; INT disable

After startup sequence, badge will enter binary counter mode in which
the LEDs are base 2, 8 bits.

Global interrupts are disabled during startup sequence, renable and
check for tilt on start.
Added half of a very crappy cylon sequence

If you tap to ten, the badge enters a very poor cylon sequence, or at
least 50% of one.
Pullup on port B disabled
Adjusted startup and cylon sequences

Startup now ramps-up, making it more interesting and quicker.

The cylon sequence is a more robust, though it is more like the knight
rider leds with the leading LED being the brightest. The cylon scanner
has a symmetric pattern with the middle LED being the brightest.
Added macros for atomic operations

ATOMIC_BEGIN and ATOMIC_END can be used to wrap bodies of code that
should not be interrupted. ATOMIC_BEGIN simply disables interrupts
globally, while ATOMIC_END re-enables them and then checks the hardware
interrupt for the accelerometer. If the flag is set, it will call
check_tilt to read the tilt register.
LED sequences are now recursive-like

The two LED sequences have been changed to fit better with the eventual
USB framework. These functions use static members to keep a persistent
state and repeatedly enqueue their own events until the sequence is
finished. This should allow the sequences to be used within the USB
framework and the process() call.
Refactoring and commenting

Cleaned up commented code and removed some variables in cylon sequence
that were not needed.
Synchronous method for int-to-main-loop events

Using two counters, one for the interrupt routine and another for the
main loop, this commit seems to be able to safely transfer events out of
an interrupt vector. This is specifically for the accelerometer's tilt
register, which *must* be read once an interrupt happens.

The counters begin equal, when an interrupt occurs, the interrupt handler
increments its counter. The main loop will compare it's counter with the
interrupt counter on every Get_Next(): if the counters are not equal,
then the main loop will enqueue a tilt event and increment its own
counter.

Additional variables can be used to delay/disable the enqueueing of the
tilt event until the main loop is ready to handle it (EX: main loop
handling a long running execution). Also, the 8-bits of a char is not
really needed, this method could work with a single bit and XOR. If we
end up with several control bits, we could encode them all in a single
char.
Beginning the gamification

Separated the main loop into stages. A function call for each stage.
There may be a better way to do this, with function pointers possibly,
but this implementation seems to work for testing.

Stages (After welcome/opening sequence):
1. Mimicry: Tap along to the flashing LED
2. Fib: Tap the Fib sequence

Both are unfinished, but the transfer between stages is there.
Commenting old code out