TEAMUSB_SLAVE

Dependencies:   USBHost mbed

Fork of USBHostKeyboard_HelloWorld by TEAMUSB

Revision:
10:54ffd94e075c
Parent:
9:8bcd70b26084
Child:
11:e12aae7de530
--- a/main.cpp	Wed Apr 01 15:50:28 2015 +0000
+++ b/main.cpp	Fri Apr 03 13:21:03 2015 +0000
@@ -47,7 +47,8 @@
 int main() {
     Thread keyboardTask(keyboard_task, NULL, osPriorityNormal, 256 * 4);
     device.frequency(1000000);
-    device.format(8, 1);
+    //device.format(8, 1);
+    device.format(8, 3);
     
     //while(1) {
         //Thread::wait(1000); 
@@ -59,6 +60,7 @@
     while(1) {
         
         //get instruciton
+        printf("first poll\r\n");
         device.reply(0x00);
         while(!device.receive()) {
              if(i++ % 10000 == 0) {
@@ -68,8 +70,12 @@
         
         uint8_t instruction = device.read();
         
-        if(instruction != 0xFE) continue;        
+        if(instruction != 0xFE) {
+            printf("received %x on first poll\r\n", instruction );
+            continue;        
+        }
         
+        printf("second step\r\n");
         device.reply(keyReg);        
         
         while(!device.receive()) {
@@ -80,6 +86,7 @@
         
         device.read();
 
+        printf("third step\r\n");
         device.reply(0x00);        
 
         while(!device.receive()) {
@@ -90,7 +97,7 @@
 
         int response = device.read();
             
-        //printf("Sent Keystroke %x over SPI. response was %x\r\n", keyReg, response);
+        printf("Sent Keystroke %x over SPI. response was %x\r\n", keyReg, response);
          
         if(response == keyReg) {
             keyReg = 0;