Merge branch 'master' of github.com:micropython/micropython

This commit is contained in:
Damien George 2014-08-04 11:12:47 +01:00
commit 2e3e8b2f69
3 changed files with 18 additions and 15 deletions

View File

@ -104,7 +104,7 @@ TOOLS_PATH = $(ARDUINO)/hardware/tools
post_compile: $(BUILD)/micropython-mz.hex post_compile: $(BUILD)/micropython-mz.hex
$(ECHO) "Preparing $@ for upload" $(ECHO) "Preparing $@ for upload"
$(Q)$(TOOLS_PATH)/teensy_post_compile -file="$(basename $(<F))" -path="$(<D)" -tools="$(TOOLS_PATH)" $(Q)$(TOOLS_PATH)/teensy_post_compile -file="$(basename $(<F))" -path="$(abspath $(<D))" -tools="$(TOOLS_PATH)"
reboot: reboot:
$(ECHO) "REBOOT" $(ECHO) "REBOOT"

View File

@ -1,18 +1,25 @@
#include <string.h> #include <string.h>
#include <stdint.h>
#include "Arduino.h" #include "Arduino.h"
#include "mpconfig.h"
#include "misc.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
#include "usb.h" #include "usb.h"
#include "usb_serial.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)); 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) { void usb_vcp_set_interrupt_char(int c) {
@ -25,9 +32,14 @@ int usb_vcp_rx_num(void) {
return usb_serial_available(); 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) void usb_vcp_send_str(const char* str)

View File

@ -1,9 +0,0 @@
void usb_init(void);
int usb_vcp_is_enabled(void);
int usb_vcp_is_connected(void);
int usb_vcp_rx_any(void);
char usb_vcp_rx_get(void);
void usb_vcp_send_str(const char* str);
void usb_vcp_send_strn(const char* str, int len);
void usb_vcp_send_strn_cooked(const char *str, int len);
void usb_hid_send_report(uint8_t *buf); // 4 bytes for mouse: ?, x, y, ?