MCPcopy Create free account
hub / github.com/bitcraze/crazyflie-lib-python / upload_buffer

Method upload_buffer

cflib/bootloader/cloader.py:313–334  ·  view source on GitHub ↗

Upload data into a buffer on the Crazyflie

(self, target_id, page, address, buff)

Source from the content-addressed store, hash-verified

311 page += m[(2 * i) + 1]
312
313 def upload_buffer(self, target_id, page, address, buff):
314 """Upload data into a buffer on the Crazyflie"""
315 # print len(buff)
316 count = 0
317 pk = CRTPPacket()
318 pk.set_header(0xFF, 0xFF)
319 pk.data = struct.pack('=BBHH', target_id, 0x14, page, address)
320
321 for i in range(0, len(buff)):
322 pk.data.append(buff[i])
323
324 count += 1
325
326 if count > 24:
327 self.link.send_packet(pk)
328 count = 0
329 pk = CRTPPacket()
330 pk.set_header(0xFF, 0xFF)
331 pk.data = struct.pack('=BBHH', target_id, 0x14, page,
332 i + address + 1)
333
334 self.link.send_packet(pk)
335
336 def read_flash(self, addr=0xFF, page=0x00):
337 """Read back a flash page from the Crazyflie and return it"""

Callers 1

_internal_flashMethod · 0.80

Calls 3

set_headerMethod · 0.95
CRTPPacketClass · 0.90
send_packetMethod · 0.45

Tested by

no test coverage detected