Skip to content

Instantly share code, notes, and snippets.

View andrewleech's full-sized avatar

Andrew Leech andrewleech

View GitHub Profile
@andrewleech
andrewleech / fsbuilder.py
Created September 15, 2022 21:47
Building a canned filesystem dfu for micropython
"""
MicroPython filesystem builder.
Example usage (build micropython-dev using make VARIANT=dev in the unix port):
micropython-dev -X heapsize=10m fsbuilder.py 4096 512 lfs2 directory/
This will create an image "directory.img" which can then be deployed to a device.
To turn it into a DFU file use (dfu.py can be found in MicroPython tools/):
@andrewleech
andrewleech / util.py
Created September 2, 2019 07:07
ble advertising data example
BLE_GAP_AD_TYPE_FLAGS = 0x01 # Flags for discoverability.
BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_MORE_AVAILABLE = 0x02 # Partial list of 16 bit service UUIDs.
BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_COMPLETE = 0x03 # Complete list of 16 bit service UUIDs.
BLE_GAP_AD_TYPE_32BIT_SERVICE_UUID_MORE_AVAILABLE = 0x04 # Partial list of 32 bit service UUIDs.
BLE_GAP_AD_TYPE_32BIT_SERVICE_UUID_COMPLETE = 0x05 # Complete list of 32 bit service UUIDs.
BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_MORE_AVAILABLE = 0x06 # Partial list of 128 bit service UUIDs.
BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_COMPLETE = 0x07 # Complete list of 128 bit service UUIDs.
BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME = 0x08 # Short local device name.