We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi I found the following bug:
from pyftdi.bits import BitSequence value1 = '002' # hex length = 3*4 print(value1) int1 = int(value1,16) print(int1) bin1 = bin(int1) print(bin1) print(bin1[2:]) ans1 = BitSequence(bin1[2:], msb=True, length=length) print(ans1) value2 = '200' # hex length = 3*4 print(value2) int2 = int(value2,16) print(int2) bin2 = bin(int2) print(bin2) print(bin2[2:]) ans2 = BitSequence(bin2[2:], msb=True, length=length) print(ans2)
The output is a litte bit confusing...
002 2 0b10 10 12: 1000 00000000 200 512 0b1000000000 1000000000 12: 1000 00000000
I think this is the same issue like: #245
The text was updated successfully, but these errors were encountered:
I found a solution to convert a hex value into a binary with padded zeros:
def hex_to_bits(value:str, length=None, padded_zeros=True) -> str: if length == None: length = len(value)*4 ret = bin(int(value,16))[2:] if padded_zeros == True: ret = ret.rjust(length, '0') return ret
Sorry, something went wrong.
No branches or pull requests
Hi I found the following bug:
The output is a litte bit confusing...
I think this is the same issue like: #245
The text was updated successfully, but these errors were encountered: