Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: pimoroni/pico-boilerplate
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.0.1
Choose a base ref
...
head repository: pimoroni/pico-boilerplate
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 19 commits
  • 7 files changed
  • 5 contributors

Commits on Jan 25, 2021

  1. Include SDK import for #3

    Gadgetoid committed Jan 25, 2021
    Copy the full SHA
    023b356 View commit details
  2. Copy the full SHA
    802a87c View commit details
  3. Copy the full SHA
    57b8c48 View commit details
  4. Merge pull request #4 from pimoroni/patch-sdk-import

    Include pico_sdk_import.cmake and update workflow accordingly
    Gadgetoid authored Jan 25, 2021
    Copy the full SHA
    a879d98 View commit details

Commits on Jan 26, 2021

  1. Copy the full SHA
    9add6e5 View commit details
  2. Merge pull request #5 from lurch/patch-1

    Fix case-typo in setting name
    Gadgetoid authored Jan 26, 2021
    Copy the full SHA
    5c1648b View commit details

Commits on Feb 17, 2021

  1. Copy the full SHA
    f0de228 View commit details
  2. Merge pull request #7 from pimoroni/patch-drop-backlight-control

    Drop set_backlight from main.cpp for #6
    Gadgetoid authored Feb 17, 2021
    Copy the full SHA
    3cd1026 View commit details

Commits on Jun 17, 2021

  1. Set up Pimoroni Pico include paths for #8

    Add the base Pimoroni Pico path to the include directories and CMake module search paths
    Gadgetoid committed Jun 17, 2021
    Copy the full SHA
    79513f7 View commit details
  2. Merge pull request #9 from pimoroni/patch-pimoroni-include-directories

    Set up Pimoroni Pico include paths for #8
    Gadgetoid authored Jun 17, 2021
    Copy the full SHA
    dd03c9f View commit details

Commits on Feb 10, 2022

  1. Add Pimoroni I2C

    Gadgetoid committed Feb 10, 2022
    Copy the full SHA
    7d8b69e View commit details
  2. Merge pull request #10 from pimoroni/patch-pimoroni-i2c

    Add Pimoroni I2C
    Gadgetoid authored Feb 10, 2022
    Copy the full SHA
    d2f4875 View commit details

Commits on Dec 16, 2022

  1. Copy the full SHA
    4a76009 View commit details
  2. Copy the full SHA
    89224fd View commit details
  3. Merge pull request #14 from pimoroni/patch-sync-pico-sdk-import

    Pico SDK Import: Sync with upstream fixes.
    Gadgetoid authored Dec 16, 2022
    Copy the full SHA
    4c0cd63 View commit details

Commits on Jan 30, 2024

  1. Update to latest pimoroni pico import

    MichaelBell committed Jan 30, 2024
    Copy the full SHA
    0467f96 View commit details

Commits on Feb 9, 2024

  1. Updated checkout action in workflow to v3, to kill warnings

    ahnlak authored and Gadgetoid committed Feb 9, 2024
    Copy the full SHA
    0af3b92 View commit details
  2. Merge pull request #19 from pimoroni/action-version-fix

    Action version fix
    Gadgetoid authored Feb 9, 2024
    Copy the full SHA
    301f550 View commit details
  3. Merge pull request #18 from MichaelBell/fix-update-import

    Update to latest pimoroni pico import cmake file
    Gadgetoid authored Feb 9, 2024
    Copy the full SHA
    4ac6796 View commit details
Showing with 153 additions and 39 deletions.
  1. +5 −13 .github/workflows/cmake.yml
  2. +2 −2 .vscode/launch.json
  3. +8 −5 CMakeLists.txt
  4. +1 −7 README.md
  5. +8 −12 main.cpp
  6. +73 −0 pico_sdk_import.cmake
  7. +56 −0 pimoroni_pico_import.cmake
18 changes: 5 additions & 13 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ jobs:
- os: ubuntu-20.04
name: Linux
cache-key: linux
cmake-args: '-DPICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install'
cmake-args: '-DPIMORONI_PICO_PATH=$GITHUB_WORKSPACE/pimoroni-pico -DPICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install'
apt-packages: clang-tidy gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib

runs-on: ${{matrix.os}}
@@ -31,33 +31,25 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: project

# Checkout the Pimoroni Pico Libraries
- name: Checkout Pimoroni Pico Libraries
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: pimoroni/pimoroni-pico
path: pimoroni-pico

# Checkout the Pico SDK
- name: Checkout Pico SDK
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: raspberrypi/pico-sdk
path: pico-sdk
submodules: true

