summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2021-01-21 16:35:13 +0700
committerGitHub <[email protected]>2021-01-21 16:35:13 +0700
commit1e134cbb31cb0fcd593d47e9865dd2c4dba68686 (patch)
tree4638eb5eb885e89be071a83a9297ad9da126cdf8 /examples
parente0aa405d19e35dbf58cf502b8106455c1a3c2a5c (diff)
parent7aaccd94d2e11ee2329353b4119526c75279b3ba (diff)
Merge branch 'master' into pico
Diffstat (limited to 'examples')
-rw-r--r--examples/device/cdc_dual_ports/src/main.c2
-rw-r--r--examples/device/cdc_msc/src/main.c8
-rw-r--r--examples/device/cdc_msc_freertos/.skip.MCU_MKL25ZXX0
-rw-r--r--examples/device/cdc_msc_freertos/src/main.c10
-rw-r--r--examples/device/hid_composite_freertos/src/main.c7
-rw-r--r--examples/device/msc_dual_lun/.skip.MCU_MKL25ZXX0
-rw-r--r--examples/device/net_lwip_webserver/.skip.MCU_MKL25ZXX0
-rw-r--r--examples/device/webusb_serial/src/main.c19
-rw-r--r--examples/make.mk5
-rw-r--r--examples/rules.mk15
10 files changed, 41 insertions, 25 deletions
diff --git a/examples/device/cdc_dual_ports/src/main.c b/examples/device/cdc_dual_ports/src/main.c
index d6e38df85..198c4252b 100644
--- a/examples/device/cdc_dual_ports/src/main.c
+++ b/examples/device/cdc_dual_ports/src/main.c
@@ -83,6 +83,8 @@ static void cdc_task(void)
for (itf = 0; itf < CFG_TUD_CDC; itf++)
{
+ // connected() check for DTR bit
+ // Most but not all terminal client set this when making connection
if ( tud_cdc_n_connected(itf) )
{
if ( tud_cdc_n_available(itf) )
diff --git a/examples/device/cdc_msc/src/main.c b/examples/device/cdc_msc/src/main.c
index a407e2ddd..a20a80fcd 100644
--- a/examples/device/cdc_msc/src/main.c
+++ b/examples/device/cdc_msc/src/main.c
@@ -105,7 +105,9 @@ void tud_resume_cb(void)
//--------------------------------------------------------------------+
void cdc_task(void)
{
- if ( tud_cdc_connected() )
+ // connected() check for DTR bit
+ // Most but not all terminal client set this when making connection
+ // if ( tud_cdc_connected() )
{
// connected and there are data available
if ( tud_cdc_available() )
@@ -131,12 +133,14 @@ void cdc_task(void)
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
{
(void) itf;
+ (void) rts;
// connected
- if ( dtr && rts )
+ if ( dtr )
{
// print initial message when connected
tud_cdc_write_str("\r\nTinyUSB CDC MSC device example\r\n");
+ tud_cdc_write_flush();
}
}
diff --git a/examples/device/cdc_msc_freertos/.skip.MCU_MKL25ZXX b/examples/device/cdc_msc_freertos/.skip.MCU_MKL25ZXX
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/device/cdc_msc_freertos/.skip.MCU_MKL25ZXX
diff --git a/examples/device/cdc_msc_freertos/src/main.c b/examples/device/cdc_msc_freertos/src/main.c
index 1371b84c3..e90c3f0d9 100644
--- a/examples/device/cdc_msc_freertos/src/main.c
+++ b/examples/device/cdc_msc_freertos/src/main.c
@@ -168,9 +168,11 @@ void cdc_task(void* params)
// RTOS forever loop
while ( 1 )
{
- if ( tud_cdc_connected() )
+ // connected() check for DTR bit
+ // Most but not all terminal client set this when making connection
+ // if ( tud_cdc_connected() )
{
- // connected and there are data available
+ // There are data available
if ( tud_cdc_available() )
{
uint8_t buf[64];
@@ -198,12 +200,14 @@ void cdc_task(void* params)
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
{
(void) itf;
+ (void) rts;
// connected
- if ( dtr && rts )
+ if ( dtr )
{
// print initial message when connected
tud_cdc_write_str("\r\nTinyUSB CDC MSC device with FreeRTOS example\r\n");
+ tud_cdc_write_flush();
}
}
diff --git a/examples/device/hid_composite_freertos/src/main.c b/examples/device/hid_composite_freertos/src/main.c
index de065ee64..83c68b515 100644
--- a/examples/device/hid_composite_freertos/src/main.c
+++ b/examples/device/hid_composite_freertos/src/main.c
@@ -58,7 +58,12 @@ StaticTimer_t blinky_tmdef;
TimerHandle_t blinky_tm;
// static task for usbd
-#define USBD_STACK_SIZE (3*configMINIMAL_STACK_SIZE/2)
+#if CFG_TUSB_DEBUG
+ #define USBD_STACK_SIZE (3*configMINIMAL_STACK_SIZE)
+#else
+ #define USBD_STACK_SIZE (3*configMINIMAL_STACK_SIZE/2)
+#endif
+
StackType_t usb_device_stack[USBD_STACK_SIZE];
StaticTask_t usb_device_taskdef;
diff --git a/examples/device/msc_dual_lun/.skip.MCU_MKL25ZXX b/examples/device/msc_dual_lun/.skip.MCU_MKL25ZXX
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/device/msc_dual_lun/.skip.MCU_MKL25ZXX
diff --git a/examples/device/net_lwip_webserver/.skip.MCU_MKL25ZXX b/examples/device/net_lwip_webserver/.skip.MCU_MKL25ZXX
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/device/net_lwip_webserver/.skip.MCU_MKL25ZXX
diff --git a/examples/device/webusb_serial/src/main.c b/examples/device/webusb_serial/src/main.c
index e1a098048..9309bbf6e 100644
--- a/examples/device/webusb_serial/src/main.c
+++ b/examples/device/webusb_serial/src/main.c
@@ -143,9 +143,14 @@ void tud_resume_cb(void)
// WebUSB use vendor class
//--------------------------------------------------------------------+
-// Invoked when received VENDOR control request
-bool tud_vendor_control_request_cb(uint8_t rhport, tusb_control_request_t const * request)
+// Invoked when a control transfer occurred on an interface of this class
+// Driver response accordingly to the request and the transfer stage (setup/data/ack)
+// return false to stall control endpoint (e.g unsupported request)
+bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request)
{
+ // nothing to with DATA & ACK stage
+ if (stage != CONTROL_STAGE_SETUP ) return true;
+
switch (request->bRequest)
{
case VENDOR_REQUEST_WEBUSB:
@@ -194,16 +199,6 @@ bool tud_vendor_control_request_cb(uint8_t rhport, tusb_control_request_t const
return true;
}
-// Invoked when DATA Stage of VENDOR's request is complete
-bool tud_vendor_control_complete_cb(uint8_t rhport, tusb_control_request_t const * request)
-{
- (void) rhport;
- (void) request;
-
- // nothing to do
- return true;
-}
-
void webserial_task(void)
{
if ( web_serial_connected )
diff --git a/examples/make.mk b/examples/make.mk
index 6743044fd..992a4e60e 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -34,9 +34,14 @@ CXX = $(CROSS_COMPILE)g++
OBJCOPY = $(CROSS_COMPILE)objcopy
SIZE = $(CROSS_COMPILE)size
MKDIR = mkdir
+ifeq ($(CMDEXE),1)
+CP = copy
+RM = del
+else
SED = sed
CP = cp
RM = rm
+endif
#-------------- Source files and compiler flags --------------
diff --git a/examples/rules.mk b/examples/rules.mk
index 37e0e7a19..2274d1cd2 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -81,7 +81,11 @@ uf2: $(BUILD)/$(BOARD)-firmware.uf2
OBJ_DIRS = $(sort $(dir $(OBJ)))
$(OBJ): | $(OBJ_DIRS)
$(OBJ_DIRS):
+ifeq ($(CMDEXE),1)
+ @$(MKDIR) $(subst /,\,$@)
+else
@$(MKDIR) -p $@
+endif
$(BUILD)/$(BOARD)-firmware.elf: $(OBJ)
@echo LINK $@
@@ -107,13 +111,6 @@ vpath %.c . $(TOP)
$(BUILD)/obj/%.o: %.c
@echo CC $(notdir $@)
@$(CC) $(CFLAGS) -c -MD -o $@ $<
- @# The following fixes the dependency file.
- @# See http://make.paulandlesley.org/autodep.html for details.
- @# Regex adjusted from the above to play better with Windows paths, etc.
- @$(CP) $(@:.o=.d) $(@:.o=.P); \
- $(SED) -e 's/#.*//' -e 's/^.*: *//' -e 's/ *\\$$//' \
- -e '/^$$/ d' -e 's/$$/ :/' < $(@:.o=.d) >> $(@:.o=.P); \
- $(RM) $(@:.o=.d)
# ASM sources lower case .s
vpath %.s . $(TOP)
@@ -134,7 +131,11 @@ size: $(BUILD)/$(BOARD)-firmware.elf
.PHONY: clean
clean:
+ifeq ($(CMDEXE),1)
+ rd /S /Q $(subst /,\,$(BUILD))
+else
$(RM) -rf $(BUILD)
+endif
# Print out the value of a make variable.
# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile