rp/pio: add PioPin trait
pio can only access pins in bank 0, so it doesn't make sense to even allow wrapping of other banks' pins.
This commit is contained in:
@ -4,9 +4,8 @@
|
||||
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_rp::gpio::{self, Pin};
|
||||
use embassy_rp::pio::{
|
||||
FifoJoin, Pio, PioCommon, PioInstance, PioStateMachine, PioStateMachineInstance, ShiftDirection,
|
||||
FifoJoin, Pio, PioCommon, PioInstance, PioPin, PioStateMachine, PioStateMachineInstance, ShiftDirection,
|
||||
};
|
||||
use embassy_rp::pio_instr_util;
|
||||
use embassy_rp::relocate::RelocatedProgram;
|
||||
@ -18,7 +17,7 @@ pub struct Ws2812<'d, P: PioInstance, const S: usize> {
|
||||
}
|
||||
|
||||
impl<'d, P: PioInstance, const S: usize> Ws2812<'d, P, S> {
|
||||
pub fn new(mut pio: PioCommon<'d, P>, mut sm: PioStateMachineInstance<'d, P, S>, pin: gpio::AnyPin) -> Self {
|
||||
pub fn new(mut pio: PioCommon<'d, P>, mut sm: PioStateMachineInstance<'d, P, S>, pin: impl PioPin) -> Self {
|
||||
// Setup sm0
|
||||
|
||||
// prepare the PIO program
|
||||
@ -124,7 +123,7 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
// For the thing plus, use pin 8
|
||||
// For the feather, use pin 16
|
||||
let mut ws2812 = Ws2812::new(common, sm0, p.PIN_8.degrade());
|
||||
let mut ws2812 = Ws2812::new(common, sm0, p.PIN_8);
|
||||
|
||||
// Loop forever making RGB values and pushing them out to the WS2812.
|
||||
loop {
|
||||
|
Reference in New Issue
Block a user