File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ static void wait_for_write(void)
110110static inline void sendbytes_blocking (const void * b , uint32_t len )
111111{
112112 while (len ) {
113- wait_for_write ();
113+ // wait_for_write();
114114 uint32_t w = tud_cdc_n_write (CDC_ITF , b , len );
115115 b += w ;
116116 len -= w ;
@@ -228,13 +228,15 @@ static void command_loop(void)
228228 sendbyte_blocking (S_ACK );
229229
230230 // Handle receive operation in chunks for large rlen
231- cs_select (SPI_CS );
232- while (rlen > 0 ) {
233- uint32_t chunk_size = (rlen < MAX_BUFFER_SIZE ) ? rlen : MAX_BUFFER_SIZE ;
231+ uint32_t chunk ;
232+ char buf [128 ];
234233
235- spi_read_blocking (SPI_IF , 0 , rx_buffer , chunk_size );
236- sendbytes_blocking (rx_buffer , chunk_size );
237- rlen -= chunk_size ;
234+ cs_select (SPI_CS );
235+ for (uint32_t i = 0 ; i < rlen ; i += chunk ) {
236+ chunk = MIN (rlen - i , sizeof (buf ));
237+ pio_spi_read8_blocking (spi , buf , chunk );
238+ fwrite (buf , 1 , chunk , stdout );
239+ fflush (stdout );
238240 }
239241 cs_deselect (SPI_CS );
240242 break ;
You can’t perform that action at this time.
0 commit comments