yambs.uf2 package#

Module contents#

A module implementing interfaces for USB Flashing Format (UF2).

See microsoft/uf2.

class yambs.uf2.Block(addr)[source]#

Bases: object

A UF2 block.

encode(blockno: int, numblocks: int) bytes[source]#

Encode a block.

yambs.uf2.board_id(path, info_file: str = '/INFO_UF2.TXT') str | None[source]#

Get the board identifier.

yambs.uf2.convert_from_hex_to_uf2(buf: str) bytes[source]#

Create uf2 bytes from hex data.

yambs.uf2.convert_from_uf2(buf: bytes) bytes[source]#

Convert a uf2-formatted file into a regular one.

yambs.uf2.convert_to_carray(file_content: bytes) bytes[source]#

Create a C snippet that declares an array equivalent to raw file data.

yambs.uf2.convert_to_uf2(file_content: bytes) bytes[source]#

Convert a file to uf2.

yambs.uf2.get_drives(info_file: str = '/INFO_UF2.TXT') List[str][source]#

Get mountable drives.

yambs.uf2.is_hex(buf: bytes) bool[source]#

Determine if the provided buffer has a header that indicates it’s Intel HEX format.

yambs.uf2.is_uf2(buf: bytes) bool[source]#

Checks whether or not the provided buffer has the header magic bytes.

yambs.uf2.list_drives() None[source]#

Print drives.

yambs.uf2.load_families() Dict[str, int][source]#

The expectation is that the uf2families.json file is in the same directory as this script. Make a path that works using __file__ which contains the full path to this script.

yambs.uf2.to_str(data: bytes) str[source]#

Convert bytes to a string.

yambs.uf2.write_file(name: str, buf: bytes) None[source]#

Write the given buffer to a file with the given name.