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)
110
110
static inline void sendbytes_blocking (const void * b , uint32_t len )
111
111
{
112
112
while (len ) {
113
- wait_for_write ();
113
+ // wait_for_write();
114
114
uint32_t w = tud_cdc_n_write (CDC_ITF , b , len );
115
115
b += w ;
116
116
len -= w ;
@@ -228,13 +228,15 @@ static void command_loop(void)
228
228
sendbyte_blocking (S_ACK );
229
229
230
230
// 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 ];
234
233
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 );
238
240
}
239
241
cs_deselect (SPI_CS );
240
242
break ;
You can’t perform that action at this time.
0 commit comments