diff options
Diffstat (limited to 'wirish/usb_serial.cpp')
-rw-r--r-- | wirish/usb_serial.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/wirish/usb_serial.cpp b/wirish/usb_serial.cpp index b66b992..a01900f 100644 --- a/wirish/usb_serial.cpp +++ b/wirish/usb_serial.cpp @@ -28,23 +28,33 @@ * @brief USB virtual serial terminal */ +#include <wirish/usb_serial.h> + #include <string.h> -#include "wirish.h" -#include "usb_cdcacm.h" -#include "usb.h" +#include <libmaple/usb_cdcacm.h> +#include <libmaple/usb.h> + +#include <wirish/wirish.h> #define USB_TIMEOUT 50 USBSerial::USBSerial(void) { +#if !BOARD_HAVE_SERIALUSB + ASSERT(0); +#endif } void USBSerial::begin(void) { +#if BOARD_HAVE_SERIALUSB usb_cdcacm_enable(BOARD_USB_DISC_DEV, BOARD_USB_DISC_BIT); +#endif } void USBSerial::end(void) { +#if BOARD_HAVE_SERIALUSB usb_cdcacm_disable(BOARD_USB_DISC_DEV, BOARD_USB_DISC_BIT); +#endif } void USBSerial::write(uint8 ch) { @@ -114,4 +124,6 @@ uint8 USBSerial::getRTS(void) { return usb_cdcacm_get_rts(); } +#if BOARD_HAVE_SERIALUSB USBSerial SerialUSB; +#endif |