@@ -131,7 +131,7 @@ void i2c_set_slave_mode(i2c_inst_t *i2c, bool slave, uint8_t addr) {
131131}
132132
133133static int i2c_write_blocking_internal (i2c_inst_t * i2c , uint8_t addr , const uint8_t * src , size_t len , bool nostop ,
134- check_timeout_fn timeout_check , struct timeout_state * ts , bool burst ) {
134+ check_timeout_fn timeout_check , struct timeout_state * ts ) {
135135 invalid_params_if (HARDWARE_I2C , addr >= 0x80 ); // 7-bit addresses
136136 invalid_params_if (HARDWARE_I2C , i2c_reserved_addr (addr ));
137137 // Synopsys hw accepts start/stop flags alongside data items in the same
@@ -238,33 +238,35 @@ static int i2c_write_blocking_internal(i2c_inst_t *i2c, uint8_t addr, const uint
238238 }
239239
240240 // nostop means we are now at the end of a *message* but not the end of a *transfer*
241- i2c -> restart_on_next = burst ? false : nostop ;
241+ i2c -> restart_on_next = nostop ;
242242 return rval ;
243243}
244244
245245int i2c_write_blocking (i2c_inst_t * i2c , uint8_t addr , const uint8_t * src , size_t len , bool nostop ) {
246- return i2c_write_blocking_internal (i2c , addr , src , len , nostop , NULL , NULL , false );
246+ return i2c_write_blocking_internal (i2c , addr , src , len , nostop , NULL , NULL );
247247}
248248
249249int i2c_write_blocking_until (i2c_inst_t * i2c , uint8_t addr , const uint8_t * src , size_t len , bool nostop ,
250250 absolute_time_t until ) {
251251 timeout_state_t ts ;
252- return i2c_write_blocking_internal (i2c , addr , src , len , nostop , init_single_timeout_until (& ts , until ), & ts , false );
252+ return i2c_write_blocking_internal (i2c , addr , src , len , nostop , init_single_timeout_until (& ts , until ), & ts );
253253}
254254
255255int i2c_write_timeout_per_char_us (i2c_inst_t * i2c , uint8_t addr , const uint8_t * src , size_t len , bool nostop ,
256256 uint timeout_per_char_us ) {
257257 timeout_state_t ts ;
258258 return i2c_write_blocking_internal (i2c , addr , src , len , nostop ,
259- init_per_iteration_timeout_us (& ts , timeout_per_char_us ), & ts , false );
259+ init_per_iteration_timeout_us (& ts , timeout_per_char_us ), & ts );
260260}
261261
262- int i2c_write_blocking_burst_mode (i2c_inst_t * i2c , uint8_t addr , const uint8_t * src , size_t len ) {
263- return i2c_write_blocking_internal (i2c , addr , src , len , true, NULL , NULL , true);
262+ int i2c_write_burst_blocking (i2c_inst_t * i2c , uint8_t addr , const uint8_t * src , size_t len ) {
263+ int rc = i2c_write_blocking_internal (i2c , addr , src , len , true, NULL , NULL );
264+ i2c -> restart_on_next = false;
265+ return rc ;
264266}
265267
266268static int i2c_read_blocking_internal (i2c_inst_t * i2c , uint8_t addr , uint8_t * dst , size_t len , bool nostop ,
267- check_timeout_fn timeout_check , timeout_state_t * ts , bool burst ) {
269+ check_timeout_fn timeout_check , timeout_state_t * ts ) {
268270 invalid_params_if (HARDWARE_I2C , addr >= 0x80 ); // 7-bit addresses
269271 invalid_params_if (HARDWARE_I2C , i2c_reserved_addr (addr ));
270272 invalid_params_if (HARDWARE_I2C , len == 0 );
@@ -326,26 +328,28 @@ static int i2c_read_blocking_internal(i2c_inst_t *i2c, uint8_t addr, uint8_t *ds
326328 rval = byte_ctr ;
327329 }
328330
329- i2c -> restart_on_next = burst ? false : nostop ;
331+ i2c -> restart_on_next = nostop ;
330332 return rval ;
331333}
332334
333335int i2c_read_blocking (i2c_inst_t * i2c , uint8_t addr , uint8_t * dst , size_t len , bool nostop ) {
334- return i2c_read_blocking_internal (i2c , addr , dst , len , nostop , NULL , NULL , false );
336+ return i2c_read_blocking_internal (i2c , addr , dst , len , nostop , NULL , NULL );
335337}
336338
337339int i2c_read_blocking_until (i2c_inst_t * i2c , uint8_t addr , uint8_t * dst , size_t len , bool nostop , absolute_time_t until ) {
338340 timeout_state_t ts ;
339- return i2c_read_blocking_internal (i2c , addr , dst , len , nostop , init_single_timeout_until (& ts , until ), & ts , false );
341+ return i2c_read_blocking_internal (i2c , addr , dst , len , nostop , init_single_timeout_until (& ts , until ), & ts );
340342}
341343
342344int i2c_read_timeout_per_char_us (i2c_inst_t * i2c , uint8_t addr , uint8_t * dst , size_t len , bool nostop ,
343345 uint timeout_per_char_us ) {
344346 timeout_state_t ts ;
345347 return i2c_read_blocking_internal (i2c , addr , dst , len , nostop ,
346- init_per_iteration_timeout_us (& ts , timeout_per_char_us ), & ts , false );
348+ init_per_iteration_timeout_us (& ts , timeout_per_char_us ), & ts );
347349}
348350
349- int i2c_read_blocking_burst_mode (i2c_inst_t * i2c , uint8_t addr , uint8_t * dst , size_t len ) {
350- return i2c_read_blocking_internal (i2c , addr , dst , len , true, NULL , NULL , true);
351+ int i2c_read_burst_blocking (i2c_inst_t * i2c , uint8_t addr , uint8_t * dst , size_t len ) {
352+ int rc = i2c_read_blocking_internal (i2c , addr , dst , len , true, NULL , NULL );
353+ i2c -> restart_on_next = false;
354+ return rc ;
351355}
0 commit comments