diff options
author | Damien George <damien.p.george@gmail.com> | 2020-02-27 15:36:53 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-02-28 10:33:03 +1100 |
commit | 69661f3343bedf86e514337cff63d96cc42f8859 (patch) | |
tree | af5dfb380ffdb75dda84828f63cf9d840d992f0f /ports/esp8266/modules/flashbdev.py | |
parent | 3f39d18c2b884d32f0443e2e8114ff9d7a14d718 (diff) |
all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
Diffstat (limited to 'ports/esp8266/modules/flashbdev.py')
-rw-r--r-- | ports/esp8266/modules/flashbdev.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ports/esp8266/modules/flashbdev.py b/ports/esp8266/modules/flashbdev.py index 4273b2639..404cf3666 100644 --- a/ports/esp8266/modules/flashbdev.py +++ b/ports/esp8266/modules/flashbdev.py @@ -1,29 +1,30 @@ import esp + class FlashBdev: SEC_SIZE = 4096 RESERVED_SECS = 1 START_SEC = esp.flash_user_start() // SEC_SIZE + RESERVED_SECS - NUM_BLK = 0x6b - RESERVED_SECS + NUM_BLK = 0x6B - RESERVED_SECS def __init__(self, blocks=NUM_BLK): self.blocks = blocks def readblocks(self, n, buf, off=0): - #print("readblocks(%s, %x(%d), %d)" % (n, id(buf), len(buf), off)) + # print("readblocks(%s, %x(%d), %d)" % (n, id(buf), len(buf), off)) esp.flash_read((n + self.START_SEC) * self.SEC_SIZE + off, buf) def writeblocks(self, n, buf, off=None): - #print("writeblocks(%s, %x(%d), %d)" % (n, id(buf), len(buf), off)) - #assert len(buf) <= self.SEC_SIZE, len(buf) + # print("writeblocks(%s, %x(%d), %d)" % (n, id(buf), len(buf), off)) + # assert len(buf) <= self.SEC_SIZE, len(buf) if off is None: esp.flash_erase(n + self.START_SEC) off = 0 esp.flash_write((n + self.START_SEC) * self.SEC_SIZE + off, buf) def ioctl(self, op, arg): - #print("ioctl(%d, %r)" % (op, arg)) + # print("ioctl(%d, %r)" % (op, arg)) if op == 4: # MP_BLOCKDEV_IOCTL_BLOCK_COUNT return self.blocks if op == 5: # MP_BLOCKDEV_IOCTL_BLOCK_SIZE @@ -32,8 +33,9 @@ class FlashBdev: esp.flash_erase(arg + self.START_SEC) return 0 + size = esp.flash_size() -if size < 1024*1024: +if size < 1024 * 1024: bdev = None else: # 20K at the flash end is reserved for SDK params storage |