# Link the Pico SDK via pico_sdk_import.cmake
- name: Link the Pico SDK to our proejct
shell: bash
working-directory: ${{github.workspace}}/project
run: |
rm -f pico_sdk_import.cmake
ln -s ../pico-sdk/external/pico_sdk_import.cmake pico_sdk_import.cmake
# Linux deps
- name: Install deps
if: runner.os == 'Linux'
@@ -105,4 +97,4 @@ jobs:
asset_path: ${{runner.workspace}}/build/${{env.RELEASE_FILE}}.tar.gz
upload_url: ${{github.event.release.upload_url}}
asset_name: ${{env.RELEASE_FILE}}.tar.gz
asset_content_type: application/octet-stream
asset_content_type: application/octet-stream
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"gdbpath": "/usr/bin/gdb-multiarch",
"gdbPath": "/usr/bin/gdb-multiarch",
"device": "RP2040",
"configFiles": [
"interface/picoprobe.cfg",
@@ -26,4 +26,4 @@
]
}
]
}
}
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -3,9 +3,8 @@ cmake_minimum_required(VERSION 3.12)
# Change your executable name to something creative!
set(NAME pico-boilerplate) # <-- Name your project/executable here!

# Make sure you symlink this file into the project directory
# eg: ln -s ../pico-sdk/external/pico_sdk_import.cmake .
include(pico_sdk_import.cmake)
include(pimoroni_pico_import.cmake)

