@@ -475,12 +475,14 @@ STATIC mp_obj_t adc_read_timed_multi(mp_obj_t adc_array_in, mp_obj_t buf_array_i
475475 mp_buffer_info_t bufinfo ;
476476 mp_get_buffer_raise (buf_array [0 ], & bufinfo , MP_BUFFER_WRITE );
477477 size_t typesize = mp_binary_get_size ('@' , bufinfo .typecode , NULL );
478+ void * bufptrs [nbufs ];
478479 for (uint array_index = 0 ; array_index < nbufs ; array_index ++ ) {
479480 mp_buffer_info_t bufinfo_curr ;
480481 mp_get_buffer_raise (buf_array [array_index ], & bufinfo_curr , MP_BUFFER_WRITE );
481482 if ((bufinfo .len != bufinfo_curr .len ) || (bufinfo .typecode != bufinfo_curr .typecode )) {
482483 mp_raise_ValueError ("size and type of buffers must match" );
483484 }
485+ bufptrs [array_index ] = bufinfo_curr .buf ;
484486 }
485487
486488 // Use the supplied timer object as the sampling time base
@@ -541,9 +543,7 @@ STATIC mp_obj_t adc_read_timed_multi(mp_obj_t adc_array_in, mp_obj_t buf_array_i
541543 if (typesize == 1 ) {
542544 value >>= 4 ;
543545 }
544- mp_buffer_info_t bufinfo_curr ; // Get buf for current ADC
545- mp_get_buffer_raise (buf_array [array_index ], & bufinfo_curr , MP_BUFFER_WRITE );
546- mp_binary_set_val_array_from_int (bufinfo_curr .typecode , bufinfo_curr .buf , elem_index , value );
546+ mp_binary_set_val_array_from_int (bufinfo .typecode , bufptrs [array_index ], elem_index , value );
547547 }
548548 }
549549
0 commit comments