Skip to content

Commit d8a5df7

Browse files
ghent360fpistm
authored andcommitted
Fix issue stm32duino#478.
1 parent f58b753 commit d8a5df7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: cores/arduino/stm32/usb/cdc/usbd_cdc_if.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,9 @@ void CDC_deInit(void)
263263

264264
bool CDC_connected()
265265
{
266-
uint32_t transmitTime = 0;
267-
if (transmitStart) {
266+
// Save the transmitStart value in a local variable - fix #478
267+
uint32_t transmitTime = transmitStart;
268+
if (transmitTime) {
268269
transmitTime = HAL_GetTick() - transmitStart;
269270
}
270271
return hUSBD_Device_CDC.dev_state == USBD_STATE_CONFIGURED

0 commit comments

Comments
 (0)