Skip to content

Commit 859f219

Browse files
committed
stm32/mboot: Guard use of tx_pending with USE_USB_POLLING option.
Signed-off-by: Damien George <damien@micropython.org>
1 parent 7cf1118 commit 859f219

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ports/stm32/mboot/main.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,9 @@ static int dfu_handle_tx(int cmd, int arg, int len, uint8_t *buf, int max_len) {
966966

967967
typedef struct _pyb_usbdd_obj_t {
968968
bool started;
969+
#if USE_USB_POLLING
969970
bool tx_pending;
971+
#endif
970972
USBD_HandleTypeDef hUSBDDevice;
971973

972974
uint8_t bRequest;
@@ -1160,17 +1162,20 @@ static uint8_t pyb_usbdd_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *r
11601162
// device-to-host request
11611163
int len = dfu_handle_tx(self->bRequest, self->wValue, self->wLength, self->tx_buf, USB_XFER_SIZE);
11621164
if (len >= 0) {
1165+
#if USE_USB_POLLING
11631166
self->tx_pending = true;
1167+
#endif
11641168
USBD_CtlSendData(&self->hUSBDDevice, self->tx_buf, len);
11651169
}
11661170
}
11671171
return USBD_OK;
11681172
}
11691173

11701174
static uint8_t pyb_usbdd_EP0_TxSent(USBD_HandleTypeDef *pdev) {
1175+
#if USE_USB_POLLING
11711176
pyb_usbdd_obj_t *self = (pyb_usbdd_obj_t *)pdev->pClassData;
11721177
self->tx_pending = false;
1173-
#if !USE_USB_POLLING
1178+
#else
11741179
// Process now that we have sent a response
11751180
dfu_process();
11761181
#endif
@@ -1243,7 +1248,9 @@ static int pyb_usbdd_detect_port(void) {
12431248

12441249
static void pyb_usbdd_init(pyb_usbdd_obj_t *self, int phy_id) {
12451250
self->started = false;
1251+
#if USE_USB_POLLING
12461252
self->tx_pending = false;
1253+
#endif
12471254
USBD_HandleTypeDef *usbd = &self->hUSBDDevice;
12481255
usbd->id = phy_id;
12491256
usbd->dev_state = USBD_STATE_DEFAULT;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy