crjeder / hx711_spi

This is a library for the hx711 chip. It uses SPI instead of bit banging for more reliability.
MIT License
14 stars 4 forks source link

Fix for stable Rust #7

Closed jbit closed 2 years ago

jbit commented 2 years ago

Hi!

Thanks for writing this crate! It got me up and running with my HX711 based scale on a slow and ancient Raspberry Pi Zero. So far all readings have been very stable and correct.

I generally try to stick with the stable Rust compiler, so I noticed this crate uses an unstable feature (#![feature(negative_impls)]) which requires the nightly compiler.

I read through the code and understand you added the !Sync negative trait bound to prevent sharing of Hx711 between threads.

However, as far as I can tell, this is not required with the code in it's current state:

This pull request removes the !Sync bound, reformats the code using cargo +nightly fmt, and has some minor cleanups and typo fixes.

Please let me know if you have any questions or want to discuss anything 😄

Cheers!

--James

crjeder commented 2 years ago

Thanks jbit! Your insight into the compiler guarantees is highly appreciated! Great that you were able to confirm that the code is reentrant / thread safe. You found a bunch of awful typos. The code must have been a nightly one.. 😊