Marek Trojan / _8_CONV

Dependencies:   mbed-src

Fork of _8_CONV_1_SLAVE by Marek Trojan

Files at this revision

API Documentation at this revision

Comitter:
marcus255
Date:
Sun Dec 06 21:24:27 2015 +0000
Parent:
0:ab0f6f4ef7ac
Child:
2:42a084b14fb2
Commit message:
still not complete write-read sequence

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
main.h Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Dec 01 22:15:52 2015 +0000
+++ b/main.cpp	Sun Dec 06 21:24:27 2015 +0000
@@ -31,7 +31,7 @@
             if (uart_rec == UART_NON_CONFIRMATION_CHAR)
                 break;
         }     
-        slave.stop();
+        //slave.stop();
         device.putc(END_OF_TRANSMISSION);
     } 
     else if (addr == (char)(SLAVE_ADDR | 0x01)){
@@ -40,18 +40,23 @@
         device.putc(addr);
         while(1){
             device.putc(DATA_TO_READ_CHAR);
-            while(1) { // waiting for data byte from conv2
+            while(1) { // waiting for data byte from conv2 //seems to w8 4ever...
                 if(device.readable()) {
                     if (device.getc() == UART_CHAR_INCOMING){
                         uart_rec2 = device.getc(); 
                         break;
                     }
+                
                 }
             } 
-            if(!slave.write(uart_rec2))
-                break;           
+            if(!slave.write(uart_rec2)) {
+                device.putc(END_OF_TRANSMISSION);
+                break;
+            }  
+               
+              
         }
-        slave.stop();
+        slave.read();
         
     }
     else {
--- a/main.h	Tue Dec 01 22:15:52 2015 +0000
+++ b/main.h	Sun Dec 06 21:24:27 2015 +0000
@@ -16,7 +16,7 @@
 InterruptIn SDA_interrupt(PTB7);
 DigitalIn SDA_state(PTB6);
 
-char msg[] = "qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm";
+//char msg[] = "qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm";
 char buffer;
 int count;