@@ -45,7 +45,7 @@ bool common_hal_usb_core_device_construct(usb_core_device_obj_t *self, uint8_t d
45
45
}
46
46
self -> device_address = device_address ;
47
47
self -> first_langid = 0 ;
48
- _xfer_result = 0xff ;
48
+ _xfer_result = XFER_RESULT_INVALID ;
49
49
return true;
50
50
}
51
51
@@ -91,13 +91,13 @@ static void _transfer_done_cb(tuh_xfer_t *xfer) {
91
91
92
92
static bool _wait_for_callback (void ) {
93
93
while (!mp_hal_is_interrupted () &&
94
- _xfer_result == 0xff ) {
94
+ _xfer_result == XFER_RESULT_INVALID ) {
95
95
// The background tasks include TinyUSB which will call the function
96
96
// we provided above. In other words, the callback isn't in an interrupt.
97
97
RUN_BACKGROUND_TASKS ;
98
98
}
99
99
xfer_result_t result = _xfer_result ;
100
- _xfer_result = 0xff ;
100
+ _xfer_result = XFER_RESULT_INVALID ;
101
101
return result == XFER_RESULT_SUCCESS ;
102
102
}
103
103
@@ -225,7 +225,7 @@ void common_hal_usb_core_device_set_configuration(usb_core_device_obj_t *self, m
225
225
}
226
226
227
227
static size_t _xfer (tuh_xfer_t * xfer , mp_int_t timeout ) {
228
- _xfer_result = 0xff ;
228
+ _xfer_result = XFER_RESULT_INVALID ;
229
229
xfer -> complete_cb = _transfer_done_cb ;
230
230
if (!tuh_edpt_xfer (xfer )) {
231
231
mp_raise_usb_core_USBError (NULL );
@@ -234,7 +234,7 @@ static size_t _xfer(tuh_xfer_t *xfer, mp_int_t timeout) {
234
234
uint32_t start_time = supervisor_ticks_ms32 ();
235
235
while ((timeout == 0 || supervisor_ticks_ms32 () - start_time < (uint32_t )timeout ) &&
236
236
!mp_hal_is_interrupted () &&
237
- _xfer_result == 0xff ) {
237
+ _xfer_result == XFER_RESULT_INVALID ) {
238
238
// The background tasks include TinyUSB which will call the function
239
239
// we provided above. In other words, the callback isn't in an interrupt.
240
240
RUN_BACKGROUND_TASKS ;
@@ -244,11 +244,11 @@ static size_t _xfer(tuh_xfer_t *xfer, mp_int_t timeout) {
244
244
return 0 ;
245
245
}
246
246
xfer_result_t result = _xfer_result ;
247
- _xfer_result = 0xff ;
247
+ _xfer_result = XFER_RESULT_INVALID ;
248
248
if (result == XFER_RESULT_STALLED ) {
249
249
mp_raise_usb_core_USBError (MP_ERROR_TEXT ("Pipe error" ));
250
250
}
251
- if (result == 0xff ) {
251
+ if (result == XFER_RESULT_INVALID ) {
252
252
tuh_edpt_abort_xfer (xfer -> daddr , xfer -> ep_addr );
253
253
mp_raise_usb_core_USBTimeoutError ();
254
254
}
@@ -355,7 +355,7 @@ mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self,
355
355
.complete_cb = _transfer_done_cb ,
356
356
};
357
357
358
- _xfer_result = 0xff ;
358
+ _xfer_result = XFER_RESULT_INVALID ;
359
359
360
360
if (!tuh_control_xfer (& xfer )) {
361
361
mp_raise_usb_core_USBError (NULL );
@@ -364,7 +364,7 @@ mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self,
364
364
uint32_t start_time = supervisor_ticks_ms32 ();
365
365
while ((timeout == 0 || supervisor_ticks_ms32 () - start_time < (uint32_t )timeout ) &&
366
366
!mp_hal_is_interrupted () &&
367
- _xfer_result == 0xff ) {
367
+ _xfer_result == XFER_RESULT_INVALID ) {
368
368
// The background tasks include TinyUSB which will call the function
369
369
// we provided above. In other words, the callback isn't in an interrupt.
370
370
RUN_BACKGROUND_TASKS ;
@@ -374,11 +374,11 @@ mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self,
374
374
return 0 ;
375
375
}
376
376
xfer_result_t result = _xfer_result ;
377
- _xfer_result = 0xff ;
377
+ _xfer_result = XFER_RESULT_INVALID ;
378
378
if (result == XFER_RESULT_STALLED ) {
379
379
mp_raise_usb_core_USBError (MP_ERROR_TEXT ("Pipe error" ));
380
380
}
381
- if (result == 0xff ) {
381
+ if (result == XFER_RESULT_INVALID ) {
382
382
tuh_edpt_abort_xfer (xfer .daddr , xfer .ep_addr );
383
383
mp_raise_usb_core_USBTimeoutError ();
384
384
}
0 commit comments