Line 117... |
Line 117... |
117 |
while self.IsBusy(): |
117 |
while self.IsBusy(): |
118 |
pass |
118 |
pass |
119 |
|
119 |
|
120 |
def Float(self): |
120 |
def Float(self): |
121 |
' switch H-bridge to High impedance state ' |
121 |
' switch H-bridge to High impedance state ' |
122 |
self.spi.xfer( 0xA0) |
122 |
self.spi.xfer([0xA0]) |
123 |
|
123 |
|
124 |
def ReadStatusBit(self, bit): |
124 |
def ReadStatusBit(self, bit): |
125 |
' Report given status bit ' |
125 |
' Report given status bit ' |
126 |
self.spi.xfer( 0x39) # Read from address 0x19 (STATUS) |
126 |
self.spi.xfer([0x39]) # Read from address 0x19 (STATUS) |
127 |
self.spi.xfer( 0x00) |
127 |
self.spi.xfer([0x00]) |
128 |
data0 = spi.SPI_read_byte() # 1st byte |
128 |
data0 = spi.SPI_read_byte() # 1st byte |
129 |
self.spi.xfer( 0x00) |
129 |
self.spi.xfer([0x00]) |
130 |
data1 = spi.SPI_read_byte() # 2nd byte |
130 |
data1 = spi.SPI_read_byte() # 2nd byte |
131 |
#print hex(data0), hex(data1) |
131 |
#print hex(data0), hex(data1) |
132 |
if bit > 7: # extract requested bit |
132 |
if bit > 7: # extract requested bit |
133 |
OutputBit = (data0 >> (bit - 8)) & 1 |
133 |
OutputBit = (data0 >> (bit - 8)) & 1 |
134 |
else: |
134 |
else: |