Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * File: events.c
- * Author: maxL
- *
- * Created on July 28, 2016, 12:36 PM
- */
- #include <stdio.h>
- #include <timers.h>
- #include <AD.h>
- #include "events.h"
- #include "roach.h"
- #include "CalibConstants.h"
- // Check for all events:
- event_t CheckForEvents(void) {
- event_t thisEvent = NO_EVENT;
- thisEvent = CheckForEnteredLight();
- if (thisEvent != NO_EVENT) {
- return thisEvent;
- }
- thisEvent = CheckForEnteredDark();
- if (thisEvent != NO_EVENT) {
- return thisEvent;
- }
- thisEvent = CheckForFrontBumpDown();
- if (thisEvent != NO_EVENT) {
- return thisEvent;
- }
- thisEvent = CheckForFLBumpDown();
- if (thisEvent != NO_EVENT) {
- return thisEvent;
- }
- thisEvent = CheckForFRBumpDown();
- if (thisEvent != NO_EVENT) {
- return thisEvent;
- }
- thisEvent = CheckForBackBumpDown();
- if (thisEvent != NO_EVENT) {
- return thisEvent;
- }
- thisEvent = CheckForTimer0Expired();
- if (thisEvent != NO_EVENT) {
- return thisEvent;
- }
- return NO_EVENT;
- }
- // define each event checker
- event_t CheckForEnteredLight(void) {
- // all event checkers remember their previous Event:
- static int previousEvent;
- // all event checkers update their event:
- int currentEvent = (Roac
Add Comment
Please, Sign In to add comment