MCPcopy Create free account
hub / github.com/RetiredWizard/PyDOS / write

Method write

mpython/lib/sdcard.py:212–232  ·  view source on GitHub ↗
(self, token, buf)

Source from the content-addressed store, hash-verified

210 self.spi.write(b"\xff")
211
212 def write(self, token, buf):
213 self.cs(0)
214
215 # send: start of block, data, checksum
216 self.spi.read(1, token)
217 self.spi.write(buf)
218 self.spi.write(b"\xff")
219 self.spi.write(b"\xff")
220
221 # check the response
222 if (self.spi.read(1, 0xFF)[0] & 0x1F) != 0x05:
223 self.cs(1)
224 self.spi.write(b"\xff")
225 return
226
227 # wait for write to finish
228 while self.spi.read(1, 0xFF)[0] == 0:
229 pass
230
231 self.cs(1)
232 self.spi.write(b"\xff")
233
234 def write_token(self, token):
235 self.cs(0)

Callers 13

writeblocksMethod · 0.95
_write_cmdMethod · 0.45
_write_addrMethod · 0.45
get_sfdpMethod · 0.45
flash_writeMethod · 0.45
filecpyFunction · 0.45
init_cardMethod · 0.45
cmdMethod · 0.45
readintoMethod · 0.45
write_tokenMethod · 0.45
readblocksMethod · 0.45
__exit__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected