/Modules/H_Bridge/HBSTEP01B/SW/DIRECT_SPI_HBSTEP_test.py
125,14 → 125,14
' Report given status bit '
self.spi.xfer([0x39]) # Read from address 0x19 (STATUS)
self.spi.xfer([0x00])
data0 = spi.SPI_read_byte() # 1st byte
self.spi.xfer([0x00])
data1 = spi.SPI_read_byte() # 2nd byte
data = self.spi.readbytes(2) # 1st byte
#self.spi.xfer([0x00])
#data1 = self.spi.readbytes(1) # 2nd byte
#print hex(data0), hex(data1)
if bit > 7: # extract requested bit
OutputBit = (data0 >> (bit - 8)) & 1
OutputBit = (data[0] >> (bit - 8)) & 1
else:
OutputBit = (data1 >> bit) & 1
OutputBit = (data[1] >> bit) & 1
return OutputBit