Pico SDK 2.1.1 (Fortinbra's fix) (#1389)

* [ImgBot] Optimize images

*Total -- 12,577.34kb -> 11,716.38kb (6.85%)

/configs/DuelPadZen/assets/DuelPad_Zen_02.jpg -- 289.93kb -> 241.24kb (16.79%)
/configs/RP2040MiniBreakoutBoardUSBPassthrough/assets/RP2040MiniBreakoutBoardUSBPassthrough.jpeg -- 3,161.76kb -> 2,841.92kb (10.12%)
/configs/OpenCore0MIXUP/assets/OpenCore0_MIXUP_01.jpg -- 2,850.06kb -> 2,638.22kb (7.43%)
/configs/SeeedXIAORP2040/assets/Xiao_rp2040_pins.png -- 208.78kb -> 197.98kb (5.17%)
/configs/DuelPadZen/assets/DuelPad_Zen_01.jpg -- 6,035.09kb -> 5,765.88kb (4.46%)
/configs/Haute42COSMOXMLite/assets/Haute42COSMOX_M_Lite.jpg -- 31.73kb -> 31.13kb (1.89%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>

* Updating to SDK 2.1.1

* Trying this on the github build

* Fix state machines for RX/TX/EOP

* PIO should not be blocking for neopico writes.... will have to test this but this causes locks in web config

* Update ws2812 to newest SDK

* Updated NeoPico PIO to PIO1:0 instead of PIO0:0

Added stateMachine integer if we ever need to move the state machine assignment for NeoPico

---------

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>
Co-authored-by: ImgBotApp <ImgBotHelp@gmail.com>
This commit is contained in:
Luke A
2025-05-23 17:18:47 -04:00
committed by GitHub
parent 3c2af4cb17
commit 11db75d939
10 changed files with 107 additions and 37 deletions

View File

@@ -75,7 +75,7 @@ jobs:
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.16.x'
cmake-version: '3.17.x'
- name: Verify cmake
run: cmake --version
@@ -87,7 +87,7 @@ jobs:
fetch-tags: true
- name: Setup SDK pipeline
uses: Fortinbra/RaspberryPiPicoBuild@v3
uses: Fortinbra/RaspberryPiPicoBuild@v6
- name: Download a Build Artifact
uses: actions/download-artifact@v4.1.2

View File

@@ -1,4 +1,20 @@
cmake_minimum_required(VERSION 3.13)
# == DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work ==
if(WIN32)
set(USERHOME $ENV{USERPROFILE})
else()
set(USERHOME $ENV{HOME})
endif()
set(sdkVersion 2.1.1)
set(toolchainVersion 14_2_Rel1)
set(picotoolVersion 2.1.1)
set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
if (EXISTS ${picoVscode})
include(${picoVscode})
endif()
# ====================================================================================
set(PICO_BOARD pico CACHE STRING "Board type")
cmake_minimum_required(VERSION 3.10...4.0)
include(CMakePrintHelpers)
# enable compile commands for use by IDE autocompletion
@@ -8,8 +24,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# note: this must happen before project()
include(pico_sdk_import.cmake)
if (PICO_SDK_VERSION_STRING VERSION_LESS "1.5.0")
message(FATAL_ERROR "Raspberry Pi Pico SDK version 1.5.0 (or later) required. Your version is ${PICO_SDK_VERSION_STRING}")
if (PICO_SDK_VERSION_STRING VERSION_LESS "2.1.1")
message(FATAL_ERROR "Raspberry Pi Pico SDK version 2.1.1 (or later) required. Your version is ${PICO_SDK_VERSION_STRING}")
endif()
# set the version for webconfig, etc. based on git

View File

@@ -25,11 +25,11 @@ void NeoPico::PutPixel(uint32_t pixelData) {
switch (format) {
case LED_FORMAT_GRB:
case LED_FORMAT_RGB:
pio_sm_put_blocking(pio, 0, pixelData << 8u);
pio_sm_put_blocking(pio, stateMachine, pixelData << 8u);
break;
case LED_FORMAT_GRBW:
case LED_FORMAT_RGBW:
pio_sm_put_blocking(pio, 0, pixelData);
pio_sm_put_blocking(pio, stateMachine, pixelData);
break;
}
}
@@ -38,10 +38,10 @@ void NeoPico::Setup(int ledPin, int inNumPixels, LEDFormat inFormat, PIO inPio){
format = inFormat;
pio = inPio;
numPixels = inNumPixels;
int sm = 0;
stateMachine = 0;
uint offset = pio_add_program(pio, &ws2812_program);
bool rgbw = (format == LED_FORMAT_GRBW) || (format == LED_FORMAT_RGBW);
ws2812_program_init(pio, sm, offset, ledPin, 800000, rgbw);
ws2812_program_init(pio, stateMachine, offset, ledPin, 800000, rgbw);
this->Clear();
}

View File

@@ -25,7 +25,8 @@ public:
private:
void PutPixel(uint32_t pixel_grb);
LEDFormat format;
PIO pio = pio0;
PIO pio = pio1;
int stateMachine = 0;
int numPixels = 0;
uint32_t frame[100];
};

View File

@@ -3,13 +3,18 @@
;
; SPDX-License-Identifier: BSD-3-Clause
;
.pio_version 0 // only requires PIO version 0
.program ws2812
.side_set 1
.define public T1 2
.define public T2 5
.define public T3 3
; The following constants are selected for broad compatibility with WS2812,
; WS2812B, and SK6812 LEDs. Other constants may support higher bandwidths for
; specific LEDs, such as (7,10,8) for WS2812B LEDs.
.define public T1 3
.define public T2 3
.define public T3 4
.lang_opt python sideset_init = pico.PIO.OUT_HIGH
.lang_opt python out_init = pico.PIO.OUT_HIGH
@@ -49,9 +54,9 @@ static inline void ws2812_program_init(PIO pio, uint sm, uint offset, uint pin,
.program ws2812_parallel
.define public T1 2
.define public T2 5
.define public T3 3
.define public T1 3
.define public T2 3
.define public T3 4
.wrap_target
out x, 32
@@ -72,7 +77,6 @@ static inline void ws2812_parallel_program_init(PIO pio, uint sm, uint offset, u
pio_sm_config c = ws2812_parallel_program_get_default_config(offset);
sm_config_set_out_shift(&c, true, true, 32);
sm_config_set_out_pins(&c, pin_base, pin_count);
sm_config_set_set_pins(&c, pin_base, pin_count);
sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX);
int cycles_per_bit = ws2812_parallel_T1 + ws2812_parallel_T2 + ws2812_parallel_T3;

View File

@@ -29,6 +29,8 @@ void PeripheralUSB::setup() {
pio_cfg.pin_dp = _DP;
pio_cfg.pinout = (_Order == 0 ? PIO_USB_PINOUT_DPDM : PIO_USB_PINOUT_DMDP);
pio_cfg.sm_tx = 1; // NeoPico uses PIO0:0, move to state machine 1
pio_cfg.sm_tx = 1; // NeoPico uses PIO0:0, move to state machine 1
pio_cfg.sm_rx = 2; // state machine 2
pio_cfg.sm_eop = 3; // state machine 3
}
}

View File

@@ -3,6 +3,28 @@
# This can be dropped into an external project to help locate this SDK
# It should be include()ed prior to project()
# Copyright 2020 (c) 2020 Raspberry Pi (Trading) Ltd.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
# disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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}')")
@@ -18,9 +40,20 @@ if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_P
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
endif ()
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_TAG} AND (NOT PICO_SDK_FETCH_FROM_GIT_TAG))
set(PICO_SDK_FETCH_FROM_GIT_TAG $ENV{PICO_SDK_FETCH_FROM_GIT_TAG})
message("Using PICO_SDK_FETCH_FROM_GIT_TAG from environment ('${PICO_SDK_FETCH_FROM_GIT_TAG}')")
endif ()
if (PICO_SDK_FETCH_FROM_GIT AND NOT PICO_SDK_FETCH_FROM_GIT_TAG)
set(PICO_SDK_FETCH_FROM_GIT_TAG "master")
message("Using master as default value for PICO_SDK_FETCH_FROM_GIT_TAG")
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 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 SDK")
set(PICO_SDK_FETCH_FROM_GIT_TAG "${PICO_SDK_FETCH_FROM_GIT_TAG}" CACHE FILEPATH "release tag for SDK")
if (NOT PICO_SDK_PATH)
if (PICO_SDK_FETCH_FROM_GIT)
@@ -29,25 +62,39 @@ if (NOT PICO_SDK_PATH)
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 ()
FetchContent_Declare(
pico_sdk
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
)
if (NOT pico_sdk)
message("Downloading Raspberry Pi Pico SDK")
FetchContent_Populate(pico_sdk)
# GIT_SUBMODULES_RECURSE was added in 3.17
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
FetchContent_Populate(
pico_sdk
QUIET
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
GIT_SUBMODULES_RECURSE FALSE
SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-src
BINARY_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-build
SUBBUILD_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-subbuild
)
else ()
FetchContent_Populate(
pico_sdk
QUIET
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-src
BINARY_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-build
SUBBUILD_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-subbuild
)
endif ()
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
endif ()
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})

View File

@@ -250,7 +250,7 @@ void NeoPicoLEDAddon::setup() {
}
// Setup NeoPico ws2812 PIO
neopico.Setup(ledOptions.dataPin, ledCount, static_cast<LEDFormat>(ledOptions.ledFormat), pio0);
neopico.Setup(ledOptions.dataPin, ledCount, static_cast<LEDFormat>(ledOptions.ledFormat), pio1);
neopico.Off(); // turn off everything
// Rewrite this