FRDM-K64F, Avnet M14A2A, Grove Shield, to create smart home system. In use with AT&Ts M2x & Flow.
Dependencies: mbed FXOS8700CQ MODSERIAL
Diff: sensors.cpp
- 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();