Skip to content

Commit cf6c697

Browse files
committed
Ethan's changes
1 parent be586ba commit cf6c697

File tree

5 files changed

+156
-189
lines changed

5 files changed

+156
-189
lines changed

.github/workflows/push-master.yml

Lines changed: 126 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,138 @@
11
name: HyperSerialPico CI Build
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- "**" # Runs on push to any branch
47

58
jobs:
6-
7-
###########################
8-
#### HyperSerialPico ######
9-
###########################
9+
###########################
10+
#### HyperSerialPico ######
11+
###########################
1012

1113
HyperSerialPico:
1214
runs-on: ubuntu-22.04
1315

1416
steps:
15-
- uses: actions/[email protected]
16-
with:
17-
submodules: recursive
18-
19-
- name: Install GNU Arm Embedded Toolchain
20-
uses: carlosperate/arm-none-eabi-gcc-action@v1
21-
with:
22-
release: '12.2.Rel1'
23-
24-
- name: Build packages
25-
shell: bash
26-
run: |
27-
mkdir build
28-
cd build
29-
cmake ..
30-
cmake --build . --config Release
31-
32-
- uses: actions/[email protected]
33-
name: Upload artifacts (commit)
34-
if: (startsWith(github.event.ref, 'refs/tags') != true)
35-
with:
36-
path: |
37-
firmware/*.uf2
38-
39-
- uses: actions/[email protected]
40-
name: Upload artifacts (release)
41-
if: startsWith(github.ref, 'refs/tags/')
42-
with:
43-
name: firmware-release-generic
44-
path: |
45-
firmware/*.uf2
46-
47-
- name: Build packages for Adafruit Feather RP2040 Scorpio (release-only)
48-
if: startsWith(github.ref, 'refs/tags/')
49-
shell: bash
50-
run: |
51-
cd build
52-
rm *.*
53-
rm ../firmware/*
54-
echo "Neopixel is using GPIO16(OUTPUT_DATA_PIN) on output 0." > ../firmware/Firmwares_for_Adafruit_Feather_RP2040_Scorpio.txt
55-
echo "SPI is using spi0 interface pins: GPIO19(OUTPUT_SPI_DATA_PIN) and GPIO18(OUTPUT_SPI_CLOCK_PIN) on output 3 and 2 respectively." >> ../firmware/Firmwares_for_Adafruit_Feather_RP2040_Scorpio.txt
56-
cmake -DOVERRIDE_BOOT_WORKAROUND=ON -DOVERRIDE_DATA_PIN=16 -DOVERRIDE_SPI_DATA_PIN=19 -DOVERRIDE_SPI_CLOCK_PIN=18 -DCMAKE_BUILD_TYPE=Release ..
57-
cmake --build .
58-
zip -j ../firmware/Adafruit_Feather_RP2040_Scorpio.zip ../firmware/*
59-
60-
- uses: actions/[email protected]
61-
name: Upload artifacts (release Adafruit_Feather)
62-
if: startsWith(github.ref, 'refs/tags/')
63-
with:
64-
name: firmware-release-adafruit-scorpio
65-
path: |
66-
firmware/*.zip
67-
68-
- name: Build packages for Adafruit ItsyBitsy RP2040 (release-only)
69-
if: startsWith(github.ref, 'refs/tags/')
70-
shell: bash
71-
run: |
72-
cd build
73-
rm *.*
74-
rm ../firmware/*
75-
echo "Neopixel is using GPIO14(OUTPUT_DATA_PIN) on output 5." > ../firmware/Firmwares_for_Adafruit_ItsyBitsy_2040.txt
76-
cmake -DOVERRIDE_BOOT_WORKAROUND=ON -DOVERRIDE_DATA_PIN=14 -DCMAKE_BUILD_TYPE=Release ..
77-
cmake --build .
78-
rm ../firmware/*_Spi.uf2
79-
zip -j ../firmware/Adafruit_ItsyBitsy_2040.zip ../firmware/*
80-
81-
- uses: actions/[email protected]
82-
name: Upload artifacts (release Adafruit_ItsyBitsy)
83-
if: startsWith(github.ref, 'refs/tags/')
84-
with:
85-
name: firmware-release-adafruit-itsybitsy
86-
path: |
87-
firmware/*.zip
88-
89-
- name: Build packages for Pimoroni Plasma Stick 2040 W (release-only)
90-
if: startsWith(github.ref, 'refs/tags/')
91-
shell: bash
92-
run: |
93-
cd build
94-
rm *.*
95-
rm ../firmware/*
96-
echo "Neopixel is using GPIO15(OUTPUT_DATA_PIN) on output PIXELS." > ../firmware/Firmwares_for_Pimoroni_Plasma_Stick_2040_W.txt
97-
cmake -DOVERRIDE_DATA_PIN=15 -DCMAKE_BUILD_TYPE=Release ..
98-
cmake --build .
99-
rm ../firmware/*_Spi.uf2
100-
zip -j ../firmware/Pimoroni_Plasma_Stick_2040_W.zip ../firmware/*
101-
102-
- uses: actions/[email protected]
103-
name: Upload artifacts (release Pimoroni_Plasma_Stick_W)
104-
if: startsWith(github.ref, 'refs/tags/')
105-
with:
106-
name: firmware-release-pimoroni-plasma-stick
107-
path: |
108-
firmware/*.zip
109-
110-
- name: Build packages for Pimoroni Plasma 2040 (release-only)
111-
if: startsWith(github.ref, 'refs/tags/')
112-
shell: bash
113-
run: |
114-
cd build
115-
rm *.*
116-
rm ../firmware/*
117-
echo "Neopixel is using GPIO15(OUTPUT_DATA_PIN) on output DA." > ../firmware/Firmwares_for_Pimoroni_Plasma_2040.txt
118-
echo "SPI is using spi1 interface pins: GPIO15(OUTPUT_SPI_DATA_PIN) and GPIO14(OUTPUT_SPI_CLOCK_PIN) on output DA and CL respectively." >> ../firmware/Firmwares_for_Pimoroni_Plasma_2040.txt
119-
cmake -DOVERRIDE_DATA_PIN=15 -DOVERRIDE_SPI_INTERFACE=spi1 -DOVERRIDE_SPI_DATA_PIN=15 -DOVERRIDE_SPI_CLOCK_PIN=14 -DCMAKE_BUILD_TYPE=Release ..
120-
cmake --build .
121-
zip -j ../firmware/Pimoroni_Plasma_2040.zip ../firmware/*
122-
123-
- uses: actions/[email protected]
124-
name: Upload artifacts (release Pimoroni_Plasma)
125-
if: startsWith(github.ref, 'refs/tags/')
126-
with:
127-
name: firmware-release-pimoroni-plasma
128-
path: |
129-
firmware/*.zip
130-
131-
################################
132-
###### Publish Releases ########
133-
################################
17+
- uses: actions/[email protected]
18+
with:
19+
submodules: recursive
20+
21+
- name: Install GNU Arm Embedded Toolchain
22+
uses: carlosperate/arm-none-eabi-gcc-action@v1
23+
with:
24+
release: "12.2.Rel1"
25+
26+
- name: Build packages
27+
shell: bash
28+
run: |
29+
mkdir build
30+
cd build
31+
cmake ..
32+
cmake --build . --config Release
33+
34+
- uses: actions/[email protected]
35+
name: Upload artifacts (commit)
36+
if: (startsWith(github.event.ref, 'refs/tags') != true)
37+
with:
38+
path: |
39+
firmware/*.uf2
40+
41+
- uses: actions/[email protected]
42+
name: Upload artifacts (release)
43+
if: startsWith(github.ref, 'refs/tags/')
44+
with:
45+
name: firmware-release-generic
46+
path: |
47+
firmware/*.uf2
48+
49+
- name: Build packages for Adafruit Feather RP2040 Scorpio (release-only)
50+
if: startsWith(github.ref, 'refs/tags/')
51+
shell: bash
52+
run: |
53+
cd build
54+
rm *.*
55+
rm ../firmware/*
56+
echo "Neopixel is using GPIO16(OUTPUT_DATA_PIN) on output 0." > ../firmware/Firmwares_for_Adafruit_Feather_RP2040_Scorpio.txt
57+
echo "SPI is using spi0 interface pins: GPIO19(OUTPUT_SPI_DATA_PIN) and GPIO18(OUTPUT_SPI_CLOCK_PIN) on output 3 and 2 respectively." >> ../firmware/Firmwares_for_Adafruit_Feather_RP2040_Scorpio.txt
58+
cmake -DOVERRIDE_BOOT_WORKAROUND=ON -DOVERRIDE_DATA_PIN=16 -DOVERRIDE_SPI_DATA_PIN=19 -DOVERRIDE_SPI_CLOCK_PIN=18 -DCMAKE_BUILD_TYPE=Release ..
59+
cmake --build .
60+
zip -j ../firmware/Adafruit_Feather_RP2040_Scorpio.zip ../firmware/*
61+
62+
- uses: actions/[email protected]
63+
name: Upload artifacts (release Adafruit_Feather)
64+
if: startsWith(github.ref, 'refs/tags/')
65+
with:
66+
name: firmware-release-adafruit-scorpio
67+
path: |
68+
firmware/*.zip
69+
70+
# - name: Build packages for Adafruit ItsyBitsy RP2040 (release-only)
71+
# if: startsWith(github.ref, 'refs/tags/')
72+
# shell: bash
73+
# run: |
74+
# cd build
75+
# rm *.*
76+
# rm ../firmware/*
77+
# echo "Neopixel is using GPIO14(OUTPUT_DATA_PIN) on output 5." > ../firmware/Firmwares_for_Adafruit_ItsyBitsy_2040.txt
78+
# cmake -DOVERRIDE_BOOT_WORKAROUND=ON -DOVERRIDE_DATA_PIN=14 -DCMAKE_BUILD_TYPE=Release ..
79+
# cmake --build .
80+
# rm ../firmware/*_Spi.uf2
81+
# zip -j ../firmware/Adafruit_ItsyBitsy_2040.zip ../firmware/*
82+
83+
# - uses: actions/[email protected]
84+
# name: Upload artifacts (release Adafruit_ItsyBitsy)
85+
# if: startsWith(github.ref, 'refs/tags/')
86+
# with:
87+
# name: firmware-release-adafruit-itsybitsy
88+
# path: |
89+
# firmware/*.zip
90+
91+
# - name: Build packages for Pimoroni Plasma Stick 2040 W (release-only)
92+
# if: startsWith(github.ref, 'refs/tags/')
93+
# shell: bash
94+
# run: |
95+
# cd build
96+
# rm *.*
97+
# rm ../firmware/*
98+
# echo "Neopixel is using GPIO15(OUTPUT_DATA_PIN) on output PIXELS." > ../firmware/Firmwares_for_Pimoroni_Plasma_Stick_2040_W.txt
99+
# cmake -DOVERRIDE_DATA_PIN=15 -DCMAKE_BUILD_TYPE=Release ..
100+
# cmake --build .
101+
# rm ../firmware/*_Spi.uf2
102+
# zip -j ../firmware/Pimoroni_Plasma_Stick_2040_W.zip ../firmware/*
103+
104+
# - uses: actions/[email protected]
105+
# name: Upload artifacts (release Pimoroni_Plasma_Stick_W)
106+
# if: startsWith(github.ref, 'refs/tags/')
107+
# with:
108+
# name: firmware-release-pimoroni-plasma-stick
109+
# path: |
110+
# firmware/*.zip
111+
112+
# - name: Build packages for Pimoroni Plasma 2040 (release-only)
113+
# if: startsWith(github.ref, 'refs/tags/')
114+
# shell: bash
115+
# run: |
116+
# cd build
117+
# rm *.*
118+
# rm ../firmware/*
119+
# echo "Neopixel is using GPIO15(OUTPUT_DATA_PIN) on output DA." > ../firmware/Firmwares_for_Pimoroni_Plasma_2040.txt
120+
# echo "SPI is using spi1 interface pins: GPIO15(OUTPUT_SPI_DATA_PIN) and GPIO14(OUTPUT_SPI_CLOCK_PIN) on output DA and CL respectively." >> ../firmware/Firmwares_for_Pimoroni_Plasma_2040.txt
121+
# cmake -DOVERRIDE_DATA_PIN=15 -DOVERRIDE_SPI_INTERFACE=spi1 -DOVERRIDE_SPI_DATA_PIN=15 -DOVERRIDE_SPI_CLOCK_PIN=14 -DCMAKE_BUILD_TYPE=Release ..
122+
# cmake --build .
123+
# zip -j ../firmware/Pimoroni_Plasma_2040.zip ../firmware/*
124+
125+
# - uses: actions/[email protected]
126+
# name: Upload artifacts (release Pimoroni_Plasma)
127+
# if: startsWith(github.ref, 'refs/tags/')
128+
# with:
129+
# name: firmware-release-pimoroni-plasma
130+
# path: |
131+
# firmware/*.zip
132+
133+
################################
134+
###### Publish Releases ########
135+
################################
134136

135137
publish:
136138
name: Publish Releases

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,3 +353,5 @@ MigrationBackup/
353353

354354
# Ionide (cross platform F# VS Code tools) working folder
355355
.ionide/
356+
357+
.vscode

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if (NOT PICO_PROGRAM_MAIN_ENTRY)
1616
set(OUTPUT_SPI_INTERFACE spi0)
1717

1818
# Use multi-segment, starting index of second led strip or OFF to disable
19-
set(SECOND_SEGMENT_INDEX OFF)
19+
set(SECOND_SEGMENT_INDEX 16) # Enable multi-segment, starting at GPIO16
2020

2121
# If multi-segment is used and it's reversed, set this option to ON to enable reversing
2222
set(SECOND_SEGMENT_REVERSED OFF)

include/base.h

Lines changed: 18 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ class Base
3838
LED_DRIVER2* ledStrip2 = nullptr;
3939
// frame is set and ready to render
4040
bool readyToRender = false;
41+
42+
int ledSegments = 8;
43+
int ledPins[ledSegments] = {16, 17, 18, 19, 20, 21, 22, 23};
44+
int ledCounts[ledSegments] = {1, 1, 1, 0, 0, 0, 0, 0};
45+
46+
sk6812p* ledStrips[ledSegments] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
4147

4248
public:
4349
// static data buffer for the loop
@@ -70,42 +76,15 @@ class Base
7076

7177
void initLedStrip(int count)
7278
{
73-
if (ledStrip1 != nullptr)
74-
{
75-
delete ledStrip1;
76-
ledStrip1 = nullptr;
77-
}
78-
79-
if (ledStrip2 != nullptr)
80-
{
81-
delete ledStrip2;
82-
ledStrip2 = nullptr;
83-
}
84-
85-
ledsNumber = count;
86-
87-
#if defined(SECOND_SEGMENT_START_INDEX)
88-
if (ledsNumber > SECOND_SEGMENT_START_INDEX)
89-
{
90-
#if defined(NEOPIXEL_RGBW) || defined(NEOPIXEL_RGB)
91-
ledStrip1 = new LED_DRIVER(SECOND_SEGMENT_START_INDEX, DATA_PIN);
92-
ledStrip2 = new LED_DRIVER2(ledsNumber - SECOND_SEGMENT_START_INDEX, DATA_PIN);
93-
#else
94-
ledStrip1 = new LED_DRIVER(SECOND_SEGMENT_START_INDEX);
95-
ledStrip1->Begin(CLOCK_PIN, 12, DATA_PIN, 15);
96-
ledStrip2 = new LED_DRIVER2(ledsNumber - SECOND_SEGMENT_START_INDEX);
97-
ledStrip2->Begin(SECOND_SEGMENT_CLOCK_PIN, 12, SECOND_SEGMENT_DATA_PIN, 15);
98-
#endif
79+
for (int i = 0; i < ledSegments; i++) {
80+
if (ledStrips[i] != nullptr) {
81+
delete ledStrips[i];
82+
ledStrips[i] = nullptr;
9983
}
100-
#endif
10184

102-
if (ledStrip1 == nullptr)
103-
{
104-
#if defined(NEOPIXEL_RGBW) || defined(NEOPIXEL_RGB)
105-
ledStrip1 = new LED_DRIVER(ledsNumber, DATA_PIN);
106-
#else
107-
ledStrip1 = new LED_DRIVER(ledsNumber, SPI_INTERFACE, DATA_PIN, CLOCK_PIN);
108-
#endif
85+
if (ledCounts[i] > 0) {
86+
ledStrips[i] = new sk6812p(ledCounts[i], ledPins[i]);
87+
}
10988
}
11089
}
11190

@@ -136,12 +115,11 @@ class Base
136115
statistics.increaseShow();
137116
readyToRender = false;
138117

139-
// display segments
140-
#if defined(SECOND_SEGMENT_START_INDEX)
141-
ledStrip1->renderAllLanes();
142-
#else
143-
ledStrip1->renderSingleLane();
144-
#endif
118+
for (int i = 0; i < ledSegments; i++) {
119+
if (ledStrips[i] != nullptr) {
120+
ledStrips[i]->renderSingleLane();
121+
}
122+
}
145123
}
146124
}
147125

0 commit comments

Comments
 (0)