MCPcopy Create free account
hub / github.com/Santroller/Santroller / decode_uf2

Function decode_uf2

build.py:45–56  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

43 return data
44
45def decode_uf2(data):
46 while data:
47 block, data = data[:512], data[512:]
48 block = struct.unpack(block_format, block)
49
50 header, body, footer = block[:8], block[8:-1], block[-1:]
51 assert (header[:2], footer) == ((magic0, magic1), (magic2,))
52
53 block = Uf2Block(*header[2:])
54 block.data = bytes(body[:block.size])
55
56 yield block
57
58def write_uf2(blocks, name):
59 with open(name, "wb") as f:

Callers 1

build.pyFile · 0.85

Calls 1

Uf2BlockClass · 0.85

Tested by

no test coverage detected