Cribbing off what the official Pico VS Code plugin does, I added some things to my CMakeLists.txt and - magically - it now works?
I have no idea what I did to make this work! However I’m able to use the plasma library as such:
#include "pico/stdlib.h"
#include <stdio.h>
#include "common/pimoroni_common.hpp"
#include "plasma2350.hpp"
#include "rgbled.hpp"
using namespace pimoroni;
using namespace plasma;
// Set how many LEDs you have
const uint NUM_LEDS = 66;
// The SPEED that the LEDs cycle at (1 - 255)
const uint SPEED = 5;
// How many times the LEDs will be updated per second
const uint UPDATES = 60;
RGBLED led(plasma2350::LED_R, plasma2350::LED_G, plasma2350::LED_B);
WS2812 led_strip(NUM_LEDS, pio0, 0, plasma2350::DAT, WS2812::DEFAULT_SERIAL_FREQ, false, WS2812::COLOR_ORDER::RGB);
int main() {
// Start updating the LED strip
led_strip.start(UPDATES);
float offset = 0.0f;
// Make rainbows
while(true) {
offset += float(SPEED) / 2000.0f;
if (offset > 1.0) {
offset -= 1.0;
}
for(auto i = 0u; i < NUM_LEDS; ++i) {
float hue = float(i) / NUM_LEDS;
hue += offset;
hue -= floor(hue);
led_strip.set_hsv(i, hue, 1.0f, 1.0f);
}
led.set_rgb(100, 0, 255);
sleep_ms(1000 / UPDATES);
led.set_rgb(0, 0, 255);
}
}
And this does indeed make rainbows.