Nespresso coffee demo working on the Arch Pro

Dependencies:   EthernetInterface mbed-rtos mbed nsdl rgb_sensor_buffer

Fork of mbed_nsdl by Nespresso RGB Sensor

Revision:
9:9d5b0c43579b
Parent:
5:cb0df4fbe7a1
Child:
11:2a853cd96bf7
--- a/nsdl_support.cpp	Mon Sep 15 14:14:44 2014 +0000
+++ b/nsdl_support.cpp	Wed Oct 29 18:28:59 2014 +0000
@@ -1,12 +1,13 @@
 // NSDL library support functions
 
 #include "mbed.h"
+#include "MODSERIAL.h"
 #include "nsdl_support.h"
 #include "mbed.h"
 #include "rtos.h"
 #include "EthernetInterface.h"
 
-extern Serial pc;
+extern MODSERIAL console;
 extern EthernetInterface eth;
 extern Endpoint nsp;
 extern UDPSocket server;
@@ -93,17 +94,17 @@
 
 static uint8_t tx_cb(sn_nsdl_capab_e protocol, uint8_t *data_ptr, uint16_t data_len, sn_nsdl_addr_s *address_ptr)
 {
-    pc.printf("TX callback!\n\rSending %d bytes\r\n", data_len);
+    console.printf("TX callback!\n\rSending %d bytes\r\n", data_len);
 
     if(server.sendTo(nsp, (char*)data_ptr, data_len) != data_len)
-        pc.printf("sending failed\n\r");
+        console.printf("sending failed\n\r");
 
     return 1;
 }
 
 static uint8_t rx_cb(sn_coap_hdr_s *coap_packet_ptr, sn_nsdl_addr_s *address_ptr)
 {
-    pc.printf("RX callback!\r\n");
+    console.printf("RX callback!\r\n");
     return 0;
 }
 
@@ -116,9 +117,9 @@
         wait(RD_UPDATE_PERIOD);
         endpoint_ptr = nsdl_init_register_endpoint(endpoint_ptr, (uint8_t*)endpoint_name, ep_type, lifetime_ptr);
         if(sn_nsdl_update_registration(endpoint_ptr) != 0)
-            pc.printf("NSP re-registering failed\r\n");
+            console.printf("NSP re-registering failed\r\n");
         else
-            pc.printf("NSP re-registering OK\r\n");
+            console.printf("NSP re-registering OK\r\n");
         nsdl_clean_register_endpoint(&endpoint_ptr);
     }
 }
@@ -132,9 +133,9 @@
     memory_cbs.sn_nsdl_alloc = &nsdl_alloc;
     memory_cbs.sn_nsdl_free = &nsdl_free;
     if(sn_nsdl_init(&tx_cb, &rx_cb, &memory_cbs) == -1)
-        pc.printf("libNsdl init failed\r\n");
+        console.printf("libNsdl init failed\r\n");
     else
-        pc.printf("libNsdl init done\r\n");
+        console.printf("libNsdl init done\r\n");
 
     /* Set nsp address for library */
     set_NSP_address(nsp_addr, 5683, SN_NSDL_ADDRESS_TYPE_IPV4);
@@ -157,11 +158,11 @@
         int n = server.receiveFrom(from, buffer, sizeof(buffer));
         if (n < 0)
         {
-            pc.printf("Socket error\n\r");
+            console.printf("Socket error\n\r");
         }
         else
         {   
-            pc.printf("Received %d bytes\r\n", n);
+            console.printf("Received %d bytes\r\n", n);
             sn_nsdl_process_coap((uint8_t*)buffer, n, &received_packet_address);
         }
     }