summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Tittelbach <bernhard@tittelbach.org>2017-04-26 15:45:54 +0200
committerBernhard Tittelbach <bernhard@tittelbach.org>2017-04-26 15:47:59 +0200
commit56ac38590602430f4217fb7bdf70b13017b4bc13 (patch)
treefd35b5d94d9714b687f16649602cc27b48f3bfc8
parentfix adc example (diff)
usbio check if connected
-rw-r--r--lib/usbio.c8
-rw-r--r--lib/usbio.h1
2 files changed, 9 insertions, 0 deletions
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
}