From a7de4ac9b7a2dfb1fa44921fb0f41f249c8cdd5e Mon Sep 17 00:00:00 2001 From: YixingShen Date: Fri, 26 Jan 2024 02:37:15 +0800 Subject: [PATCH 1/4] Correct VIDEO_CS_VS_INTERFACE_FRAME_MJPEG to VIDEO_CS_ITF_VS_FRAME_MJPEG for #define TUD_VIDEO_DESC_CS_VS_FRM_MJPEG_DISC --- src/class/video/video.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/class/video/video.h b/src/class/video/video.h index d9880c291..268e219e2 100644 --- a/src/class/video/video.h +++ b/src/class/video/video.h @@ -537,7 +537,7 @@ TU_VERIFY_STATIC( sizeof(video_probe_and_commit_control_t) == 48, "size is not c /* Motion-JPEG 3.1.1 Table 3-2 and 3-4 */ #define TUD_VIDEO_DESC_CS_VS_FRM_MJPEG_DISC(_frmidx, _cap, _width, _height, _minbr, _maxbr, _maxfrmbufsz, _frminterval, ...) \ TUD_VIDEO_DESC_CS_VS_FRM_MJPEG_DISC_LEN + (TU_ARGS_NUM(__VA_ARGS__)) * 4, \ - TUSB_DESC_CS_INTERFACE, VIDEO_CS_VS_INTERFACE_FRAME_MJPEG, \ + TUSB_DESC_CS_INTERFACE, VIDEO_CS_ITF_VS_FRAME_MJPEG, \ _frmidx, _cap, U16_TO_U8S_LE(_width), U16_TO_U8S_LE(_height), U32_TO_U8S_LE(_minbr), U32_TO_U8S_LE(_maxbr), \ U32_TO_U8S_LE(_maxfrmbufsz), U32_TO_U8S_LE(_frminterval), (TU_ARGS_NUM(__VA_ARGS__)), __VA_ARGS__ From 19130440ccd0db8649b2f4e6c7ccb2ee2eaeefac Mon Sep 17 00:00:00 2001 From: YixingShen Date: Fri, 26 Jan 2024 02:46:53 +0800 Subject: [PATCH 2/4] Revert "Merge branch 'master' of https://github.com/YixingShen/tinyusb" This reverts commit 611f9d948be47b96520e84773525b9b79d3c7189, reversing changes made to a7de4ac9b7a2dfb1fa44921fb0f41f249c8cdd5e. --- hw/bsp/stm32f1/family.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/bsp/stm32f1/family.c b/hw/bsp/stm32f1/family.c index 0c1b362ab..e79f9cd78 100644 --- a/hw/bsp/stm32f1/family.c +++ b/hw/bsp/stm32f1/family.c @@ -57,6 +57,9 @@ void board_init(void) { __HAL_RCC_GPIOC_CLK_ENABLE(); __HAL_RCC_GPIOD_CLK_ENABLE(); + // Enable UART Clock + UART_CLK_EN(); + #if CFG_TUSB_OS == OPT_OS_NONE // 1ms tick timer SysTick_Config(SystemCoreClock / 1000); @@ -83,10 +86,7 @@ void board_init(void) { GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(BUTTON_PORT, &GPIO_InitStruct); -#ifdef UART_DEV // UART - UART_CLK_EN(); - GPIO_InitStruct.Pin = UART_TX_PIN | UART_RX_PIN; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; @@ -105,7 +105,6 @@ void board_init(void) { .Init.OverSampling = UART_OVERSAMPLING_16 }; HAL_UART_Init(&UartHandle); -#endif // USB Pins // Configure USB DM and DP pins. From 4c9f462423338a812378924233eac55ce0e96fb8 Mon Sep 17 00:00:00 2001 From: YixingShen Date: Fri, 26 Jan 2024 09:09:18 +0800 Subject: [PATCH 3/4] add "set tx_busy 1" into video_capture's video_tas for "if (tx_busy) return" --- examples/device/video_capture/src/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/device/video_capture/src/main.c b/examples/device/video_capture/src/main.c index 711d4710a..759c06057 100644 --- a/examples/device/video_capture/src/main.c +++ b/examples/device/video_capture/src/main.c @@ -185,6 +185,7 @@ void video_task(void) if (!already_sent) { already_sent = 1; + tx_busy = 1; start_ms = board_millis(); #ifdef CFG_EXAMPLE_VIDEO_READONLY # if defined(CFG_EXAMPLE_VIDEO_DISABLE_MJPEG) @@ -203,6 +204,7 @@ void video_task(void) if (cur - start_ms < interval_ms) return; // not enough time if (tx_busy) return; start_ms += interval_ms; + tx_busy = 1; #ifdef CFG_EXAMPLE_VIDEO_READONLY # if defined(CFG_EXAMPLE_VIDEO_DISABLE_MJPEG) From 073a7a5659f06ce623e1081ac5f5566408fba670 Mon Sep 17 00:00:00 2001 From: YixingShen Date: Tue, 30 Jan 2024 08:30:37 +0800 Subject: [PATCH 4/4] revert the change in the f1 family.c since it break compile with other f1 that does not use UART. --- hw/bsp/stm32f1/family.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/bsp/stm32f1/family.c b/hw/bsp/stm32f1/family.c index e79f9cd78..0c1b362ab 100644 --- a/hw/bsp/stm32f1/family.c +++ b/hw/bsp/stm32f1/family.c @@ -57,9 +57,6 @@ void board_init(void) { __HAL_RCC_GPIOC_CLK_ENABLE(); __HAL_RCC_GPIOD_CLK_ENABLE(); - // Enable UART Clock - UART_CLK_EN(); - #if CFG_TUSB_OS == OPT_OS_NONE // 1ms tick timer SysTick_Config(SystemCoreClock / 1000); @@ -86,7 +83,10 @@ void board_init(void) { GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(BUTTON_PORT, &GPIO_InitStruct); +#ifdef UART_DEV // UART + UART_CLK_EN(); + GPIO_InitStruct.Pin = UART_TX_PIN | UART_RX_PIN; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; @@ -105,6 +105,7 @@ void board_init(void) { .Init.OverSampling = UART_OVERSAMPLING_16 }; HAL_UART_Init(&UartHandle); +#endif // USB Pins // Configure USB DM and DP pins.