So basically you want the GPIO to be set as Input with no pulls, that's easy with pinctrl.I need to be able to release a GPIO and let it be tristate, and also to be able to first write a GPIO and then wait for it to be externally pulled. Is this done with pinctrl?
But pinctrl can't afaik monitor the pin and wait for a state change for you, so you'' have to get the pin state from pinctrl and check it yourself.
Code:
pinctrl set 9 ip pnoldstate="$(pinctrl get 9 | sed "s/^.*| \(..\) .*$/\1/")" # Returns "hi" or "lo"while [ "$oldstate" = "$(pinctrl get 9 | sed "s/^.*| \(..\) .*$/\1/")" ]do sleep 0.1doneecho "Pin has changed state"
Of course there are are other ways to do it.
Statistics: Posted by rpdom — Sat Jun 29, 2024 10:09 am