PEP8 radio/util/fat12.py
Fix indentation and whitespace
This commit is contained in:
+37
-32
@@ -6,47 +6,52 @@ curr = 0
|
|||||||
idx = 0
|
idx = 0
|
||||||
byte = 0
|
byte = 0
|
||||||
|
|
||||||
|
|
||||||
def push4bits(val):
|
def push4bits(val):
|
||||||
global curr, idx, byte
|
global curr, idx, byte
|
||||||
val = val & 0x0f
|
val = val & 0x0f
|
||||||
curr += val << idx
|
curr += val << idx
|
||||||
idx += 4
|
idx += 4
|
||||||
if idx == 8:
|
if idx == 8:
|
||||||
print("0x%02X," % curr, end=' ')
|
print("0x%02X," % curr, end=' ')
|
||||||
idx = 0
|
idx = 0
|
||||||
curr = 0
|
curr = 0
|
||||||
byte += 1
|
byte += 1
|
||||||
if byte % 16 == 0:
|
if byte % 16 == 0:
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
|
||||||
cluster = 0
|
cluster = 0
|
||||||
|
|
||||||
|
|
||||||
def pushCluster(val):
|
def pushCluster(val):
|
||||||
global cluster
|
global cluster
|
||||||
push4bits(val)
|
push4bits(val)
|
||||||
push4bits(val >> 4)
|
push4bits(val >> 4)
|
||||||
push4bits(val >> 8)
|
push4bits(val >> 8)
|
||||||
cluster += 1
|
cluster += 1
|
||||||
|
|
||||||
|
|
||||||
def pushFile(size):
|
def pushFile(size):
|
||||||
sectors = size // 512
|
sectors = size // 512
|
||||||
count = sectors // 8
|
count = sectors // 8
|
||||||
for i in range(count-1):
|
for i in range(count - 1):
|
||||||
pushCluster(cluster+1)
|
pushCluster(cluster + 1)
|
||||||
pushCluster(0xFFF)
|
pushCluster(0xFFF)
|
||||||
|
|
||||||
|
|
||||||
def pushDisk(eeprom, flash):
|
def pushDisk(eeprom, flash):
|
||||||
global curr, idx, byte, cluster
|
global curr, idx, byte, cluster
|
||||||
curr = idx = byte = cluster = 0
|
curr = idx = byte = cluster = 0
|
||||||
print("Disk with %dk EEPROM and %dk FLASH:" % (eeprom, flash))
|
print("Disk with %dk EEPROM and %dk FLASH:" % (eeprom, flash))
|
||||||
pushCluster(0xFF8)
|
pushCluster(0xFF8)
|
||||||
pushCluster(0xFFF)
|
pushCluster(0xFFF)
|
||||||
pushFile(eeprom*1024)
|
pushFile(eeprom * 1024)
|
||||||
pushFile(flash*1024)
|
pushFile(flash * 1024)
|
||||||
while byte < 512:
|
while byte < 512:
|
||||||
push4bits(0)
|
push4bits(0)
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
|
||||||
pushDisk(32, 512)
|
pushDisk(32, 512)
|
||||||
pushDisk(64, 512)
|
pushDisk(64, 512)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user