Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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();