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

I2C NACK polling #233

Open
Crzyrndm opened this issue Jun 2, 2021 · 2 comments
Open

I2C NACK polling #233

Crzyrndm opened this issue Jun 2, 2021 · 2 comments

Comments

@Crzyrndm
Copy link
Contributor

Crzyrndm commented Jun 2, 2021

current master branch asserts that the buffer length for I2C::read and I2C::write is at least 1 and less than 256 (1..=255)

write: https://github.com/stm32-rs/stm32l4xx-hal/blob/master/src/i2c.rs#L254
read: https://github.com/stm32-rs/stm32l4xx-hal/blob/master/src/i2c.rs#L308

A fairly common I2C operation is checking if an address is present/responding by just writing the address and checking for the device ACK. Note that this is a 0 length read/write and therefore the asserts linked above prevent this.

I see the motivation for preventing 0-sized reads/writes, but there isn't a solid alternative right now. There is some conversation in the embedded-hal crate about adding an explicit method for this but no real consensus or movement.

@gauteh
Copy link
Contributor

gauteh commented Mar 2, 2022

Assert removed in #295 . Tested on r5.

@gauteh
Copy link
Contributor

gauteh commented Mar 5, 2022

Fixed for write

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