File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed
ports/raspberrypi/common-hal/rp2pio Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -546,15 +546,23 @@ static bool _transfer(rp2pio_statemachine_obj_t *self,
546
546
size_t tx_remaining = out_len ;
547
547
548
548
while (rx_remaining || tx_remaining ) {
549
- if (tx_remaining && !pio_sm_is_tx_fifo_full (self -> pio , self -> state_machine )) {
550
- * tx_destination = * data_out ;
551
- data_out ++ ;
552
- -- tx_remaining ;
553
- }
554
- if (rx_remaining && !pio_sm_is_rx_fifo_empty (self -> pio , self -> state_machine )) {
555
- * data_in = (uint8_t ) * rx_source ;
556
- data_in ++ ;
557
- -- rx_remaining ;
549
+ for (int i = 0 ; i < 32 ; i ++ ) {
550
+ bool did_transfer = false;
551
+ if (tx_remaining && !pio_sm_is_tx_fifo_full (self -> pio , self -> state_machine )) {
552
+ * tx_destination = * data_out ;
553
+ data_out ++ ;
554
+ -- tx_remaining ;
555
+ did_transfer = true;
556
+ }
557
+ if (rx_remaining && !pio_sm_is_rx_fifo_empty (self -> pio , self -> state_machine )) {
558
+ * data_in = (uint8_t ) * rx_source ;
559
+ data_in ++ ;
560
+ -- rx_remaining ;
561
+ did_transfer = true;
562
+ }
563
+ if (!did_transfer ) {
564
+ break ;
565
+ }
558
566
}
559
567
RUN_BACKGROUND_TASKS ;
560
568
if (mp_hal_is_interrupted ()) {
You can’t perform that action at this time.
0 commit comments