sajattack / bitbang-hal

Implements embedded-hal traits by bitbanging
MIT License
41 stars 11 forks source link

Fix writing empty buffer #22

Closed barafael closed 3 years ago

barafael commented 3 years ago

As seen in the stm32f0 embedded hal i2c_find_addresses example, writing an empty buffer to a certain address with the write bit active and checking the ACK can be used to check if a device is present at this address. With this change, scanning the bus works flawlessly.

Writing just a write to an address is also sometimes used to check if a device has woken up (like here: https://github.com/barafael/sdp8xx/blob/0e2ff653d0309866412b37a413261adeeac977f7/src/lib.rs#L256)

The same thing is also required for writing QuickCommands. Though this might be specific to SMBus :)

I hope this doesn't break anything else (?).

Thanks for the great library!

sajattack commented 3 years ago

Thanks for the great PR!

sajattack commented 3 years ago

Thanks for the great PR!