Update WS2812 usage after PIO api's breaking change.

This commit is contained in:
Wilfried Chauveau 2021-10-02 10:04:15 +01:00 committed by 9names
parent ad68c9d696
commit c8609e9ef1
3 changed files with 13 additions and 8 deletions

View file

@ -22,6 +22,7 @@ use feather_rp2040::{
Pins, XOSC_CRYSTAL_FREQ,
};
use panic_halt as _;
use rp2040_hal::pio::PIOExt;
use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812;
#[link_section = ".boot2"]
@ -60,11 +61,12 @@ fn main() -> ! {
let mut delay = timer.count_down();
// Configure the addressable LED
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
let mut ws = Ws2812::new(
// The onboard NeoPixel is attached to GPIO pin #16 on the Feather RP2040.
16,
pac.PIO0,
&mut pac.RESETS,
&mut pio,
sm0,
clocks.peripheral_clock.freq(),
timer.count_down(),
);

View file

@ -25,6 +25,7 @@ use pro_micro_rp2040::{
},
XOSC_CRYSTAL_FREQ,
};
use rp2040_hal::pio::PIOExt;
use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812;
@ -75,11 +76,11 @@ fn main() -> ! {
let mut delay = timer.count_down();
// Configure the addressable LED
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
let mut ws = Ws2812::new(
25,
pac.PIO0,
&mut pac.RESETS,
&mut pio,
sm0,
clocks.peripheral_clock.freq(),
timer.count_down(),
);

View file

@ -8,6 +8,7 @@ use embedded_hal::digital::v2::OutputPin;
use embedded_hal::timer::CountDown;
use embedded_time::duration::Extensions;
use panic_halt as _;
use rp2040_hal::pio::PIOExt;
use smart_leds::{brightness, SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812;
@ -59,13 +60,14 @@ fn main() -> ! {
.set_high()
.unwrap();
let timer = rp2040_hal::timer::Timer::new(pac.TIMER);
let timer = rp2040_hal::timer::Timer::new(pac.TIMER, &mut pac.RESETS);
let mut delay = timer.count_down();
let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
let mut ws = Ws2812::new(
12,
pac.PIO0,
&mut pac.RESETS,
&mut pio,
sm0,
clocks.peripheral_clock.freq(),
timer.count_down(),
);