New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trait for new_ads1015() structure? #10
Comments
If you split |
Yes, this would work. But now I'm stuck trying to figure out the type arguments
(I expect there should be an easy way to find type arguments in documentation or compiler error messages, but I have not figure it out.) |
Ah, that solution I proposed cannot work because the |
I have added the |
Thanks for adding this
A stripped down version of the code follows. Click to expand
|
I tried using the actual driver type, switching from linux to no std, etc. I have
but then I get
and it looks downhill from there. I guess I have to spell out the whole concrete type for every hal. I have a reasonable work around just leaving that one read in the main loop ( I just have to disambiguate), so I think I will leave it like that until there is an easy way to make it clean. |
I am trying to define a function with code for reading a couple of ads1015s so the loop is easier to read. The difficulty is that this requires the type for the structure returned by
Ads1x1x::new_ads1015()
which is used to read channels. Since the structure type is messy I would like to use a trait, but can only find traits for channels, not for the object doing the reading. The code below is a simplified extract which illustrates the problem.Click to expand
Since I don't have the trait right it gives
Is there a way to specify the trait to do this, or just a better way to approach the whole thing?
The text was updated successfully, but these errors were encountered: