From 56ac38590602430f4217fb7bdf70b13017b4bc13 Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Wed, 26 Apr 2017 15:45:54 +0200 Subject: usbio check if connected --- lib/usbio.c | 8 ++++++++ lib/usbio.h | 1 + 2 files changed, 9 insertions(+) diff --git a/lib/usbio.c b/lib/usbio.c index 3010789..2c9fc9c 100644 --- a/lib/usbio.c +++ b/lib/usbio.c @@ -99,6 +99,14 @@ void usbio_task(void) USB_USBTask(); } +int8_t usbio_is_connected(void) +{ + if(stdin == &usb_stream) + return 1; + else + return 0; +} + int16_t usbio_bytes_received(void) { if(stdin == &usb_stream) diff --git a/lib/usbio.h b/lib/usbio.h index fdd93f1..decc249 100644 --- a/lib/usbio.h +++ b/lib/usbio.h @@ -33,6 +33,7 @@ extern "C" { void usbio_init(void); void usbio_task(void); int16_t usbio_bytes_received(void); +int8_t usbio_is_connected(void); #ifdef __cplusplus } -- cgit v1.2.3