pp

Dependencies:   mbed

Revision:
1:ba7154d2d7ca
Parent:
0:b2064b3558b6
Child:
2:6b4dda997dc0
--- a/DigitDisplay.cpp	Sat Dec 05 10:02:26 2015 +0000
+++ b/DigitDisplay.cpp	Sat Dec 05 14:01:16 2015 +0000
@@ -36,6 +36,7 @@
 #define DIGIT_UNKOWN 0x08
 #define DIGIT_NULL   0x00
 #define DIGIT_MINUS  0x40
+BusIn button(D9,D10,D11);
 
 const uint8_t DIGIT_TABLE[] = {0x3f, 0x06, 0x5b, 0x4f,
                               0x66, 0x6d, 0x7d, 0x07,
@@ -72,6 +73,12 @@
     for (uint8_t i = 0; i < sizeof(_content); i++) {
         _content[i] = DIGIT_NULL;
     }
+    buttonState1 = 0;
+    buttonState2 = 0;
+    buttonState3 = 0;
+    //prebuttonState1 = 0;
+    //prebuttonState2 = 0;
+    //prebuttonState3 = 0;
 }
 
 void DigitDisplay::on()
@@ -320,3 +327,28 @@
      write(2, s3);    
      write(3, s4);
 }
+void DigitDisplay::getButtonState()
+{
+    
+    if(button==0b011) buttonState1=1;
+    else buttonState1=0;
+    if(button==0b101) buttonState2=1;
+    else buttonState2=0;
+    if(button==0b110) buttonState3=1;
+    else buttonState3=0;
+}
+bool DigitDisplay::checkButton1()
+{
+    if(button==0b011) return 1;
+    else return 0;
+}
+bool DigitDisplay::checkButton2()
+{
+    if(buttonState2==1) return 1;
+    else return 0;
+}
+bool DigitDisplay::checkButton3()
+{
+    if(buttonState3==1) return 1;
+    else return 0;
+}
\ No newline at end of file