Open HeadhunterXamd opened 5 months ago
For blinky, you need to add a dependency on embedded_hal = "0.2"
.
Sorry, the docs could explain that better.
I ran into this issue a few days ago as well. Is there any plans to update to embedded_hal
1.0? Is this a good task for someone new to this project to try doing?
In this case, the issue was not related to the specific version of embedded_hal. The mentioned docs just don't explain that you probably need to add a dependency on embedded_hal when you extend the trivial example.
Regarding version 1.0: rp2040-hal is mostly ready on the main branch, and there are open merge requests for the missing parts. Updating the board crates wasn't started yet (as far as I am aware).
Would it be reasonable for rp_pico
crate to re-export its embedded_hal
so that the user of rp_pico
wouldn't need to know which version to install?
Not really imho. Both would be equivalently supported. The "limiting" factor for a user would likely be the external peripheral drivers they're using instead.
Maybe this is another data point that it would be reasonable to provide inherent implementations of all fundamental operations, especially easy things like setting a gpio pin? That way, in a simple firmware, it would no longer be required to import the embedded-hal traits.
In the past I've held the opinion that any serious firmware is structured in a way that separates setup code working on the MCU specific inherent functions from driver code working on the embedded-hal traits. Even if the driver code is not in a separate crate but specific to this single firmware. But perhaps that's an overly complex, and not sufficiently beginner-friendly approach?
I get a strange error when trying to build the blinky example:
and a few lines further:
I tried to use the toml of the example and the toml based on the from scratch chapter.
I tried this with the example code from the blinky file.
I am using cargo 1.73.0 (9c4383fb5 2023-08-26) and rustup 1.26.0 (5af9b9484 2023-04-05) rustc 1.73.0 (cc66ad468 2023-10-03)