Skip to content

Commit 3e6b8a4

Browse files
authored
Fix SPI pinout (#4)
* Fix default SPI pinout * Update doc about SPI allowed pins * Fix spi1 interface * Convert to tabs
1 parent 3a13171 commit 3e6b8a4

File tree

5 files changed

+450
-445
lines changed

5 files changed

+450
-445
lines changed

CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# User configuration section starts here
22

3-
# Default output data pin for the LED strip
3+
# Default output data pin for the non-SPI LED strips (only for sk6812/ws2812b)
44
set(OUTPUT_DATA_PIN 2)
55

6-
# Default output clock pin for the LED strip (SPI leds only, not for sk6812/ws2812b)
7-
set(OUTPUT_CLOCK_PIN 3)
6+
# Default output data/clocks pin for the SPI LED strips (only for apa102, not for sk6812/ws2812b)
7+
# only certain pairs of pins are allowed for selected SPI interface (refer to "readme.md")
8+
set(OUTPUT_SPI_DATA_PIN 3)
9+
set(OUTPUT_SPI_CLOCK_PIN 2)
10+
set(SPI_INTERFACE spi0)
811

912
# Use multi-segment, starting index of second led strip or OFF to disable
1013
set(SECOND_SEGMENT_INDEX OFF)
@@ -62,7 +65,7 @@ endmacro()
6265
# targets for different LED strips
6366
IF(NOT SECOND_SEGMENT_INDEX)
6467
HyperSerialPicoTarget("HyperSerialPico_Spi")
65-
target_compile_definitions(HyperSerialPico_Spi PRIVATE -DSPILED_APA102 -DDATA_PIN=${OUTPUT_DATA_PIN} -DCLOCK_PIN=${OUTPUT_CLOCK_PIN})
68+
target_compile_definitions(HyperSerialPico_Spi PRIVATE -DSPILED_APA102 -DSPI_INTERFACE=${SPI_INTERFACE} -DDATA_PIN=${OUTPUT_SPI_DATA_PIN} -DCLOCK_PIN=${OUTPUT_SPI_CLOCK_PIN})
6669
HyperSerialPicoTarget("HyperSerialPico_sk6812Cold")
6770
target_compile_definitions(HyperSerialPico_sk6812Cold PRIVATE -DNEOPIXEL_RGBW -DCOLD_WHITE -DDATA_PIN=${OUTPUT_DATA_PIN})
6871
HyperSerialPicoTarget("HyperSerialPico_sk6812Neutral")

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,20 @@ In the system file explorer you should find new drive (e.g. called `RPI-RP2` dri
2929
The Pico will reset automaticly after the upload and after few seconds it will be ready to use by HyperHDR as a serial port device using Adalight driver.
3030

3131
# HyperHDR configuration
32-
Make sure you have enabled `AWA protocol` and `Esp8266/ESP32/Rp2040 handshake` options.
33-
You can leave the speed at `2000000` because the CDC driver should use the highest possible speed automatically (at least it happens on Windows).
32+
You need HyperHDR v20 or newer. Make sure you have enabled `AWA protocol` and `Esp8266/ESP32/Rp2040 handshake` options. You can leave the speed at `2000000` because the CDC driver should use the highest possible speed automatically (at least it happens on Windows).
33+
3434
![obraz](https://user-images.githubusercontent.com/69086569/236870662-12f67d14-c2ca-4ba1-b6a3-e34c27949d19.png)
3535

3636
# Default pinout
3737

3838
**LED output (SK6812/WS281x):** GPIO2 for Data
39-
**LED output (SPI LEDs):** GPIO2 for Data, GPIO3 for Clock
39+
**LED output (SPI LEDs):** GPIO3 for Data, GPIO2 for Clock
40+
41+
rp2040 allows hardware SPI on corresponding pairs of pins:
42+
spi0 ⇒ Data/Clock: GPIO3/GPIO2, GPIO19/GPIO18, GPIO7/GPIO6
43+
spi1 ⇒ Data/Clock: GPIO11/GPIO10, GPI15/GPIO14, GPIO27/GPI26
4044

41-
Pinout can be changed, but you need to make changes to CMakeList.txt (`OUTPUT_DATA_PIN`/`OUTPUT_CLOCK_PIN`) and recompile the project. Also multi-segment mode can be enabled in this file: `SECOND_SEGMENT_INDEX` option at the beginning and optionally `SECOND_SEGMENT_REVERSED`.
42-
Once compiled, the results can be found in the `firmwares` folder.
45+
Pinout can be changed, but you need to make changes to `CMakeList.txt` (e.g. `OUTPUT_DATA_PIN` / `OUTPUT_SPI_DATA_PIN` / `OUTPUT_SPI_CLOCK_PIN`) and recompile the project. Also multi-segment mode can be enabled in this file: `SECOND_SEGMENT_INDEX` option at the beginning and optionally `SECOND_SEGMENT_REVERSED`. Once compiled, the results can be found in the `firmwares` folder.
4346

4447
# Some benchmark results
4548

include/base.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class Base
104104
#if defined(NEOPIXEL_RGBW) || defined(NEOPIXEL_RGB)
105105
ledStrip1 = new LED_DRIVER(ledsNumber, DATA_PIN);
106106
#else
107-
ledStrip1 = new LED_DRIVER(ledsNumber, DATA_PIN, CLOCK_PIN);
107+
ledStrip1 = new LED_DRIVER(ledsNumber, SPI_INTERFACE, DATA_PIN, CLOCK_PIN);
108108
#endif
109109
}
110110
}

0 commit comments

Comments
 (0)