Reiko Randoja / BallSens

Dependents:  

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ballsens.h Source File

ballsens.h

00001 #ifndef BALLSENS_H
00002 #define BALLSENS_H
00003 
00004 #include "mbed.h"
00005 #include "PCA9555.h"
00006 
00007 class BallSens {
00008 protected:
00009     FunctionPointer _callbackChange;
00010 public:
00011     BallSens(PCA9555 *ioExt, unsigned int ballPin);
00012     bool read();
00013     
00014     void change(void (*function)(void));
00015     
00016     template<typename T>
00017     void change(T *object, void (T::*member)(void)) { 
00018         _callbackChange.attach(object, member); 
00019     }   
00020     
00021 private:
00022     bool ballState;
00023     PCA9555 *extIO;
00024     unsigned int ballPinNumber;
00025     
00026     void callChange(void);        
00027     
00028     void setState(bool newState);
00029 };
00030 
00031 #endif