Rev 4566 Rev 4567
Line 123... Line 123...
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 data = self.spi.readbytes(2) # 1st byte
129 self.spi.xfer([0x00]) 129 #self.spi.xfer([0x00])
130 data1 = spi.SPI_read_byte() # 2nd byte 130 #data1 = self.spi.readbytes(1) # 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 = (data[0] >> (bit - 8)) & 1
134 else: 134 else:
135 OutputBit = (data1 >> bit) & 1 135 OutputBit = (data[1] >> bit) & 1
136 return OutputBit 136 return OutputBit
137   137  
138 138
139 def IsBusy(self): 139 def IsBusy(self):
140 """ Return True if tehre are motion """ 140 """ Return True if tehre are motion """