+ if hasattr(gpiod, "line") and hasattr(
+ gpiod, "LINE_REQ_FLAG_BIAS_PULL_DOWN"
+ ):
+ flags |= gpiod.LINE_REQ_FLAG_BIAS_PULL_DOWN
+ else:
+ raise NotImplementedError(
+ "Internal pulldowns not supported in this version of libgpiod, "
+ "use physical resistor instead!"
+ )
+ elif pull == self.PULL_NONE:
+ if hasattr(gpiod, "line") and hasattr(
+ gpiod, "LINE_REQ_FLAG_BIAS_DISABLE"
+ ):
+ flags |= gpiod.LINE_REQ_FLAG_BIAS_DISABLE
+ else:
+ raise NotImplementedError(
+ "Internal pulldowns not supported in this version of libgpiod, "
+ "use physical resistor instead!"
+ )