-
I need to switch pin configuration "on the fly" how to do that with this library? Standard in rust is what i read is something like that:
But when i try it with this library im getting on |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
The methods are But we're working on a more ergonomic way to do this, take a look at MR #205. If this fits your usecase and you can provide some feedback on the API, I can merge those changes so they become generally available. |
Beta Was this translation helpful? Give feedback.
-
Sorry but not sure which should i use. Should i use solution from link or i should try to do something like this:
what i see under this link this convention should work for rust or am i missing something? |
Beta Was this translation helpful? Give feedback.
-
Both work. I would recommend using the PR #205 code I linked as this API is more flexible and can work in more situations. But the code which you shared is not technically wrong either, it is just more restricted in what you can do with it. |
Beta Was this translation helpful? Give feedback.
-
First i want to test first solution but when im trying to compile it im getting:
Some problem with borrow checker, but im creating everytime in loop new value so why it doesnt want to switch? |
Beta Was this translation helpful? Give feedback.
-
Your last line is wrong I think. It needs to be just led = ledin.into_opendrain_high(); (without |
Beta Was this translation helpful? Give feedback.
-
greate now its compiling, thank you. closing ticket, when i will have problem with second solution will update its ticket |
Beta Was this translation helpful? Give feedback.
The methods are
into_floating_input()
andinto_pull_up_input()
, check the docs: https://rahix.github.io/avr-hal/avr_hal_generic/port/struct.Pin.htmlBut we're working on a more ergonomic way to do this, take a look at MR #205. If this fits your usecase and you can provide some feedback on the API, I can merge those changes so they become generally available.