Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i2cbb.c function i2cbb_read_i2c_block_data possible missing curly brackets. #37

Closed
g8kig opened this issue Apr 29, 2023 · 1 comment
Closed

Comments

@g8kig
Copy link

g8kig commented Apr 29, 2023

The function i2cbb_read_i2c_block_data in file i2cbb.c is possibly missing curly brackets judging by the indentation.

  uint8_t i = 0;
  for (i = 0; i < length - 1; i++) 
  	values[i] = i2c_read_byte(0,0);
	values[i] = i2c_read_byte(1,1);

	i2c_stop_cond();


should this actually be

  uint8_t i = 0;
  for (i = 0; i < length - 1; i++){
  	values[i] = i2c_read_byte(0,0);
	values[i] = i2c_read_byte(1,1);

	i2c_stop_cond();
  }

@afarhan
Copy link
Owner

afarhan commented Apr 29, 2023

The last byte has to send a stop bit. If you see the code of i2c_read_byte, the second parameter signals sending a stop bit that ends the block read.
The indentation is badly done, but the code is alright.

@afarhan afarhan closed this as completed Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants