hackrf_usb: Be more careful in transceiver_mode check

This commit is contained in:
Ben Gamari
2013-07-06 19:15:17 -04:00
parent 9f2dca3e4e
commit 14526cd1c2

View File

@ -946,13 +946,11 @@ int main(void) {
#endif
while(true) {
if (transceiver_mode == TRANSCEIVER_MODE_OFF)
continue;
// Wait until buffer 0 is transmitted/received.
while( usb_bulk_buffer_offset < 16384 );
// Set up IN transfer of buffer 0.
if (transceiver_mode != TRANSCEIVER_MODE_OFF) {
usb_transfer_schedule(
(transceiver_mode == TRANSCEIVER_MODE_RX)
? &usb_endpoint_bulk_in : &usb_endpoint_bulk_out,
@ -960,11 +958,13 @@ int main(void) {
0x4000,
NULL
);
}
// Wait until buffer 1 is transmitted/received.
while( usb_bulk_buffer_offset >= 16384 );
// Set up IN transfer of buffer 1.
if (transceiver_mode != TRANSCEIVER_MODE_OFF) {
usb_transfer_schedule(
(transceiver_mode == TRANSCEIVER_MODE_RX)
? &usb_endpoint_bulk_in : &usb_endpoint_bulk_out,
@ -973,6 +973,7 @@ int main(void) {
NULL
);
}
}
return 0;
}