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 USBMSD_SD USBDevice
Diff: USBDevice/USBSERIAL/USBSerial.cpp
- Revision:
- 7:6494da2a5c60
- Parent:
- 6:126c4d980196
- Child:
- 8:534fd41d8cc7
diff -r 126c4d980196 -r 6494da2a5c60 USBDevice/USBSERIAL/USBSerial.cpp
--- a/USBDevice/USBSERIAL/USBSerial.cpp Mon Nov 14 10:00:07 2011 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-// USBSerial.c
-// USB device example: virtual serial port
-// Copyright (c) 2011 ARM Limited. All rights reserved
-
-#include "stdint.h"
-#include "USBSerial.h"
-#include "USBBusInterface.h"
-
-
-int USBSerial::_putc(int c) {
- send(EPBULK_IN, (uint8_t *)&c, 1);
- return 1;
-}
-
-int USBSerial::_getc() {
- uint8_t c;
- while (buf.isEmpty());
- buf.dequeue(&c);
- return c;
-}
-
-void USBSerial::attach(void (*ptr)(void)) {
- handler = true;
- proc = true;
- fn = ptr;
-}
-
-
-bool USBSerial::EP2_OUT_callback() {
- uint8_t c[65];
- uint16_t size = 0;
-
- //we read the packet received and put it on the circular buffer
- USBCDC::read(EPBULK_OUT, c, &size, MAX_PACKET_SIZE_EPBULK);
- for (int i = 0; i < size; i++) {
- buf.queue(c[i]);
- }
-
- //call a potential handler
- if (handler) {
- if (proc) {
- (*fn)();
- } else {
- rx.call();
- }
- }
-
- // We reactivate the endpoint to receive next characters
- readStart(EPBULK_OUT, MAX_PACKET_SIZE_EPBULK);
- return true;
-}
-
-uint8_t USBSerial::available() {
- return buf.available();
-}