Beispiel #1
0
 def getFlag(self):
     flag = b''
     with spi.SPIDevice(0) as spi0:
         # Get only first char
         spi0.transaction(
             spi.writing_bytes(ord('_')))
         sleep(0.5)
         while 1: 
             raw = spi0.transaction(spi.reading(1))
             #print(raw)
             c = raw[0]
             if c == b'\x00':
                 break
             flag += c
         print(flag)
Beispiel #2
0
 def read(self):
     '''Reads 32 bits of the SPI bus for processing and stores as 32-bit bitstring.'''
     raw_spi = self.spi.transaction(Spibus.reading(4))
     self.data = Bits(bytes=raw_spi[0], length=32)
     self.checkErrors()