knurling-rs / knurling-session-20q4

Building your own embedded CO2 measuring device. With Rust!
https://session20q4.ferrous-systems.com/
23 stars 9 forks source link

Wrong pin type for SCL and SDA on the SCD30 examples #11

Closed rpruizc closed 3 years ago

rpruizc commented 3 years ago

The code in the SCD30 examples for declaring the SCL and SDA pins does not compile as is with the latest cargo packages. I am not completely sure if the hal version changed or not, but Twim::Pins require a floating input instead of a disconnected one.

That is:

pins.p0_30.into_floating_input().degrade();

Instead of:

pins.p0_30.degrade();
Urhengulas commented 3 years ago

Hi @rpruizc, Thank you for opening this issue!

I just tried compiling it locally and it actually works for me. rust-analyzer shows me Pin<Input<Floating>> as the type of both scl and sda. Adding .into_floating_input() still works, but doesn't seem to be needed for me.

Did you make any other changes to the code?

Urhengulas commented 3 years ago

I see. After running cargo upgrade I got the same error! 😮

rpruizc commented 3 years ago

Nice! Thank you Johann

Sent from my iPhone

On May 10, 2021, at 7:49 AM, Johann Hemmann @.***> wrote:

 Closed #11 via #15.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.