Skip to content
This repository was archived by the owner on Sep 30, 2019. It is now read-only.

Commit aba58cb

Browse files
author
mpratt14
authored
Formatting and Indentation fix
1 parent 63df8b9 commit aba58cb

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

Adafruit_GPIO/FT232H.py

+34-34
Original file line numberDiff line numberDiff line change
@@ -481,21 +481,21 @@ def write(self, data):
481481
# Compute length low and high bytes.
482482
# NOTE: Must actually send length minus one because the MPSSE engine
483483
# considers 0 a length of 1 and FFFF a length of 65536
484-
# splitting into two lists for two commands to prevent buffer errors
485-
data1 = data[:len(data)/2]
486-
data2 = data[len(data)/2:]
484+
# splitting into two lists for two commands to prevent buffer errors
485+
data1 = data[:len(data)/2]
486+
data2 = data[len(data)/2:]
487487
len_low1 = (len(data1) - 1) & 0xFF
488488
len_high1 = ((len(data1) - 1) >> 8) & 0xFF
489-
len_low2 = (len(data2) - 1) & 0xFF
489+
len_low2 = (len(data2) - 1) & 0xFF
490490
len_high2 = ((len(data2) - 1) >> 8) & 0xFF
491491
self._assert_cs()
492492
# Send command and length, then data, split into two commands, handle for length 1
493-
if len(data1) > 0:
493+
if len(data1) > 0:
494494
self._ft232h._write(str(bytearray((command, len_low1, len_high1))))
495495
self._ft232h._write(str(bytearray(data1)))
496496
if len(data2) > 0:
497-
self._ft232h._write(str(bytearray((command, len_low2, len_high2))))
498-
self._ft232h._write(str(bytearray(data2)))
497+
self._ft232h._write(str(bytearray((command, len_low2, len_high2))))
498+
self._ft232h._write(str(bytearray(data2)))
499499
self._deassert_cs()
500500

501501
def read(self, length):
@@ -513,13 +513,13 @@ def read(self, length):
513513
# Compute length low and high bytes.
514514
# NOTE: Must actually send length minus one because the MPSSE engine
515515
# considers 0 a length of 1 and FFFF a length of 65536
516-
#force odd numbers to round up instead of down
517-
lengthR = length
518-
if length % 2 == 1:
519-
lengthR += 1
520-
lengthR = lengthR/2
521-
#when odd length requested, get the remainder instead of the same number
522-
lenremain = length - lengthR
516+
#force odd numbers to round up instead of down
517+
lengthR = length
518+
if length % 2 == 1:
519+
lengthR += 1
520+
lengthR = lengthR/2
521+
#when odd length requested, get the remainder instead of the same number
522+
lenremain = length - lengthR
523523
len_low = (lengthR - 1) & 0xFF
524524
len_high = ((lengthR - 1) >> 8) & 0xFF
525525
self._assert_cs()
@@ -559,12 +559,12 @@ def bulkread(self, data = [], lengthR = 'None', readmode = 1):
559559
len_highW = ((lengthW) >> 8) & 0xFF
560560
commandR = 0x20 | (self.lsbfirst << 3) | (self.read_clock_ve << 2)
561561
#force odd numbers to round up instead of down
562-
length = lengthR
563-
if lengthR % 2 == 1:
564-
length += 1
565-
length = length/2
562+
length = lengthR
563+
if lengthR % 2 == 1:
564+
length += 1
565+
length = length/2
566566
#when odd length requested, get the remainder instead of the same number
567-
lenremain = lengthR - length
567+
lenremain = lengthR - length
568568
len_lowR = (length - 1) & 0xFF
569569
len_highR = ((length - 1) >> 8) & 0xFF
570570
#logger debug info
@@ -602,25 +602,25 @@ def transfer(self, data):
602602
# NOTE: Must actually send length minus one because the MPSSE engine
603603
# considers 0 a length of 1 and FFFF a length of 65536
604604
data1 = data[:len(data)/2]
605-
data2 = data[len(data)/2:]
606-
len_low1 = (len(data1) - 1) & 0xFF
605+
data2 = data[len(data)/2:]
606+
len_low1 = (len(data1) - 1) & 0xFF
607607
len_high1 = ((len(data1) - 1) >> 8) & 0xFF
608-
len_low2 = (len(data2) - 1) & 0xFF
608+
len_low2 = (len(data2) - 1) & 0xFF
609609
len_high2 = ((len(data2) - 1) >> 8) & 0xFF
610-
payload1 = ''
611-
payload2 = ''
612-
#start command set
610+
payload1 = ''
611+
payload2 = ''
612+
#start command set
613613
self._assert_cs()
614614
# Perform twice to prevent error from hardware defect/limits
615-
# Send command and length, then data, split into two commands, handle for length 1
616-
if len(data1) > 0:
617-
self._ft232h._write(str(bytearray((command, len_low1, len_high1))))
618-
self._ft232h._write(str(bytearray(data1)))
619-
payload1 = self._ft232h._poll_read(len(data1))
620-
if len(data2) > 0:
621-
self._ft232h._write(str(bytearray((command, len_low2, len_high2))))
622-
self._ft232h._write(str(bytearray(data2)))
623-
payload2 = self._ft232h._poll_read(len(data2))
615+
# Send command and length, then data, split into two commands, handle for length 1
616+
if len(data1) > 0:
617+
self._ft232h._write(str(bytearray((command, len_low1, len_high1))))
618+
self._ft232h._write(str(bytearray(data1)))
619+
payload1 = self._ft232h._poll_read(len(data1))
620+
if len(data2) > 0:
621+
self._ft232h._write(str(bytearray((command, len_low2, len_high2))))
622+
self._ft232h._write(str(bytearray(data2)))
623+
payload2 = self._ft232h._poll_read(len(data2))
624624
#self._ft232h._write('\x87')
625625
self._deassert_cs()
626626
# Read response bytes.

0 commit comments

Comments
 (0)