4 # needs a git repo with micropython sharing a top-level directory
5 # where make has been run in the mpy-cross directory
7 # Compile unittest to bytecode
8 ../../micropython/mpy-cross/mpy-cross unittest.py
10 # filter directories, and create relevant ones on the board
11 find . -type d -mindepth 1 | \
12 grep -v -E "(^./.git|^./.idea|^./.vscode|__pycache__)" | \
13 xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay {}"
15 # put top-level .py modules in place
18 echo "Copying ${NAME}.py ..."
19 ampy --port ${PORT} put ${NAME}.py ${NAME}.py
22 # put top-level .mpy modules in place
25 echo "Copying ${NAME}.mpy ..."
26 ampy --port ${PORT} put ${NAME}.mpy ${NAME}.mpy
29 # recursively sync folders of nested packages
30 for NAME in board digitalio mcp microcontroller testing
32 find ${NAME} -name '*.py'| xargs -n1 -I {} sh -c "echo Copying {} ...; ampy --port ${PORT} put {} {}"
35 cd ../../ # change into folder containing repo
38 echo "Copying module adafruit_bus_device..."
39 cd Adafruit_CircuitPython_BusDevice # change into different repo
40 ampy --port ${PORT} mkdir --exists-okay adafruit_bus_device
41 ampy --port ${PORT} put adafruit_bus_device/__init__.py adafruit_bus_device/__init__.py
42 ampy --port ${PORT} put adafruit_bus_device/i2c_device.py adafruit_bus_device/i2c_device.py
45 # Compile BME280 to bytecode
46 ./micropython/mpy-cross/mpy-cross ./Adafruit_CircuitPython_BME280/adafruit_bme280.py
49 echo "Copying module adafruit_bme..."
50 cd Adafruit_CircuitPython_BME280 # change into different repo
51 ampy --port ${PORT} put adafruit_bme280.mpy adafruit_bme280.mpy