Sille Van Landschoot / Mbed 2 deprecated mbed_slave_full

Dependencies:   mbed

Revision:
6:ec3b01ce9687
Parent:
5:b73ea174e997
--- a/main.cpp	Tue Oct 14 14:54:32 2014 +0000
+++ b/main.cpp	Tue Oct 21 09:45:38 2014 +0000
@@ -41,9 +41,10 @@
     
     while (1) {
         int rec = slave.receive();
-        switch (rec) {
+        switch (rec) {            
             case I2CSlave::ReadAddressed:
             {
+                pc.printf("ReadAddressed:\r\n");
                 int value = memory.get(pointer);
                 buffer[0] = pointer;
                 intToByte(buffer+1, value);
@@ -56,9 +57,10 @@
             }
             case I2CSlave::WriteAddressed:
             {
+                pc.printf("WriteAddressed:\r\n");
                 // First we read the command byte
                 int command = slave.read();
-                
+                pc.printf("Command: %d \r\n", command);
                 // Check the command
                 switch (command)
                 {
@@ -93,10 +95,12 @@
                     case CLEAR:
                         pc.printf("Clearing the memory\r\n");    
                         memory.reset();
+                        slave.stop();
                         break;
                     
                     case PRINT:
                         memory.print();
+                        slave.stop();
                         break;
                     
                     default: