diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index 9e70ff89..fca6a18f 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -7,7 +7,7 @@ on: types: [created] env: - MICROPYTHON_VERSION: 856e08b1931b88271816a2f60648f6ff332235b2 + MICROPYTHON_VERSION: v1.21.0 WORKFLOW_VERSION: v1 jobs: @@ -69,9 +69,9 @@ jobs: matrix: include: - name: pico - board: PICO + board: RPI_PICO - name: picow - board: PICO_W + board: RPI_PICO_W - name: tiny2040 board: PIMORONI_TINY2040 - name: picolipo_4mb @@ -84,11 +84,11 @@ jobs: board: PICO_W_ENVIRO patch: true - name: galactic_unicorn - board: PICO_W + board: RPI_PICO_W - name: cosmic_unicorn - board: PICO_W + board: RPI_PICO_W - name: stellar_unicorn - board: PICO_W + board: RPI_PICO_W - name: inky_frame board: PICO_W_INKY patch: true diff --git a/micropython/board/PICO_W_ENVIRO/mpconfigboard.cmake b/micropython/board/PICO_W_ENVIRO/mpconfigboard.cmake index 4644016a..c6399e33 100644 --- a/micropython/board/PICO_W_ENVIRO/mpconfigboard.cmake +++ b/micropython/board/PICO_W_ENVIRO/mpconfigboard.cmake @@ -1,5 +1,6 @@ # cmake file for Pimoroni Enviro with Raspberry Pi Pico W -set(MICROPY_BOARD PICO_W) +set(MICROPY_BOARD RPI_PICO_W) +set(PICO_BOARD "pico_w") # The C malloc is needed by cyw43-driver Bluetooth and Pimoroni Pico modules set(MICROPY_C_HEAP_SIZE 4096) diff --git a/micropython/board/PICO_W_INKY/manifest.py b/micropython/board/PICO_W_INKY/manifest.py index 17514700..77511bf9 100644 --- a/micropython/board/PICO_W_INKY/manifest.py +++ b/micropython/board/PICO_W_INKY/manifest.py @@ -5,6 +5,9 @@ require("bundle-networking") require("urllib.urequest") require("umqtt.simple") +# SD Card +require("sdcard") + # Bluetooth require("aioble") diff --git a/micropython/board/PICO_W_INKY/mpconfigboard.cmake b/micropython/board/PICO_W_INKY/mpconfigboard.cmake index e06f0cb7..7feece04 100644 --- a/micropython/board/PICO_W_INKY/mpconfigboard.cmake +++ b/micropython/board/PICO_W_INKY/mpconfigboard.cmake @@ -1,5 +1,6 @@ # cmake file for Pimoroni Inky with Raspberry Pi Pico W -set(MICROPY_BOARD PICO_W) +set(MICROPY_BOARD RPI_PICO_W) +set(PICO_BOARD "pico_w") # The C malloc is needed by cyw43-driver Bluetooth and Pimoroni Pico modules set(MICROPY_C_HEAP_SIZE 4096) diff --git a/micropython/board/PICO/board.json b/micropython/board/RPI_PICO/board.json similarity index 100% rename from micropython/board/PICO/board.json rename to micropython/board/RPI_PICO/board.json diff --git a/micropython/board/PICO/manifest.py b/micropython/board/RPI_PICO/manifest.py similarity index 100% rename from micropython/board/PICO/manifest.py rename to micropython/board/RPI_PICO/manifest.py diff --git a/micropython/board/PICO/mpconfigboard.cmake b/micropython/board/RPI_PICO/mpconfigboard.cmake similarity index 73% rename from micropython/board/PICO/mpconfigboard.cmake rename to micropython/board/RPI_PICO/mpconfigboard.cmake index 4ec156b0..c89ff780 100644 --- a/micropython/board/PICO/mpconfigboard.cmake +++ b/micropython/board/RPI_PICO/mpconfigboard.cmake @@ -1,4 +1,5 @@ # cmake file for Raspberry Pi Pico +set(PICO_BOARD "pico") # Board specific version of the frozen manifest set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py) diff --git a/micropython/board/PICO/mpconfigboard.h b/micropython/board/RPI_PICO/mpconfigboard.h similarity index 100% rename from micropython/board/PICO/mpconfigboard.h rename to micropython/board/RPI_PICO/mpconfigboard.h diff --git a/micropython/board/PICO/pins.csv b/micropython/board/RPI_PICO/pins.csv similarity index 100% rename from micropython/board/PICO/pins.csv rename to micropython/board/RPI_PICO/pins.csv diff --git a/micropython/board/PICO_W/board.json b/micropython/board/RPI_PICO_W/board.json similarity index 100% rename from micropython/board/PICO_W/board.json rename to micropython/board/RPI_PICO_W/board.json diff --git a/micropython/board/PICO_W/manifest.py b/micropython/board/RPI_PICO_W/manifest.py similarity index 63% rename from micropython/board/PICO_W/manifest.py rename to micropython/board/RPI_PICO_W/manifest.py index 95782f97..8bf382da 100644 --- a/micropython/board/PICO_W/manifest.py +++ b/micropython/board/RPI_PICO_W/manifest.py @@ -2,6 +2,9 @@ include("$(PORT_DIR)/boards/manifest.py") require("bundle-networking") +# SD Card +require("sdcard") + # Bluetooth require("aioble") diff --git a/micropython/board/PICO_W/mpconfigboard.cmake b/micropython/board/RPI_PICO_W/mpconfigboard.cmake similarity index 80% rename from micropython/board/PICO_W/mpconfigboard.cmake rename to micropython/board/RPI_PICO_W/mpconfigboard.cmake index 9182e843..ef975156 100644 --- a/micropython/board/PICO_W/mpconfigboard.cmake +++ b/micropython/board/RPI_PICO_W/mpconfigboard.cmake @@ -1,4 +1,5 @@ # cmake file for Raspberry Pi Pico W +set(PICO_BOARD "pico_w") # The C malloc is needed by cyw43-driver Bluetooth and Pimoroni Pico modules set(MICROPY_C_HEAP_SIZE 4096) diff --git a/micropython/board/PICO_W/mpconfigboard.h b/micropython/board/RPI_PICO_W/mpconfigboard.h similarity index 100% rename from micropython/board/PICO_W/mpconfigboard.h rename to micropython/board/RPI_PICO_W/mpconfigboard.h diff --git a/micropython/board/PICO_W/pins.csv b/micropython/board/RPI_PICO_W/pins.csv similarity index 100% rename from micropython/board/PICO_W/pins.csv rename to micropython/board/RPI_PICO_W/pins.csv diff --git a/micropython/examples/common/lib/sdcard.mpy b/micropython/examples/common/lib/sdcard.mpy deleted file mode 100644 index 7f3fd6bd..00000000 Binary files a/micropython/examples/common/lib/sdcard.mpy and /dev/null differ diff --git a/micropython/examples/inky_frame/README.md b/micropython/examples/inky_frame/README.md index 1420d0e1..7f4c5bea 100644 --- a/micropython/examples/inky_frame/README.md +++ b/micropython/examples/inky_frame/README.md @@ -27,10 +27,6 @@ The wireless examples need `network_manager.py` and `WIFI_CONFIG.py` from the `c You'll also need to install the `micropython-urllib.urequest` library using Thonny's 'Tools' > 'Manage Packages' or `common/lib/urllib` which contains a compiled `.mpy` version that uses less RAM. You should place this directory in `lib` on your Pico W. -Finally for examples loading images, you'll need `sdcard.mpy` from `common/lib`. You should place this file in `lib` on your Pico W. - -- [/micropython/examples/common](../common) - ### Button Test [button_test.py](button_test.py) diff --git a/micropython/examples/inky_frame/image_gallery/README.md b/micropython/examples/inky_frame/image_gallery/README.md index b31b62d9..4974775d 100644 --- a/micropython/examples/inky_frame/image_gallery/README.md +++ b/micropython/examples/inky_frame/image_gallery/README.md @@ -24,11 +24,18 @@ Copy the images to your Pico W using Thonny. ### image_gallery_sd.py / image_gallery_sd_random.py -Pop an SD card into your computer to copy the images across. (Alternatively, you can transfer them using Thonny, but you will have to mount the SD card using the REPL first). +Pop an SD card into your computer to copy the images across. -The SD card examples require `sdcard.mpy` from `common/lib` - copy this file into the `lib` directory on your Pico W. +Alternatively, you can transfer them using Thonny, but you will have to mount the SD card using the REPL first: -- [/micropython/examples/common](../../common) +```python +import os +import sdcard +from machine import Pin +sd_spi = SPI(0, sck=Pin(18, Pin.OUT), mosi=Pin(19, Pin.OUT), miso=Pin(16, Pin.OUT)) +sd = sdcard.SDCard(sd_spi, Pin(22)) +os.mount(sd, "/sd") +``` ## Image Credits