Schoolproject, Emulates a QT1070 from a touchberry

Dependencies:   mbed

Revision:
1:f4caacc4df1b
Parent:
0:b7b55b8a4d2b
--- a/QT1070.cpp	Thu Nov 10 13:28:23 2016 +0000
+++ b/QT1070.cpp	Fri Nov 11 11:57:40 2016 +0000
@@ -5,65 +5,67 @@
 DigitalIn btnDown(p12); // 31
 DigitalIn btnLeft(p13); // 22
 DigitalIn btnCenter(p14); //14
-
 extern "C" void mbed_reset();
 
-
 namespace QT1070touchemulator
 {
-
-QT1070::QT1070()
-{
-    id_firmware = 0x00;
-    id_chip = 0x01;
-}
-
-char QT1070::getFirmware()
-{
-    return id_firmware;
-}
-
-char QT1070::getChipID()
-{
-    return id_chip;
-}
-
-int QT1070::getKeystate()
-{
-    int createdData = 0x00;
-    if (btnDown==1) {
-        createdData  = createdData | 0x01;
-    } else {
-        createdData= createdData & ~ 0x01;
+    //constructor
+    QT1070::QT1070()
+    {
+        id_firmware = 0x00;
+        id_chip = 0x01;
+    }
+    
+    char QT1070::getFirmware()
+    {
+        return id_firmware;
+    }
+    
+    char QT1070::getChipID()
+    {
+        return id_chip;
     }
-    if (!btnUp) {
-        createdData = createdData | 0x02;
-    } else {
-        createdData= createdData & ~ 0x02;
-    }
-    if (!btnRight) {
-        createdData = createdData | 0x04;
-    } else {
-        createdData= createdData & ~ 0x04;
+    
+    int QT1070::getKeystate()
+    {
+        char createdData = 0x00;
+        if (btnDown==1) {
+            createdData  = createdData | 0x01;
+        } else {
+            createdData= createdData & ~ 0x01;
+        }
+        
+        if (btnUp) {
+            createdData = createdData | 0x02;
+        } else {
+            createdData= createdData & ~ 0x02;
+        }
+        
+        if (btnRight) {
+            createdData = createdData | 0x04;
+        } else {
+            createdData= createdData & ~ 0x04;
+        }
+        
+        if (btnLeft) {
+            createdData = createdData | 0x08;
+        } else {
+            createdData= createdData & ~ 0x08;
+        }
+        
+        if (btnCenter) {
+            createdData  = createdData | 0x10;
+        } else {
+            createdData= createdData & ~ 0x10;
+        }
+    
+        return createdData;
+    
     }
-    if (!btnLeft) {
-        createdData = createdData | 0x08;
-    } else {
-        createdData= createdData & ~ 0x08;
-    }
-    if (!btnCenter) {
-        createdData  = createdData | 0x10;
-    } else {
-        createdData= createdData & ~ 0x10;
+    
+    void QT1070::resetMbed()
+    {
+        mbed_reset();
     }
 
-    return createdData;
-
-}
-
-void QT1070::resetMbed()
-{
-    mbed_reset();
-}
-
 };