Reiko Randoja / HumanInterfaceT14

Dependents:   Telliskivi2_2014

Fork of HumanInterface by Reiko Randoja

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 "Serial.h"
00008 #include "PinDetect.h"
00009 #include "rgb-led-pca9555.h"
00010 
00011 class HumanInterface {
00012 public:
00013     HumanInterface(
00014         PCA9555 *ioExt,
00015         unsigned int redLed1Pin, unsigned int greenLed1Pin, unsigned int blueLed1Pin,
00016         unsigned int redLed2Pin, unsigned int greenLed2Pin, unsigned int blueLed2Pin,
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     RgbLed rgbLed1;
00035     RgbLed rgbLed2;
00036     
00037     PinDetect buttonGoal;
00038     PinDetect buttonStart;
00039     //PinDetect inputBall;    
00040     
00041     InterruptIn inputBall;
00042        
00043     //Functions that PinDetect will call
00044     void goalFall();
00045     void startRise();
00046     void ballFall();
00047     void ballRise();
00048     
00049     bool goalButtonPressed;
00050     bool startButtonReleased;
00051     int ballState;
00052    
00053     bool redBlinking;
00054     bool goalBlinking;
00055     
00056     bool redState();
00057 
00058     Ticker ledTicker;
00059     
00060     void blinkLeds(void);
00061 };
00062 
00063 #endif