- find ${NAME} -name '*.py'| \
- grep -v -E '^testing/implementation/micropython*' | \
- grep -v -E '^testing/adafruit_blinka.py' | \
- xargs -n1 -I {} sh -c "echo Copying {} ...; ampy --port ${PORT} put {} {}"
-done
-
-cd ../../
-
-
-
-# I2C dependencies
-echo "Copying module adafruit_bus_device..."
-cd Adafruit_CircuitPython_BusDevice # change into different repo
-ampy --port ${PORT} mkdir --exists-okay adafruit_bus_device
-ampy --port ${PORT} put adafruit_bus_device/__init__.py adafruit_bus_device/__init__.py
-ampy --port ${PORT} put adafruit_bus_device/i2c_device.py adafruit_bus_device/i2c_device.py
-cd ../
-
-# Compile BME280 to bytecode
-./circuitpython_2.2.3/mpy-cross/mpy-cross Adafruit_CircuitPython_BME280/adafruit_bme280.py
-
-# BME280 dependencies
-echo "Copying module adafruit_bme..."
-cd Adafruit_CircuitPython_BME280 # change into different repo
-ampy --port ${PORT} put adafruit_bme280.mpy adafruit_bme280.mpy
-cd ../
+ cd ${SUBMODULE}
+ # create adafruit library directories on board
+ find . -mindepth 1 -type d | \
+ grep -v -E "(^./.git.*|__pycache__|^./doc.*|^./example.*)" | \
+ xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay {}"
+ # compile adafruit library .py files to .mpy
+ find . -type f -name '*.py' | \
+ grep -v -E "(^./conf.py|^./docs/conf.py|^./setup.py|^./example.*)" | \
+ xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}"
+ # upload adafruit library .mpy files
+ find . -type f -name '*.mpy' | \
+ xargs -n1 -I {} sh -c "echo uploading {} ...; ampy --port ${PORT} put {} {}"
+ cd ../
+done
\ No newline at end of file