diff options
| author | hathach <[email protected]> | 2024-11-13 13:08:30 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2024-11-13 13:08:30 +0700 |
| commit | aeae2966a2afa669068e54eef7c4dd2dceffaa0d (patch) | |
| tree | ec965825374576319936bbd1c861b8e90ab6cc77 /examples | |
| parent | 839ec1729252d81aa631ba7ea4653c5591f6fb6f (diff) | |
hil add stm32f723disco, add test flags for device/host/dual
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/device/cdc_msc/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | examples/host/device_info/src/main.c | 20 |
2 files changed, 11 insertions, 11 deletions
diff --git a/examples/device/cdc_msc/CMakeLists.txt b/examples/device/cdc_msc/CMakeLists.txt index 9415f8c68..c2f9cb095 100644 --- a/examples/device/cdc_msc/CMakeLists.txt +++ b/examples/device/cdc_msc/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.17) -set_property(GLOBAL PROPERTY USE_FOLDERS ON) +#set_property(GLOBAL PROPERTY USE_FOLDERS ON) include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake) diff --git a/examples/host/device_info/src/main.c b/examples/host/device_info/src/main.c index 8e0185878..70304e449 100644 --- a/examples/host/device_info/src/main.c +++ b/examples/host/device_info/src/main.c @@ -56,8 +56,12 @@ //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF PROTYPES //--------------------------------------------------------------------+ - -static uint32_t blink_interval_ms = 1000; +enum { + BLINK_NOT_MOUNTED = 250, + BLINK_MOUNTED = 1000, + BLINK_SUSPENDED = 2500, +}; +static uint32_t blink_interval_ms = BLINK_NOT_MOUNTED; void led_blinking_task(void* param); static void print_utf16(uint16_t* temp_buf, size_t buf_len); @@ -102,6 +106,8 @@ int main(void) { // Invoked when device is mounted (configured) void tuh_mount_cb(uint8_t daddr) { + blink_interval_ms = BLINK_MOUNTED; + // Get Device Descriptor tusb_desc_device_t desc_device; uint8_t xfer_result = tuh_descriptor_get_device_sync(daddr, &desc_device, 18); @@ -161,6 +167,7 @@ void tuh_mount_cb(uint8_t daddr) { // Invoked when device is unmounted (bus reset/unplugged) void tuh_umount_cb(uint8_t daddr) { + blink_interval_ms = BLINK_NOT_MOUNTED; printf("Device removed, address = %d\r\n", daddr); } @@ -227,15 +234,8 @@ void led_blinking_task(void* param) { while (1) { #if CFG_TUSB_OS == OPT_OS_FREERTOS - if (blink_interval_ms == 0) { - vTaskSuspend(NULL); - } else { - vTaskDelay(blink_interval_ms / portTICK_PERIOD_MS); - } + vTaskDelay(blink_interval_ms / portTICK_PERIOD_MS); #else - if (blink_interval_ms == 0) { - return; - } if (board_millis() - start_ms < blink_interval_ms) { return; // not enough time } |
