Remote I/O Sensor bus with AT&T flow and M2X cloud

Dependencies:   DHT11 FXOS8700CQ MODSERIAL mbed

Fork of Avnet_ATT_Cellular_IOT by Avnet

Revision:
56:cb42ff383dab
Parent:
55:3abf9e3f42e6
Child:
57:d184175b6b03
--- a/sensors.cpp	Thu Jul 28 15:52:37 2016 +0000
+++ b/sensors.cpp	Thu Jul 28 17:21:31 2016 +0000
@@ -471,17 +471,22 @@
     //}
 } //ProcessUsbInterface()
 
-void pcrx_callback() //Rx interrupt for USB serial port
+// This function is called when a character goes into the RX buffer.
+void UsbUartRxCallback(MODSERIAL_IRQ_INFO *info) 
 {
-    // Note: you need to actually read from the serial to clear the RX interrupt
-    usb_uart_rx_buff[usb_uart_rx_buff_putptr++] = pc.getc();
+    // Get the pointer to our MODSERIAL object that invoked this callback.
+    MODSERIAL *pc = info->serial;
+    while (pc->readable())
+    {
+        usb_uart_rx_buff[usb_uart_rx_buff_putptr++] = pc->getcNb();
+    }
 }
 #endif
  
 void sensors_init(void)
 {
 #ifdef USE_VIRTUAL_SENSORS
-    pc.attach(&pcrx_callback);
+   pc.attach(&UsbUartRxCallback, MODSERIAL::RxIrq);
 #endif
     Init_Si7020();
     Init_Si1145();