/* events.h * * This header file describes the sates and events the robot will encounter. Note * the list has been kept relatively short, partly as the result of our efforts to * reduce software complexity but primarily due to the simplification of our * mechanical design. */ #ifndef EVENTS_H #define EVENTS_H /* ----------------------------- States ------------------------------ */ typedef enum { kStateFindingCenter = 0, kStateReversing, kStatePoweringUp, kStateShootBalls }StateType; /* ----------------------------- Events ----------------------------- */ typedef enum { kEventCenterAdjustment = 0, kEventTimerExpired, kEventActiveBeaconChanged } EventType; // From the event handler we occassionally need to pass two pieces of information, // rather than just the event (as is the case with the shared byte model). Here, // we pack the event and an optional event parameter into a word and use the appropriate // accessors to retrieve the relevant portions. #define SET_EVENT(word, event) ((word) = ((word) | (((event) & 0xFF) << 8))) #define SET_PARAM(word, param) ((word) = ((word) | ((param) & 0xFF))) #define GET_EVENT(word) (((word) >> 8) & 0xFF) #define GET_PARAM(word) ((word) & 0xFF); #endif // EVENTS_H