python-trio / asyncgpio

A small library to access GPIO pins the Trio way. Linux 4.9+ only.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't disable internal biasing

habnabit opened this issue · comments

commented

I have GPIO pins connected to a circuit which requires no internal biasing (no pull-up; no pull-down). asyncgpio seems to only support pull-up biasing.

In attempting to patch this myself, I hit a dead end. I have something that sort-of works, but only by also using gpiozero for doing some initialization code. I don't know what it does. I assume this could be possible with only asyncgpio:

import gpiozero
gpiozero.Button(6, pull_up=False).is_pressed
import asyncgpio as gpio
GPIOD_LINE_REQUEST_FLAG_BIAS_DISABLE = gpio.libgpiod.lib.GPIOD_LINE_REQUEST_FLAG_BIAS_DISABLE

Only then am I be able to do this and have it actually disable bias:

with in_.monitor(gpio.REQUEST_EVENT_BOTH_EDGES, flags=GPIOD_LINE_REQUEST_FLAG_BIAS_DISABLE):