Created
January 30, 2017 02:41
-
-
Save bwhitman/6046e02c77938e8b01e93fbb5ecc68f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read length data from a register, return the data | |
def read_register(register, length): | |
# To read a register you send reg & 0x80, and then read it back | |
# If you have blocking off the read will return none if it's too soon after | |
send_data = [0, register, 0x80, length, 0, 0, 0] | |
what = _dev.write(send_data) | |
ret = _dev.read(len(send_data) + length) | |
return ret[4:4+length] # Data comes in at the 4th byte |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment