Schoolproject, Emulates a QT1070 from a touchberry

Dependencies:   mbed

Revision:
0:b7b55b8a4d2b
Child:
1:f4caacc4df1b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 10 13:28:23 2016 +0000
@@ -0,0 +1,76 @@
+#include "mbed.h"
+#include "I2C_QT1070.h"
+#include "QT1070.h"
+DigitalOut myled(LED1);
+
+Serial pc(USBTX,USBRX);
+
+QT1070touchemulator::QT1070 chiptje;
+//I2cMemoryDevice::I2cMemory i2cMemory (p28,p27,0xAA);
+
+
+int main()
+{
+
+
+    pc.baud(9600);
+    
+    QT1070touchemulator::I2cQT1070 i2cQT1070Chip(p28, p27, 0x36, 100000);
+    int cycleCounter = 0;
+
+    while(1) 
+    {        
+        i2cQT1070Chip.check_for_instruction();
+        cycleCounter++;
+        if(cycleCounter > 100000) 
+        {
+            myled = !myled;
+            cycleCounter =0;
+        }
+
+    };    
+
+
+
+    //char fw = chiptje.getFirmware();
+//    pc.printf("firmware=%d\r\n", fw);
+//
+//    char ci = chiptje.getChipID();
+//    pc.printf("chip id=%d\r\n", ci);
+//
+//    while(1) {
+//        myled = 1;
+//        wait(0.1);
+//        myled = 0;
+//
+//
+//        int ks = chiptje.getKeystate();
+//        //pc.printf("keystate=%d\r\n", ks);
+//
+//            if(ks==28){
+//                    pc.printf("you pressed UP\r\n");
+//             }
+//
+//            if(ks==26){
+//                    pc.printf("you pressed RIGHT\r\n");
+//            }
+//
+//            if(ks==31){
+//                    pc.printf("you pressed DOWN\r\n");
+//            }
+//
+//            if(ks==22){
+//                    pc.printf("you pressed LEFT\r\n");
+//            }
+//
+//            if(ks==14){
+//                    pc.printf("you pressed CENTER\r\n");
+//                    chiptje.resetMbed();
+//            }
+//
+//
+//
+//
+//        wait(0.2);
+//    }
+}