Committer:
nguyenmanhthao996tn
Date:
Sat Sep 30 09:12:15 2017 +0000
Revision:
0:ab95649b3f54
Worked version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nguyenmanhthao996tn 0:ab95649b3f54 1 #ifndef __BUTTON_CONTROL__
nguyenmanhthao996tn 0:ab95649b3f54 2 #define __BUTTON_CONTROL__
nguyenmanhthao996tn 0:ab95649b3f54 3
nguyenmanhthao996tn 0:ab95649b3f54 4 /*********** Libraries ***********/
nguyenmanhthao996tn 0:ab95649b3f54 5 #include "mbed.h"
nguyenmanhthao996tn 0:ab95649b3f54 6 #include "PinConfiguration.h"
nguyenmanhthao996tn 0:ab95649b3f54 7
nguyenmanhthao996tn 0:ab95649b3f54 8 /*********** Variables ***********/
nguyenmanhthao996tn 0:ab95649b3f54 9 typedef struct {
nguyenmanhthao996tn 0:ab95649b3f54 10 bool *_btn0_Flag, *_btn1_Flag, *_btn2_Flag;
nguyenmanhthao996tn 0:ab95649b3f54 11 } ButtonFlagsAddress;
nguyenmanhthao996tn 0:ab95649b3f54 12 static ButtonFlagsAddress flags;
nguyenmanhthao996tn 0:ab95649b3f54 13
nguyenmanhthao996tn 0:ab95649b3f54 14 void btn0UpdateFlag(void);
nguyenmanhthao996tn 0:ab95649b3f54 15 void btn1UpdateFlag(void);
nguyenmanhthao996tn 0:ab95649b3f54 16 void btn2UpdateFlag(void);
nguyenmanhthao996tn 0:ab95649b3f54 17
nguyenmanhthao996tn 0:ab95649b3f54 18 class Button
nguyenmanhthao996tn 0:ab95649b3f54 19 {
nguyenmanhthao996tn 0:ab95649b3f54 20 private:
nguyenmanhthao996tn 0:ab95649b3f54 21 InterruptIn *Btn0, *Btn1, *Btn2;
nguyenmanhthao996tn 0:ab95649b3f54 22 public:
nguyenmanhthao996tn 0:ab95649b3f54 23 Button(void);
nguyenmanhthao996tn 0:ab95649b3f54 24 Button(PinName Button0, PinName Button1, PinName Button2);
nguyenmanhthao996tn 0:ab95649b3f54 25
nguyenmanhthao996tn 0:ab95649b3f54 26 void SetBtn0Callback(void (*btn0_Callback)(void));
nguyenmanhthao996tn 0:ab95649b3f54 27 void SetBtn0Flag(bool *btn0_Flag);
nguyenmanhthao996tn 0:ab95649b3f54 28 void SetBtn1Callback(void (*btn1_Callback)(void));
nguyenmanhthao996tn 0:ab95649b3f54 29 void SetBtn1Flag(bool *btn1_Flag);
nguyenmanhthao996tn 0:ab95649b3f54 30 void SetBtn2Callback(void (*btn2_Callback)(void));
nguyenmanhthao996tn 0:ab95649b3f54 31 void SetBtn2Flag(bool *btn2_Flag);
nguyenmanhthao996tn 0:ab95649b3f54 32 };
nguyenmanhthao996tn 0:ab95649b3f54 33
nguyenmanhthao996tn 0:ab95649b3f54 34 #endif /* __BUTTON_CONTROL__ */