summaryrefslogtreecommitdiff
path: root/examples/device
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2025-11-06 20:29:23 +0700
committerGitHub <[email protected]>2025-11-06 20:29:23 +0700
commit6641550f58cd2f983ebb42a28dd881a72d72bc6f (patch)
tree4559b35dacfac6474ae31596325777a6c8c1994f /examples/device
parent58b4104015ec10089e8790febe8b3b6cef8b4b09 (diff)
parent94c1e05a72b197fc0508d43e91deeb3fc63bb4d6 (diff)
Merge pull request #3333 from hathach/espressif-dual-mode
fix compile issue with enabled both device and host stack for dwc2
Diffstat (limited to 'examples/device')
-rw-r--r--examples/device/video_capture/src/main.c18
-rw-r--r--examples/device/video_capture_2ch/src/main.c6
2 files changed, 15 insertions, 9 deletions
diff --git a/examples/device/video_capture/src/main.c b/examples/device/video_capture/src/main.c
index 29656e944..adcfb9f95 100644
--- a/examples/device/video_capture/src/main.c
+++ b/examples/device/video_capture/src/main.c
@@ -53,7 +53,7 @@ void usb_device_task(void *param);
void video_task(void* param);
#if CFG_TUSB_OS == OPT_OS_FREERTOS
-void freertos_init_task(void);
+void freertos_init(void);
#endif
@@ -65,7 +65,7 @@ int main(void) {
// If using FreeRTOS: create blinky, tinyusb device, video task
#if CFG_TUSB_OS == OPT_OS_FREERTOS
- freertos_init_task();
+ freertos_init();
#else
// init device stack on configured roothub port
tusb_rhport_init_t dev_init = {
@@ -211,8 +211,12 @@ static void video_send_frame(void) {
}
unsigned cur = board_millis();
- if (cur - start_ms < interval_ms) return; // not enough time
- if (tx_busy) return;
+ if (cur - start_ms < interval_ms) {
+ return; // not enough time
+ }
+ if (tx_busy) {
+ return;
+ }
start_ms += interval_ms;
tx_busy = 1;
@@ -273,7 +277,9 @@ void led_blinking_task(void* param) {
#if CFG_TUSB_OS == OPT_OS_FREERTOS
vTaskDelay(blink_interval_ms / portTICK_PERIOD_MS);
#else
- if (board_millis() - start_ms < blink_interval_ms) return; // not enough time
+ if (board_millis() - start_ms < blink_interval_ms) {
+ return; // not enough time
+ }
#endif
start_ms += blink_interval_ms;
@@ -336,7 +342,7 @@ void usb_device_task(void *param) {
}
}
-void freertos_init_task(void) {
+void freertos_init(void) {
#if configSUPPORT_STATIC_ALLOCATION
xTaskCreateStatic(led_blinking_task, "blinky", BLINKY_STACK_SIZE, NULL, 1, blinky_stack, &blinky_taskdef);
xTaskCreateStatic(usb_device_task, "usbd", USBD_STACK_SIZE, NULL, configMAX_PRIORITIES-1, usb_device_stack, &usb_device_taskdef);
diff --git a/examples/device/video_capture_2ch/src/main.c b/examples/device/video_capture_2ch/src/main.c
index a63efa82d..79b149f2b 100644
--- a/examples/device/video_capture_2ch/src/main.c
+++ b/examples/device/video_capture_2ch/src/main.c
@@ -53,7 +53,7 @@ void usb_device_task(void *param);
void video_task(void* param);
#if CFG_TUSB_OS == OPT_OS_FREERTOS
-void freertos_init_task(void);
+void freertos_init(void);
#endif
@@ -65,7 +65,7 @@ int main(void) {
// If using FreeRTOS: create blinky, tinyusb device, video task
#if CFG_TUSB_OS == OPT_OS_FREERTOS
- freertos_init_task();
+ freertos_init();
#else
// init device stack on configured roothub port
tusb_rhport_init_t dev_init = {
@@ -343,7 +343,7 @@ void usb_device_task(void *param) {
}
}
-void freertos_init_task(void) {
+void freertos_init(void) {
#if configSUPPORT_STATIC_ALLOCATION
xTaskCreateStatic(led_blinking_task, "blinky", BLINKY_STACK_SIZE, NULL, 1, blinky_stack, &blinky_taskdef);
xTaskCreateStatic(usb_device_task, "usbd", USBD_STACK_SIZE, NULL, configMAX_PRIORITIES-1, usb_device_stack, &usb_device_taskdef);