Emiel Estiévenart
/
QT1070_copy
Schoolproject, Emulates a QT1070 from a touchberry
main.cpp
- Committer:
- Perijah
- Date:
- 2016-11-11
- Revision:
- 1:f4caacc4df1b
- Parent:
- 0:b7b55b8a4d2b
File content as of revision 1:f4caacc4df1b:
#include "mbed.h" #include "I2C_QT1070.h" #include "QT1070.h" DigitalOut led1(LED1); Serial pc(USBTX,USBRX); QT1070touchemulator::QT1070 qt1070Chip; 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) { led1 = !led1; cycleCounter =0; } }; // char fw = qt1070Chip.getFirmware(); // pc.printf("firmware=%02x\r\n", fw); // // char ci = qt1070Chip.getChipID(); // pc.printf("chip id=%02x\r\n", ci); // // while(1) { // led1 = 1; // wait(0.1); // led1 = 0; // // // int ks = qt1070Chip.getKeystate(); // // pc.printf("keystate=%02x\r\n", ks); // // if(ks & 0x02){ // pc.printf("you pressed UP\r\n"); // } // // if(ks & 0x04){ // pc.printf("you pressed RIGHT\r\n"); // } // // if(ks & 0x01){ // pc.printf("you pressed DOWN\r\n"); // } // // if(ks & 0x08){ // pc.printf("you pressed LEFT\r\n"); // } // // if(ks & 0x10){ // pc.printf("you pressed CENTER\r\n"); // //qt1070Chip.resetMbed(); // } // // wait(0.2); // } }