Skip to content

Commit ecb5792

Browse files
committed
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.
1 parent 8362bff commit ecb5792

3 files changed

Lines changed: 18 additions & 15 deletions

File tree

teensy/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ TOOLS_PATH = $(ARDUINO)/hardware/tools
104104

105105
post_compile: $(BUILD)/micropython-mz.hex
106106
$(ECHO) "Preparing $@ for upload"
107-
$(Q)$(TOOLS_PATH)/teensy_post_compile -file="$(basename $(<F))" -path="$(<D)" -tools="$(TOOLS_PATH)"
107+
$(Q)$(TOOLS_PATH)/teensy_post_compile -file="$(basename $(<F))" -path="$(abspath $(<D))" -tools="$(TOOLS_PATH)"
108108

109109
reboot:
110110
$(ECHO) "REBOOT"

teensy/usb.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
#include <string.h>
2+
#include <stdint.h>
23

34
#include "Arduino.h"
45

6+
#include "mpconfig.h"
7+
#include "misc.h"
8+
#include "qstr.h"
9+
#include "obj.h"
10+
#include "runtime.h"
11+
512
#include "usb.h"
613
#include "usb_serial.h"
714

8-
int usb_vcp_is_connected(void)
15+
bool usb_vcp_is_connected(void)
916
{
1017
return usb_configuration && (usb_cdc_line_rtsdtr & (USB_SERIAL_DTR | USB_SERIAL_RTS));
1118
}
1219

13-
int usb_vcp_is_enabled(void)
20+
bool usb_vcp_is_enabled(void)
1421
{
15-
return 1;
22+
return true;
1623
}
1724

1825
void usb_vcp_set_interrupt_char(int c) {
@@ -25,9 +32,14 @@ int usb_vcp_rx_num(void) {
2532
return usb_serial_available();
2633
}
2734

28-
int usb_vcp_recv_byte(void)
35+
int usb_vcp_recv_byte(uint8_t *ptr)
2936
{
30-
return usb_serial_getchar();
37+
int ch = usb_serial_getchar();
38+
if (ch < 0) {
39+
return 0;
40+
}
41+
*ptr = ch;
42+
return 1;
3143
}
3244

3345
void usb_vcp_send_str(const char* str)

teensy/usb.h

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)