flyte / mqtt-io

Expose GPIO modules (Raspberry Pi, Beaglebone, PCF8754, PiFace2 etc.) and digital sensors (LM75 etc.) to an MQTT server for remote control and monitoring.
MIT License
460 stars 157 forks source link

gpiod: enable pullup/pulldown #341

Closed chatziko closed 4 months ago

chatziko commented 6 months ago

This simple PR enables pullup/pulldown for gpiod, it's supported since python3-gpiod 1.5.2.

Note (independent from this PR)

The current code requires python3-gpiod <= 1.5.4, versions after 1.5.4 have completely changed the API. Hopefully, at least in my rasperry pi, pip seems to choose 1.5.4 instead of the latest versions. But it would be better to explicitly require python3-gpiod == 1.5.4.

BenjiU commented 4 months ago

Hi @chatziko,

could you please fix this one lint message, than I'll merge this PR :-) mqtt_io/modules/gpio/gpiod.py:23:0: R0902: Too many instance attributes (8/7) (too-many-instance-attributes)

Thank you!

chatziko commented 4 months ago

Done. I left flags_map as an attribute, to be consistent with the rest of the code (direction_map, interrupt_edge_map, etc). And just added pylint: disable=too-many-instance-attributes which is already used in a few other places, so I guess it's acceptable.