aboutsummaryrefslogtreecommitdiff
path: root/teensy/usb.c
diff options
context:
space:
mode:
authorDave Hylands2014-08-03 09:55:24 -0700
committerDave Hylands2014-08-03 10:03:02 -0700
commitecb5792f887392d53f98a84e1c56a807cc93d2ea (patch)
treec689e1c85b4ef88feecdbcd23f91f55bba481e95 /teensy/usb.c
parent8362bffb2eed310d319b0b96c1b3305eff9c4417 (diff)
Updated teensys usb.c and switched to using usb.h from stmhal.
Removed the local usb.h from teensey directory and now uses the usb.h from the stmhal directory. Fixed the deploy target to use abspath.
Diffstat (limited to 'teensy/usb.c')
-rw-r--r--teensy/usb.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/teensy/usb.c b/teensy/usb.c
index 37c479ec7..9fb50967d 100644
--- a/teensy/usb.c
+++ b/teensy/usb.c
@@ -1,18 +1,25 @@
#include <string.h>
+#include <stdint.h>
#include "Arduino.h"
+#include "mpconfig.h"
+#include "misc.h"
+#include "qstr.h"
+#include "obj.h"
+#include "runtime.h"
+
#include "usb.h"
#include "usb_serial.h"
-int usb_vcp_is_connected(void)
+bool usb_vcp_is_connected(void)
{
return usb_configuration && (usb_cdc_line_rtsdtr & (USB_SERIAL_DTR | USB_SERIAL_RTS));
}
-int usb_vcp_is_enabled(void)
+bool usb_vcp_is_enabled(void)
{
- return 1;
+ return true;
}
void usb_vcp_set_interrupt_char(int c) {
@@ -25,9 +32,14 @@ int usb_vcp_rx_num(void) {
return usb_serial_available();
}
-int usb_vcp_recv_byte(void)
+int usb_vcp_recv_byte(uint8_t *ptr)
{
- return usb_serial_getchar();
+ int ch = usb_serial_getchar();
+ if (ch < 0) {
+ return 0;
+ }
+ *ptr = ch;
+ return 1;
}
void usb_vcp_send_str(const char* str)