vsergeev / python-periphery

A pure Python 2/3 library for peripheral I/O (GPIO, LED, PWM, SPI, I2C, MMIO, Serial) in Linux.
MIT License
529 stars 139 forks source link

Fix gpio edge interrupts #7

Closed jakogut closed 7 years ago

jakogut commented 7 years ago

When I tried the edge polling code based on select.poll(), it seemed to always return True, and never block. I tried how RPi.GPIO did it with select.epoll(), and it seems to work better.

jakogut commented 7 years ago

@vsergeev I don't know if this fits within the scope of periphery, but using the fixed GPIO polling, I made a pure Python module to interface with RFID readers using the Wiegand 26-bit interface. Here's a paste of it: https://gist.github.com/jakogut/495e33dcee9f90efb79e6c6f2ced3583

vsergeev commented 7 years ago

@jakogut that's a good question. I think it'd be prudent to limit python-periphery's scope to just Linux API's for I/O (e.g. various dev and sysfs interfaces) to reduce churn and ensure stability. But I wonder if there could be something like a python-periphery-drivers for drivers like yours built on these abstractions. It'd be pretty compelling to collect a set of drivers for various SPI, I2C, etc. widgets over time that are pure Python, hardware agnostic, with consistent APIs, and tested. People have written so many one-offs of varying quality for the same stuff. But some groups already have a bunch of drivers (Adafruit, ControlEverythingCommunity, etc.). All of the ad-hoc repos seem like they're difficult to maintain, but I can imagine one big repo might also be annoying outside of prototyping. What do you think?

jakogut commented 7 years ago

I think you've summed up the situation pretty well. I do think a separate project would better suit drivers built on top of the sysfs interface.