Open bbonenfant opened 4 years ago
From what I can tell, this is not possible to implement due to limitations in embedded-hal
. The OneShot
trait itself would be easy enough (just delegate to the correct port variant), but OneShot
has a bound on Channel
, which isn't implementable for the generic Pin
, see: https://github.com/rust-embedded/embedded-hal/issues/110. It looks like there was buy-in a year and a half ago to change that API, but there's been no movement since then.
Correction: there has been movement in the API, but not in a direction that supports this usage. Ahead of an imminent 1.0 release, the channel()
associated function has been removed entirely in favor of an associated constant.
We will address this issue when https://github.com/rust-embedded/embedded-hal/pull/242 is merged and this project migrates to embedded-hal
version 1.0.0.
On the next
branch we now have a "solution" to this. Check the mega2560-adc
example: https://github.com/Rahix/avr-hal/blob/next/examples/arduino-mega2560/src/bin/mega2560-adc.rs
Is there any workaround for this until the next
branch stabilizes?
@davystrong: I would consider the next
branch just as stable (or unstable) as master
at this point. So if you need this right now, I would suggest just switching to the next
branch already. But of course you'll need to refactor your code quite a bit to work with the new design.
Ok, thanks, I'll try that.
Hello, this is a great project. When trying to perform the
Adc.read
method on aPin<Analog>
object, I receive the following error:which cleaned up for you benefit becomes:
I believe that this just means that the downgraded/generic
Pin<Analog>
object needs thisOneShot
trait implemented? It's a little hard to figure out what is and isn't implemented with all of the procedural macros.Here is a minimal reproducible example: