def bulkread(self, data=[], lengthR='<STR_LIT:None>', readmode=<NUM_LIT:1>):
<EOL>if (<NUM_LIT:1> > lengthR > <NUM_LIT>) | (len(data) > <NUM_LIT>):<EOL><INDENT>print(<EOL>'<STR_LIT>')<EOL>print('<STR_LIT>')<EOL>exit(<NUM_LIT:1>)<EOL><DEDENT>if (lengthR == '<STR_LIT:None>') & (readmode == <NUM_LIT:1>):<EOL><INDENT>lengthR = len(data)<EOL><DEDENT>commandW = <NUM_LIT> | (self.lsbfirst << <NUM_LIT:3>) | self.write_clock_ve<EOL>lengthW = len(data) - <NUM_LIT:1><EOL>len_lowW = (lengthW) & <NUM_LIT><EOL>len_highW = ((lengthW) >> <NUM_LIT:8>) & <NUM_LIT><EOL>commandR = <NUM_LIT> | (self.lsbfirst << <NUM_LIT:3>) | (self.read_clock_ve << <NUM_LIT:2>)<EOL>length = lengthR<EOL>if lengthR % <NUM_LIT:2> == <NUM_LIT:1>:<EOL><INDENT>length += <NUM_LIT:1><EOL><DEDENT>length = length/<NUM_LIT:2><EOL>lenremain = lengthR - length<EOL>len_lowR = (length - <NUM_LIT:1>) & <NUM_LIT><EOL>len_highR = ((length - <NUM_LIT:1>) >> <NUM_LIT:8>) & <NUM_LIT><EOL>logger.debug(<EOL>'<STR_LIT>'.format(commandW))<EOL>logger.debug('<STR_LIT>'.format(commandR))<EOL>self._assert_cs()<EOL>self._ft232h._write(str(bytearray((commandW, len_lowW, len_highW))))<EOL>self._ft232h._write(str(bytearray(data)))<EOL>self._ft232h._write(str(bytearray((commandR, len_lowR, len_highR))))<EOL>payload1 = self._ft232h._poll_read(length)<EOL>self._ft232h._write(str(bytearray((commandR, len_lowR, len_highR))))<EOL>payload2 = self._ft232h._poll_read(lenremain)<EOL>self._deassert_cs()<EOL>return bytearray(payload1 + payload2)<EOL>
Half-duplex SPI write then read. Send command and payload to slave as bytearray
            then consequently read out response from the slave for length in bytes.
        Designed for use with NOR or NAND flash chips, and possibly SD cards...etc...
        Read command is cut in half and performed twice in series to prevent single byte errors.
        Hardware limits per command are enforced before doing anything.
        Read length is an optional argument, so that it can function similar to transfer
            but still half-duplex.
        For reading without writing, one can send a blank array or skip that argument.