Closed brettcvz closed 7 years ago
Totally going to merge this in. :)
Will probably update the code a bit to clean it up (after the merge) and make it work for everything since in the current form, it's very dependent upon the XIO and CSI pins.
Sounds good :) I already added it into the library locally for my purposes, glad you like it!
Ok, it took me a bit to get everything online as cleanup() broke on me again. I cleaned up your code and added a read_word() function so you can get 16 bits of data on one line.
For example, you can hook up to the 8 XIO pins and 8 CSID pins to read a word in just two calls:
GPIO.read_byte("XIO") + GPIO.read_byte("CSID") << 8
This is helpful for fast-changing inputs - in my case, reading from a 12-bit counter. By reading the bits one-by-one, I would get inaccurate readings because the counter would increment while I was trying to read the bits off. While not totally solving the problem, doing the iteration in C rather than python helps a lot, and is good enough for my needs.
I needed this for a project, so thought I would offer it back. If you don't want to incorporate this feature, no worries! If there are things you want to see improved/tweaked before merging, let me know.