# Gooey boilerplate
project(${NAME} C CXX ASM)
@@ -22,11 +21,15 @@ add_executable(${NAME}

# Include required libraries
# This assumes `pimoroni-pico` is stored alongside your project
include(../pimoroni-pico/libraries/pico_explorer/pico_explorer.cmake)
# include(../pimoroni-pico/libraries/pico_display/pico_display.cmake)
include(common/pimoroni_i2c)
include(common/pimoroni_bus)
include(libraries/bitmap_fonts/bitmap_fonts)
include(libraries/hershey_fonts/hershey_fonts)
include(libraries/pico_explorer/pico_explorer)

# Don't forget to link the libraries you need!
target_link_libraries(${NAME}
pimoroni_i2c
pico_explorer # <-- List libraries here!
)

@@ -42,4 +45,4 @@ install(FILES

set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_GENERATOR "ZIP" "TGZ")
include(CPack)
include(CPack)
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -54,12 +54,6 @@ git clone https://github.com/pimoroni/pico-boilerplate
cd pico-boilerplate
```

And then (assuming pico-sdk is alongside your project):

```
ln -s ../pico-sdk/external/pico_sdk_import.cmake .
```

If you have not or don't want to set `PICO_SDK_PATH` you can edit `.vscode/settings.json` to pass the path directly to CMake.

## Prepare Visual Studio Code
@@ -86,4 +80,4 @@ Edit `CMakeLists.txt` and follow the instructions, you should make sure you:

## Pick your LICENSE

We've included a copy of BSD 3-Clause License to match that used in Raspberry Pi's Pico SDK and Pico Examples. You should review this and check it's appropriate for your project before publishing your code.
We've included a copy of BSD 3-Clause License to match that used in Raspberry Pi's Pico SDK and Pico Examples. You should review this and check it's appropriate for your project before publishing your code.
20 changes: 8 additions & 12 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
#include "pico_explorer.hpp"
#include "drivers/st7789/st7789.hpp"
#include "libraries/pico_graphics/pico_graphics.hpp"

using namespace pimoroni;

uint16_t buffer[PicoExplorer::WIDTH * PicoExplorer::HEIGHT];
PicoExplorer pico_explorer(buffer);
ST7789 st7789(PicoExplorer::WIDTH, PicoExplorer::HEIGHT, ROTATE_0, false, get_spi_pins(BG_SPI_FRONT));
PicoGraphics_PenRGB332 graphics(st7789.width, st7789.height, nullptr);

int main() {
pico_explorer.init();

// set the backlight to a value between 0 and 255
// the backlight is driven via PWM and is gamma corrected by our
// library to give a gorgeous linear brightness range.
pico_explorer.set_backlight(100);

pico_explorer.set_pen(255, 0, 0);
graphics.set_pen(255, 0, 0);

while(true) {
pico_explorer.pixel(Point(0, 0));
graphics.pixel(Point(0, 0));

// now we've done our drawing let's update the screen
pico_explorer.update();
st7789.update(&graphics);
}
}
73 changes: 73 additions & 0 deletions pico_sdk_import.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake

# This can be dropped into an external project to help locate this SDK
# It should be include()ed prior to project()

if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
endif ()

if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
endif ()

if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
endif ()

set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of Pico SDK from git if not otherwise locatable")
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download Pico SDK")

if (NOT PICO_SDK_PATH)
if (PICO_SDK_FETCH_FROM_GIT)
include(FetchContent)
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
if (PICO_SDK_FETCH_FROM_GIT_PATH)
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
endif ()
# GIT_SUBMODULES_RECURSE was added in 3.17
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
GIT_SUBMODULES_RECURSE FALSE
)
else ()
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
)
endif ()

if (NOT pico_sdk)
message("Downloading Raspberry Pi Pico SDK")
FetchContent_Populate(pico_sdk)
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
endif ()
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
else ()
message(FATAL_ERROR
"Pico SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
)
endif ()
endif ()

get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
if (NOT EXISTS ${PICO_SDK_PATH})
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
endif ()

set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
endif ()

set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)

include(${PICO_SDK_INIT_CMAKE_FILE})
56 changes: 56 additions & 0 deletions pimoroni_pico_import.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# This file can be dropped into a project to help locate the Pimoroni Pico libraries
# It will also set up the required include and module search paths.

if (DEFINED ENV{PIMORONI_PICO_FETCH_FROM_GIT} AND (NOT PIMORONI_PICO_FETCH_FROM_GIT))
set(PIMORONI_PICO_FETCH_FROM_GIT $ENV{PIMORONI_PICO_FETCH_FROM_GIT})
message("Using PIMORONI_PICO_FETCH_FROM_GIT from environment ('${PIMORONI_PICO_FETCH_FROM_GIT}')")
endif ()

if (DEFINED ENV{PIMORONI_PICO_FETCH_FROM_GIT_PATH} AND (NOT PIMORONI_PICO_FETCH_FROM_GIT_PATH))
set(PIMORONI_PICO_FETCH_FROM_GIT_PATH $ENV{PIMORONI_PICO_FETCH_FROM_GIT_PATH})
message("Using PIMORONI_PICO_FETCH_FROM_GIT_PATH from environment ('${PIMORONI_PICO_FETCH_FROM_GIT_PATH}')")
endif ()

if (NOT PIMORONI_PICO_PATH)
if (PIMORONI_PICO_FETCH_FROM_GIT)
include(FetchContent)
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
if (PIMORONI_PICO_FETCH_FROM_GIT_PATH)
get_filename_component(FETCHCONTENT_BASE_DIR "${PIMORONI_PICO_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
endif ()
FetchContent_Declare(
pimoroni_pico
GIT_REPOSITORY https://github.com/pimoroni/pimoroni-pico
GIT_TAG main
)
if (NOT pimoroni_pico)
message("Downloading PIMORONI_PICO SDK")
FetchContent_Populate(pimoroni_pico)
set(PIMORONI_PICO_PATH ${pimoroni_pico_SOURCE_DIR})
endif ()
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
elseif(PICO_SDK_PATH AND EXISTS "${PICO_SDK_PATH}/../pimoroni-pico")
set(PIMORONI_PICO_PATH ${PICO_SDK_PATH}/../pimoroni-pico)
message("Defaulting PIMORONI_PICO_PATH as sibling of PICO_SDK_PATH: ${PIMORONI_PICO_PATH}")
elseif(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/../../pimoroni-pico/")
set(PIMORONI_PICO_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../pimoroni-pico/)
else()
message(FATAL_ERROR "Pimoroni Pico location was not specified. Please set PIMORONI_PICO_PATH.")
endif()
endif()

get_filename_component(PIMORONI_PICO_PATH "${PIMORONI_PICO_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
if (NOT EXISTS ${PIMORONI_PICO_PATH})
message(FATAL_ERROR "Directory '${PIMORONI_PICO_PATH}' not found")
endif ()

if (NOT EXISTS ${PIMORONI_PICO_PATH}/pimoroni_pico_import.cmake)
message(FATAL_ERROR "Directory '${PIMORONI_PICO_PATH}' does not appear to contain the Pimoroni Pico libraries")
endif ()

message("PIMORONI_PICO_PATH is ${PIMORONI_PICO_PATH}")

set(PIMORONI_PICO_PATH ${PIMORONI_PICO_PATH} CACHE PATH "Path to the Pimoroni Pico libraries" FORCE)

include_directories(${PIMORONI_PICO_PATH})
list(APPEND CMAKE_MODULE_PATH ${PIMORONI_PICO_PATH})