Reiko Randoja / HumanInterface
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers HumanInterface.h Source File

HumanInterface.h

00001 #ifndef HUMANINTERFACE_H
00002 #define HUMANINTERFACE_H
00003 
00004 #include "mbed.h"
00005 #include "PCA9555.h"
00006 #include "externalin.h"
00007 #include "ledout.h"
00008 #include "Serial.h"
00009 #include "PinDetect.h"
00010 
00011 class HumanInterface {
00012 public:
00013     HumanInterface(
00014         PCA9555 *ioExt,
00015         unsigned int yellowLedPin, unsigned int blueLedPin, unsigned int redLedPin,
00016         unsigned int greenLedPin, unsigned int orangeLedPin,
00017         PinName goalButtonPin, PinName startButtonPin, PinName ballSensePin
00018     ); 
00019     
00020     enum Goal {YELLOW, BLUE, UNSET};
00021     void setGoal(Goal goal);
00022     void setError(bool state);
00023     void setGo(bool state);    
00024     
00025     bool isGoalChange();
00026     bool isStart();
00027     int getBallState();
00028     
00029 private:
00030     Serial *pc;
00031     
00032     PCA9555 *extIO;
00033     
00034     LedOut redLed;
00035     LedOut blueLed;
00036     LedOut yellowLed;
00037     LedOut greenLed;
00038     LedOut orangeLed;
00039     
00040     PinDetect buttonGoal;
00041     PinDetect buttonStart;
00042     PinDetect inputBall;
00043     
00044        
00045     //Functions that PinDetect will call
00046     void goalFall();
00047     void startRise();
00048     void ballFall();
00049     void ballRise();
00050     
00051     bool goalButtonPressed;
00052     bool startButtonReleased;
00053     int ballState;
00054    
00055     bool redBlinking;
00056     bool blueBlinking;
00057     bool yellowBlinking;
00058     bool greenBlinking;
00059     bool orangeBlinking;
00060 
00061     Ticker ledTicker;
00062     
00063     void blinkLeds(void);
00064 };
00065 
00066 #endif