diff options
| author | pennae <[email protected]> | 2023-05-03 17:16:35 +0200 |
|---|---|---|
| committer | pennae <[email protected]> | 2023-05-05 19:08:16 +0200 |
| commit | 8ebe6e5f2029026594c703820c11d703da2c0334 (patch) | |
| tree | 567ee3174b2f140c6a0ce99d40c0d599279ef799 | |
| parent | 4439031d4323a5d1e11af22887a32bb76cb953fb (diff) | |
rp/pio: drop Pio prefix from almost all names
it's only any good for PioPin because there it follows a pattern of gpio
pin alternate functions being named like that, everything else can just
as well be referred to as `pio::Thing`
| -rw-r--r-- | embassy-rp/src/pio.rs | 158 | ||||
| -rw-r--r-- | embassy-rp/src/pio_instr_util.rs | 20 | ||||
| -rw-r--r-- | examples/rp/src/bin/pio_async.rs | 14 | ||||
| -rw-r--r-- | examples/rp/src/bin/pio_hd44780.rs | 4 | ||||
| -rw-r--r-- | examples/rp/src/bin/ws2812-pio.rs | 10 |
5 files changed, 103 insertions, 103 deletions
diff --git a/embassy-rp/src/pio.rs b/embassy-rp/src/pio.rs index 2cf4761a5..31273b5d8 100644 --- a/embassy-rp/src/pio.rs +++ b/embassy-rp/src/pio.rs | |||
| @@ -96,18 +96,18 @@ pub(crate) unsafe fn init() { | |||
| 96 | 96 | ||
| 97 | /// Future that waits for TX-FIFO to become writable | 97 | /// Future that waits for TX-FIFO to become writable |
| 98 | #[must_use = "futures do nothing unless you `.await` or poll them"] | 98 | #[must_use = "futures do nothing unless you `.await` or poll them"] |
| 99 | pub struct FifoOutFuture<'a, 'd, PIO: PioInstance, const SM: usize> { | 99 | pub struct FifoOutFuture<'a, 'd, PIO: Instance, const SM: usize> { |
| 100 | sm_tx: &'a mut PioStateMachineTx<'d, PIO, SM>, | 100 | sm_tx: &'a mut StateMachineTx<'d, PIO, SM>, |
| 101 | value: u32, | 101 | value: u32, |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | impl<'a, 'd, PIO: PioInstance, const SM: usize> FifoOutFuture<'a, 'd, PIO, SM> { | 104 | impl<'a, 'd, PIO: Instance, const SM: usize> FifoOutFuture<'a, 'd, PIO, SM> { |
| 105 | pub fn new(sm: &'a mut PioStateMachineTx<'d, PIO, SM>, value: u32) -> Self { | 105 | pub fn new(sm: &'a mut StateMachineTx<'d, PIO, SM>, value: u32) -> Self { |
| 106 | FifoOutFuture { sm_tx: sm, value } | 106 | FifoOutFuture { sm_tx: sm, value } |
| 107 | } | 107 | } |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | impl<'a, 'd, PIO: PioInstance, const SM: usize> Future for FifoOutFuture<'a, 'd, PIO, SM> { | 110 | impl<'a, 'd, PIO: Instance, const SM: usize> Future for FifoOutFuture<'a, 'd, PIO, SM> { |
| 111 | type Output = (); | 111 | type Output = (); |
| 112 | fn poll(self: FuturePin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { | 112 | fn poll(self: FuturePin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { |
| 113 | //debug!("Poll {},{}", PIO::PIO_NO, SM); | 113 | //debug!("Poll {},{}", PIO::PIO_NO, SM); |
| @@ -127,7 +127,7 @@ impl<'a, 'd, PIO: PioInstance, const SM: usize> Future for FifoOutFuture<'a, 'd, | |||
| 127 | } | 127 | } |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | impl<'a, 'd, PIO: PioInstance, const SM: usize> Drop for FifoOutFuture<'a, 'd, PIO, SM> { | 130 | impl<'a, 'd, PIO: Instance, const SM: usize> Drop for FifoOutFuture<'a, 'd, PIO, SM> { |
| 131 | fn drop(&mut self) { | 131 | fn drop(&mut self) { |
| 132 | unsafe { | 132 | unsafe { |
| 133 | PIO::PIO.irqs(0).inte().write_clear(|m| { | 133 | PIO::PIO.irqs(0).inte().write_clear(|m| { |
| @@ -139,17 +139,17 @@ impl<'a, 'd, PIO: PioInstance, const SM: usize> Drop for FifoOutFuture<'a, 'd, P | |||
| 139 | 139 | ||
| 140 | /// Future that waits for RX-FIFO to become readable | 140 | /// Future that waits for RX-FIFO to become readable |
| 141 | #[must_use = "futures do nothing unless you `.await` or poll them"] | 141 | #[must_use = "futures do nothing unless you `.await` or poll them"] |
| 142 | pub struct FifoInFuture<'a, 'd, PIO: PioInstance, const SM: usize> { | 142 | pub struct FifoInFuture<'a, 'd, PIO: Instance, const SM: usize> { |
| 143 | sm_rx: &'a mut PioStateMachineRx<'d, PIO, SM>, | 143 | sm_rx: &'a mut StateMachineRx<'d, PIO, SM>, |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | impl<'a, 'd, PIO: PioInstance, const SM: usize> FifoInFuture<'a, 'd, PIO, SM> { | 146 | impl<'a, 'd, PIO: Instance, const SM: usize> FifoInFuture<'a, 'd, PIO, SM> { |
| 147 | pub fn new(sm: &'a mut PioStateMachineRx<'d, PIO, SM>) -> Self { | 147 | pub fn new(sm: &'a mut StateMachineRx<'d, PIO, SM>) -> Self { |
| 148 | FifoInFuture { sm_rx: sm } | 148 | FifoInFuture { sm_rx: sm } |
| 149 | } | 149 | } |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | impl<'a, 'd, PIO: PioInstance, const SM: usize> Future for FifoInFuture<'a, 'd, PIO, SM> { | 152 | impl<'a, 'd, PIO: Instance, const SM: usize> Future for FifoInFuture<'a, 'd, PIO, SM> { |
| 153 | type Output = u32; | 153 | type Output = u32; |
| 154 | fn poll(mut self: FuturePin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { | 154 | fn poll(mut self: FuturePin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { |
| 155 | //debug!("Poll {},{}", PIO::PIO_NO, SM); | 155 | //debug!("Poll {},{}", PIO::PIO_NO, SM); |
| @@ -168,7 +168,7 @@ impl<'a, 'd, PIO: PioInstance, const SM: usize> Future for FifoInFuture<'a, 'd, | |||
| 168 | } | 168 | } |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | impl<'a, 'd, PIO: PioInstance, const SM: usize> Drop for FifoInFuture<'a, 'd, PIO, SM> { | 171 | impl<'a, 'd, PIO: Instance, const SM: usize> Drop for FifoInFuture<'a, 'd, PIO, SM> { |
| 172 | fn drop(&mut self) { | 172 | fn drop(&mut self) { |
| 173 | unsafe { | 173 | unsafe { |
| 174 | PIO::PIO.irqs(0).inte().write_clear(|m| { | 174 | PIO::PIO.irqs(0).inte().write_clear(|m| { |
| @@ -180,12 +180,12 @@ impl<'a, 'd, PIO: PioInstance, const SM: usize> Drop for FifoInFuture<'a, 'd, PI | |||
| 180 | 180 | ||
| 181 | /// Future that waits for IRQ | 181 | /// Future that waits for IRQ |
| 182 | #[must_use = "futures do nothing unless you `.await` or poll them"] | 182 | #[must_use = "futures do nothing unless you `.await` or poll them"] |
| 183 | pub struct IrqFuture<'a, 'd, PIO: PioInstance> { | 183 | pub struct IrqFuture<'a, 'd, PIO: Instance> { |
| 184 | pio: PhantomData<&'a PioIrq<'d, PIO, 0>>, | 184 | pio: PhantomData<&'a Irq<'d, PIO, 0>>, |
| 185 | irq_no: u8, | 185 | irq_no: u8, |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | impl<'a, 'd, PIO: PioInstance> Future for IrqFuture<'a, 'd, PIO> { | 188 | impl<'a, 'd, PIO: Instance> Future for IrqFuture<'a, 'd, PIO> { |
| 189 | type Output = (); | 189 | type Output = (); |
| 190 | fn poll(self: FuturePin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { | 190 | fn poll(self: FuturePin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { |
| 191 | //debug!("Poll {},{}", PIO::PIO_NO, SM); | 191 | //debug!("Poll {},{}", PIO::PIO_NO, SM); |
| @@ -215,7 +215,7 @@ impl<'a, 'd, PIO: PioInstance> Future for IrqFuture<'a, 'd, PIO> { | |||
| 215 | } | 215 | } |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | impl<'a, 'd, PIO: PioInstance> Drop for IrqFuture<'a, 'd, PIO> { | 218 | impl<'a, 'd, PIO: Instance> Drop for IrqFuture<'a, 'd, PIO> { |
| 219 | fn drop(&mut self) { | 219 | fn drop(&mut self) { |
| 220 | unsafe { | 220 | unsafe { |
| 221 | PIO::PIO.irqs(0).inte().write_clear(|m| { | 221 | PIO::PIO.irqs(0).inte().write_clear(|m| { |
| @@ -225,12 +225,12 @@ impl<'a, 'd, PIO: PioInstance> Drop for IrqFuture<'a, 'd, PIO> { | |||
| 225 | } | 225 | } |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | pub struct Pin<'l, PIO: PioInstance> { | 228 | pub struct Pin<'l, PIO: Instance> { |
| 229 | pin: PeripheralRef<'l, AnyPin>, | 229 | pin: PeripheralRef<'l, AnyPin>, |
| 230 | pio: PhantomData<PIO>, | 230 | pio: PhantomData<PIO>, |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | impl<'l, PIO: PioInstance> Pin<'l, PIO> { | 233 | impl<'l, PIO: Instance> Pin<'l, PIO> { |
| 234 | /// Set the pin's drive strength. | 234 | /// Set the pin's drive strength. |
| 235 | #[inline] | 235 | #[inline] |
| 236 | pub fn set_drive_strength(&mut self, strength: Drive) { | 236 | pub fn set_drive_strength(&mut self, strength: Drive) { |
| @@ -293,11 +293,11 @@ impl<'l, PIO: PioInstance> Pin<'l, PIO> { | |||
| 293 | } | 293 | } |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | pub struct PioStateMachineRx<'d, PIO: PioInstance, const SM: usize> { | 296 | pub struct StateMachineRx<'d, PIO: Instance, const SM: usize> { |
| 297 | pio: PhantomData<&'d PIO>, | 297 | pio: PhantomData<&'d PIO>, |
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | impl<'d, PIO: PioInstance, const SM: usize> PioStateMachineRx<'d, PIO, SM> { | 300 | impl<'d, PIO: Instance, const SM: usize> StateMachineRx<'d, PIO, SM> { |
| 301 | pub fn empty(&self) -> bool { | 301 | pub fn empty(&self) -> bool { |
| 302 | unsafe { PIO::PIO.fstat().read().rxempty() & (1u8 << SM) != 0 } | 302 | unsafe { PIO::PIO.fstat().read().rxempty() & (1u8 << SM) != 0 } |
| 303 | } | 303 | } |
| @@ -370,11 +370,11 @@ impl<'d, PIO: PioInstance, const SM: usize> PioStateMachineRx<'d, PIO, SM> { | |||
| 370 | } | 370 | } |
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | pub struct PioStateMachineTx<'d, PIO: PioInstance, const SM: usize> { | 373 | pub struct StateMachineTx<'d, PIO: Instance, const SM: usize> { |
| 374 | pio: PhantomData<&'d PIO>, | 374 | pio: PhantomData<&'d PIO>, |
| 375 | } | 375 | } |
| 376 | 376 | ||
| 377 | impl<'d, PIO: PioInstance, const SM: usize> PioStateMachineTx<'d, PIO, SM> { | 377 | impl<'d, PIO: Instance, const SM: usize> StateMachineTx<'d, PIO, SM> { |
| 378 | pub fn empty(&self) -> bool { | 378 | pub fn empty(&self) -> bool { |
| 379 | unsafe { PIO::PIO.fstat().read().txempty() & (1u8 << SM) != 0 } | 379 | unsafe { PIO::PIO.fstat().read().txempty() & (1u8 << SM) != 0 } |
| 380 | } | 380 | } |
| @@ -445,12 +445,12 @@ impl<'d, PIO: PioInstance, const SM: usize> PioStateMachineTx<'d, PIO, SM> { | |||
| 445 | } | 445 | } |
| 446 | } | 446 | } |
| 447 | 447 | ||
| 448 | pub struct PioStateMachine<'d, PIO: PioInstance, const SM: usize> { | 448 | pub struct StateMachine<'d, PIO: Instance, const SM: usize> { |
| 449 | rx: PioStateMachineRx<'d, PIO, SM>, | 449 | rx: StateMachineRx<'d, PIO, SM>, |
| 450 | tx: PioStateMachineTx<'d, PIO, SM>, | 450 | tx: StateMachineTx<'d, PIO, SM>, |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | impl<'d, PIO: PioInstance, const SM: usize> Drop for PioStateMachine<'d, PIO, SM> { | 453 | impl<'d, PIO: Instance, const SM: usize> Drop for StateMachine<'d, PIO, SM> { |
| 454 | fn drop(&mut self) { | 454 | fn drop(&mut self) { |
| 455 | unsafe { | 455 | unsafe { |
| 456 | PIO::PIO.ctrl().write_clear(|w| w.set_sm_enable(1 << SM)); | 456 | PIO::PIO.ctrl().write_clear(|w| w.set_sm_enable(1 << SM)); |
| @@ -459,7 +459,7 @@ impl<'d, PIO: PioInstance, const SM: usize> Drop for PioStateMachine<'d, PIO, SM | |||
| 459 | } | 459 | } |
| 460 | } | 460 | } |
| 461 | 461 | ||
| 462 | impl<'d, PIO: PioInstance + 'd, const SM: usize> PioStateMachine<'d, PIO, SM> { | 462 | impl<'d, PIO: Instance + 'd, const SM: usize> StateMachine<'d, PIO, SM> { |
| 463 | #[inline(always)] | 463 | #[inline(always)] |
| 464 | fn this_sm() -> crate::pac::pio::StateMachine { | 464 | fn this_sm() -> crate::pac::pio::StateMachine { |
| 465 | PIO::PIO.sm(SM) | 465 | PIO::PIO.sm(SM) |
| @@ -771,35 +771,35 @@ impl<'d, PIO: PioInstance + 'd, const SM: usize> PioStateMachine<'d, PIO, SM> { | |||
| 771 | } | 771 | } |
| 772 | } | 772 | } |
| 773 | 773 | ||
| 774 | pub fn rx(&mut self) -> &mut PioStateMachineRx<'d, PIO, SM> { | 774 | pub fn rx(&mut self) -> &mut StateMachineRx<'d, PIO, SM> { |
| 775 | &mut self.rx | 775 | &mut self.rx |
| 776 | } | 776 | } |
| 777 | pub fn tx(&mut self) -> &mut PioStateMachineTx<'d, PIO, SM> { | 777 | pub fn tx(&mut self) -> &mut StateMachineTx<'d, PIO, SM> { |
| 778 | &mut self.tx | 778 | &mut self.tx |
| 779 | } | 779 | } |
| 780 | pub fn rx_tx(&mut self) -> (&mut PioStateMachineRx<'d, PIO, SM>, &mut PioStateMachineTx<'d, PIO, SM>) { | 780 | pub fn rx_tx(&mut self) -> (&mut StateMachineRx<'d, PIO, SM>, &mut StateMachineTx<'d, PIO, SM>) { |
| 781 | (&mut self.rx, &mut self.tx) | 781 | (&mut self.rx, &mut self.tx) |
| 782 | } | 782 | } |
| 783 | } | 783 | } |
| 784 | 784 | ||
| 785 | pub struct PioCommon<'d, PIO: PioInstance> { | 785 | pub struct Common<'d, PIO: Instance> { |
| 786 | instructions_used: u32, | 786 | instructions_used: u32, |
| 787 | pio: PhantomData<&'d PIO>, | 787 | pio: PhantomData<&'d PIO>, |
| 788 | } | 788 | } |
| 789 | 789 | ||
| 790 | impl<'d, PIO: PioInstance> Drop for PioCommon<'d, PIO> { | 790 | impl<'d, PIO: Instance> Drop for Common<'d, PIO> { |
| 791 | fn drop(&mut self) { | 791 | fn drop(&mut self) { |
| 792 | on_pio_drop::<PIO>(); | 792 | on_pio_drop::<PIO>(); |
| 793 | } | 793 | } |
| 794 | } | 794 | } |
| 795 | 795 | ||
| 796 | pub struct PioInstanceMemory<'d, PIO: PioInstance> { | 796 | pub struct InstanceMemory<'d, PIO: Instance> { |
| 797 | used_mask: u32, | 797 | used_mask: u32, |
| 798 | pio: PhantomData<&'d PIO>, | 798 | pio: PhantomData<&'d PIO>, |
| 799 | } | 799 | } |
| 800 | 800 | ||
| 801 | impl<'d, PIO: PioInstance> PioCommon<'d, PIO> { | 801 | impl<'d, PIO: Instance> Common<'d, PIO> { |
| 802 | pub fn write_instr<I>(&mut self, start: usize, instrs: I) -> PioInstanceMemory<'d, PIO> | 802 | pub fn write_instr<I>(&mut self, start: usize, instrs: I) -> InstanceMemory<'d, PIO> |
| 803 | where | 803 | where |
| 804 | I: Iterator<Item = u16>, | 804 | I: Iterator<Item = u16>, |
| 805 | { | 805 | { |
| @@ -820,16 +820,16 @@ impl<'d, PIO: PioInstance> PioCommon<'d, PIO> { | |||
| 820 | used_mask |= mask; | 820 | used_mask |= mask; |
| 821 | } | 821 | } |
| 822 | self.instructions_used |= used_mask; | 822 | self.instructions_used |= used_mask; |
| 823 | PioInstanceMemory { | 823 | InstanceMemory { |
| 824 | used_mask, | 824 | used_mask, |
| 825 | pio: PhantomData, | 825 | pio: PhantomData, |
| 826 | } | 826 | } |
| 827 | } | 827 | } |
| 828 | 828 | ||
| 829 | /// Free instruction memory previously allocated with [`PioCommon::write_instr`]. | 829 | /// Free instruction memory previously allocated with [`Common::write_instr`]. |
| 830 | /// This is always possible but unsafe if any state machine is still using this | 830 | /// This is always possible but unsafe if any state machine is still using this |
| 831 | /// bit of memory. | 831 | /// bit of memory. |
| 832 | pub unsafe fn free_instr(&mut self, instrs: PioInstanceMemory<PIO>) { | 832 | pub unsafe fn free_instr(&mut self, instrs: InstanceMemory<PIO>) { |
| 833 | self.instructions_used &= !instrs.used_mask; | 833 | self.instructions_used &= !instrs.used_mask; |
| 834 | } | 834 | } |
| 835 | 835 | ||
| @@ -848,8 +848,8 @@ impl<'d, PIO: PioInstance> PioCommon<'d, PIO> { | |||
| 848 | } | 848 | } |
| 849 | 849 | ||
| 850 | /// Register a pin for PIO usage. Pins will be released from the PIO block | 850 | /// Register a pin for PIO usage. Pins will be released from the PIO block |
| 851 | /// (i.e., have their `FUNCSEL` reset to `NULL`) when the [`PioCommon`] *and* | 851 | /// (i.e., have their `FUNCSEL` reset to `NULL`) when the [`Common`] *and* |
| 852 | /// all [`PioStateMachine`]s for this block have been dropped. **Other members | 852 | /// all [`StateMachine`]s for this block have been dropped. **Other members |
| 853 | /// of [`Pio`] do not keep pin registrations alive.** | 853 | /// of [`Pio`] do not keep pin registrations alive.** |
| 854 | pub fn make_pio_pin(&mut self, pin: impl Peripheral<P = impl PioPin + 'd> + 'd) -> Pin<'d, PIO> { | 854 | pub fn make_pio_pin(&mut self, pin: impl Peripheral<P = impl PioPin + 'd> + 'd) -> Pin<'d, PIO> { |
| 855 | into_ref!(pin); | 855 | into_ref!(pin); |
| @@ -865,11 +865,11 @@ impl<'d, PIO: PioInstance> PioCommon<'d, PIO> { | |||
| 865 | } | 865 | } |
| 866 | } | 866 | } |
| 867 | 867 | ||
| 868 | pub struct PioIrq<'d, PIO: PioInstance, const N: usize> { | 868 | pub struct Irq<'d, PIO: Instance, const N: usize> { |
| 869 | pio: PhantomData<&'d PIO>, | 869 | pio: PhantomData<&'d PIO>, |
| 870 | } | 870 | } |
| 871 | 871 | ||
| 872 | impl<'d, PIO: PioInstance, const N: usize> PioIrq<'d, PIO, N> { | 872 | impl<'d, PIO: Instance, const N: usize> Irq<'d, PIO, N> { |
| 873 | pub fn wait<'a>(&'a mut self) -> IrqFuture<'a, 'd, PIO> { | 873 | pub fn wait<'a>(&'a mut self) -> IrqFuture<'a, 'd, PIO> { |
| 874 | IrqFuture { | 874 | IrqFuture { |
| 875 | pio: PhantomData, | 875 | pio: PhantomData, |
| @@ -879,11 +879,11 @@ impl<'d, PIO: PioInstance, const N: usize> PioIrq<'d, PIO, N> { | |||
| 879 | } | 879 | } |
| 880 | 880 | ||
| 881 | #[derive(Clone)] | 881 | #[derive(Clone)] |
| 882 | pub struct PioIrqFlags<'d, PIO: PioInstance> { | 882 | pub struct IrqFlags<'d, PIO: Instance> { |
| 883 | pio: PhantomData<&'d PIO>, | 883 | pio: PhantomData<&'d PIO>, |
| 884 | } | 884 | } |
| 885 | 885 | ||
| 886 | impl<'d, PIO: PioInstance> PioIrqFlags<'d, PIO> { | 886 | impl<'d, PIO: Instance> IrqFlags<'d, PIO> { |
| 887 | pub fn check(&self, irq_no: u8) -> bool { | 887 | pub fn check(&self, irq_no: u8) -> bool { |
| 888 | assert!(irq_no < 8); | 888 | assert!(irq_no < 8); |
| 889 | self.check_any(1 << irq_no) | 889 | self.check_any(1 << irq_no) |
| @@ -916,48 +916,48 @@ impl<'d, PIO: PioInstance> PioIrqFlags<'d, PIO> { | |||
| 916 | } | 916 | } |
| 917 | } | 917 | } |
| 918 | 918 | ||
| 919 | pub struct Pio<'d, PIO: PioInstance> { | 919 | pub struct Pio<'d, PIO: Instance> { |
| 920 | pub common: PioCommon<'d, PIO>, | 920 | pub common: Common<'d, PIO>, |
| 921 | pub irq_flags: PioIrqFlags<'d, PIO>, | 921 | pub irq_flags: IrqFlags<'d, PIO>, |
| 922 | pub irq0: PioIrq<'d, PIO, 0>, | 922 | pub irq0: Irq<'d, PIO, 0>, |
| 923 | pub irq1: PioIrq<'d, PIO, 1>, | 923 | pub irq1: Irq<'d, PIO, 1>, |
| 924 | pub irq2: PioIrq<'d, PIO, 2>, | 924 | pub irq2: Irq<'d, PIO, 2>, |
| 925 | pub irq3: PioIrq<'d, PIO, 3>, | 925 | pub irq3: Irq<'d, PIO, 3>, |
| 926 | pub sm0: PioStateMachine<'d, PIO, 0>, | 926 | pub sm0: StateMachine<'d, PIO, 0>, |
| 927 | pub sm1: PioStateMachine<'d, PIO, 1>, | 927 | pub sm1: StateMachine<'d, PIO, 1>, |
| 928 | pub sm2: PioStateMachine<'d, PIO, 2>, | 928 | pub sm2: StateMachine<'d, PIO, 2>, |
| 929 | pub sm3: PioStateMachine<'d, PIO, 3>, | 929 | pub sm3: StateMachine<'d, PIO, 3>, |
| 930 | } | 930 | } |
| 931 | 931 | ||
| 932 | impl<'d, PIO: PioInstance> Pio<'d, PIO> { | 932 | impl<'d, PIO: Instance> Pio<'d, PIO> { |
| 933 | pub fn new(_pio: impl Peripheral<P = PIO> + 'd) -> Self { | 933 | pub fn new(_pio: impl Peripheral<P = PIO> + 'd) -> Self { |
| 934 | PIO::state().users.store(5, Ordering::Release); | 934 | PIO::state().users.store(5, Ordering::Release); |
| 935 | PIO::state().used_pins.store(0, Ordering::Release); | 935 | PIO::state().used_pins.store(0, Ordering::Release); |
| 936 | Self { | 936 | Self { |
| 937 | common: PioCommon { | 937 | common: Common { |
| 938 | instructions_used: 0, | 938 | instructions_used: 0, |
| 939 | pio: PhantomData, | 939 | pio: PhantomData, |
| 940 | }, | 940 | }, |
| 941 | irq_flags: PioIrqFlags { pio: PhantomData }, | 941 | irq_flags: IrqFlags { pio: PhantomData }, |
| 942 | irq0: PioIrq { pio: PhantomData }, | 942 | irq0: Irq { pio: PhantomData }, |
| 943 | irq1: PioIrq { pio: PhantomData }, | 943 | irq1: Irq { pio: PhantomData }, |
| 944 | irq2: PioIrq { pio: PhantomData }, | 944 | irq2: Irq { pio: PhantomData }, |
| 945 | irq3: PioIrq { pio: PhantomData }, | 945 | irq3: Irq { pio: PhantomData }, |
| 946 | sm0: PioStateMachine { | 946 | sm0: StateMachine { |
| 947 | rx: PioStateMachineRx { pio: PhantomData }, | 947 | rx: StateMachineRx { pio: PhantomData }, |
| 948 | tx: PioStateMachineTx { pio: PhantomData }, | 948 | tx: StateMachineTx { pio: PhantomData }, |
| 949 | }, | 949 | }, |
| 950 | sm1: PioStateMachine { | 950 | sm1: StateMachine { |
| 951 | rx: PioStateMachineRx { pio: PhantomData }, | 951 | rx: StateMachineRx { pio: PhantomData }, |
| 952 | tx: PioStateMachineTx { pio: PhantomData }, | 952 | tx: StateMachineTx { pio: PhantomData }, |
| 953 | }, | 953 | }, |
| 954 | sm2: PioStateMachine { | 954 | sm2: StateMachine { |
| 955 | rx: PioStateMachineRx { pio: PhantomData }, | 955 | rx: StateMachineRx { pio: PhantomData }, |
| 956 | tx: PioStateMachineTx { pio: PhantomData }, | 956 | tx: StateMachineTx { pio: PhantomData }, |
| 957 | }, | 957 | }, |
| 958 | sm3: PioStateMachine { | 958 | sm3: StateMachine { |
| 959 | rx: PioStateMachineRx { pio: PhantomData }, | 959 | rx: StateMachineRx { pio: PhantomData }, |
| 960 | tx: PioStateMachineTx { pio: PhantomData }, | 960 | tx: StateMachineTx { pio: PhantomData }, |
| 961 | }, | 961 | }, |
| 962 | } | 962 | } |
| 963 | } | 963 | } |
| @@ -974,7 +974,7 @@ pub struct State { | |||
| 974 | used_pins: AtomicU32, | 974 | used_pins: AtomicU32, |
| 975 | } | 975 | } |
| 976 | 976 | ||
| 977 | fn on_pio_drop<PIO: PioInstance>() { | 977 | fn on_pio_drop<PIO: Instance>() { |
| 978 | let state = PIO::state(); | 978 | let state = PIO::state(); |
| 979 | if state.users.fetch_sub(1, Ordering::AcqRel) == 1 { | 979 | if state.users.fetch_sub(1, Ordering::AcqRel) == 1 { |
| 980 | let used_pins = state.used_pins.load(Ordering::Relaxed); | 980 | let used_pins = state.used_pins.load(Ordering::Relaxed); |
| @@ -994,7 +994,7 @@ mod sealed { | |||
| 994 | 994 | ||
| 995 | pub trait PioPin {} | 995 | pub trait PioPin {} |
| 996 | 996 | ||
| 997 | pub trait PioInstance { | 997 | pub trait Instance { |
| 998 | const PIO_NO: u8; | 998 | const PIO_NO: u8; |
| 999 | const PIO: &'static crate::pac::pio::Pio; | 999 | const PIO: &'static crate::pac::pio::Pio; |
| 1000 | const FUNCSEL: crate::pac::io::vals::Gpio0ctrlFuncsel; | 1000 | const FUNCSEL: crate::pac::io::vals::Gpio0ctrlFuncsel; |
| @@ -1011,16 +1011,16 @@ mod sealed { | |||
| 1011 | } | 1011 | } |
| 1012 | } | 1012 | } |
| 1013 | 1013 | ||
| 1014 | pub trait PioInstance: sealed::PioInstance + Sized + Unpin {} | 1014 | pub trait Instance: sealed::Instance + Sized + Unpin {} |
| 1015 | 1015 | ||
| 1016 | macro_rules! impl_pio { | 1016 | macro_rules! impl_pio { |
| 1017 | ($name:ident, $pio:expr, $pac:ident, $funcsel:ident) => { | 1017 | ($name:ident, $pio:expr, $pac:ident, $funcsel:ident) => { |
| 1018 | impl sealed::PioInstance for peripherals::$name { | 1018 | impl sealed::Instance for peripherals::$name { |
| 1019 | const PIO_NO: u8 = $pio; | 1019 | const PIO_NO: u8 = $pio; |
| 1020 | const PIO: &'static pac::pio::Pio = &pac::$pac; | 1020 | const PIO: &'static pac::pio::Pio = &pac::$pac; |
| 1021 | const FUNCSEL: pac::io::vals::Gpio0ctrlFuncsel = pac::io::vals::Gpio0ctrlFuncsel::$funcsel; | 1021 | const FUNCSEL: pac::io::vals::Gpio0ctrlFuncsel = pac::io::vals::Gpio0ctrlFuncsel::$funcsel; |
| 1022 | } | 1022 | } |
| 1023 | impl PioInstance for peripherals::$name {} | 1023 | impl Instance for peripherals::$name {} |
| 1024 | }; | 1024 | }; |
| 1025 | } | 1025 | } |
| 1026 | 1026 | ||
diff --git a/embassy-rp/src/pio_instr_util.rs b/embassy-rp/src/pio_instr_util.rs index 81abdb666..e425cf092 100644 --- a/embassy-rp/src/pio_instr_util.rs +++ b/embassy-rp/src/pio_instr_util.rs | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | use pio::{InSource, InstructionOperands, JmpCondition, OutDestination, SetDestination}; | 1 | use pio::{InSource, InstructionOperands, JmpCondition, OutDestination, SetDestination}; |
| 2 | 2 | ||
| 3 | use crate::pio::{PioInstance, PioStateMachine}; | 3 | use crate::pio::{Instance, StateMachine}; |
| 4 | 4 | ||
| 5 | pub fn set_x<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachine<PIO, SM>, value: u32) { | 5 | pub fn set_x<PIO: Instance, const SM: usize>(sm: &mut StateMachine<PIO, SM>, value: u32) { |
| 6 | const OUT: u16 = InstructionOperands::OUT { | 6 | const OUT: u16 = InstructionOperands::OUT { |
| 7 | destination: OutDestination::X, | 7 | destination: OutDestination::X, |
| 8 | bit_count: 32, | 8 | bit_count: 32, |
| @@ -12,7 +12,7 @@ pub fn set_x<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachine<PIO, SM | |||
| 12 | sm.exec_instr(OUT); | 12 | sm.exec_instr(OUT); |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn get_x<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachine<PIO, SM>) -> u32 { | 15 | pub fn get_x<PIO: Instance, const SM: usize>(sm: &mut StateMachine<PIO, SM>) -> u32 { |
| 16 | const IN: u16 = InstructionOperands::IN { | 16 | const IN: u16 = InstructionOperands::IN { |
| 17 | source: InSource::X, | 17 | source: InSource::X, |
| 18 | bit_count: 32, | 18 | bit_count: 32, |
| @@ -22,7 +22,7 @@ pub fn get_x<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachine<PIO, SM | |||
| 22 | sm.rx().pull() | 22 | sm.rx().pull() |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | pub fn set_y<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachine<PIO, SM>, value: u32) { | 25 | pub fn set_y<PIO: Instance, const SM: usize>(sm: &mut StateMachine<PIO, SM>, value: u32) { |
| 26 | const OUT: u16 = InstructionOperands::OUT { | 26 | const OUT: u16 = InstructionOperands::OUT { |
| 27 | destination: OutDestination::Y, | 27 | destination: OutDestination::Y, |
| 28 | bit_count: 32, | 28 | bit_count: 32, |
| @@ -32,7 +32,7 @@ pub fn set_y<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachine<PIO, SM | |||
| 32 | sm.exec_instr(OUT); | 32 | sm.exec_instr(OUT); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | pub fn get_y<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachine<PIO, SM>) -> u32 { | 35 | pub fn get_y<PIO: Instance, const SM: usize>(sm: &mut StateMachine<PIO, SM>) -> u32 { |
| 36 | const IN: u16 = InstructionOperands::IN { | 36 | const IN: u16 = InstructionOperands::IN { |
| 37 | source: InSource::Y, | 37 | source: InSource::Y, |
| 38 | bit_count: 32, | 38 | bit_count: 32, |
| @@ -43,7 +43,7 @@ pub fn get_y<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachine<PIO, SM | |||
| 43 | sm.rx().pull() | 43 | sm.rx().pull() |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | pub fn set_pindir<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachine<PIO, SM>, data: u8) { | 46 | pub fn set_pindir<PIO: Instance, const SM: usize>(sm: &mut StateMachine<PIO, SM>, data: u8) { |
| 47 | let set: u16 = InstructionOperands::SET { | 47 | let set: u16 = InstructionOperands::SET { |
| 48 | destination: SetDestination::PINDIRS, | 48 | destination: SetDestination::PINDIRS, |
| 49 | data, | 49 | data, |
| @@ -52,7 +52,7 @@ pub fn set_pindir<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachine<PI | |||
| 52 | sm.exec_instr(set); | 52 | sm.exec_instr(set); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | pub fn set_pin<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachine<PIO, SM>, data: u8) { | 55 | pub fn set_pin<PIO: Instance, const SM: usize>(sm: &mut StateMachine<PIO, SM>, data: u8) { |
| 56 | let set: u16 = InstructionOperands::SET { | 56 | let set: u16 = InstructionOperands::SET { |
| 57 | destination: SetDestination::PINS, | 57 | destination: SetDestination::PINS, |
| 58 | data, | 58 | data, |
| @@ -61,7 +61,7 @@ pub fn set_pin<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachine<PIO, | |||
| 61 | sm.exec_instr(set); | 61 | sm.exec_instr(set); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | pub fn set_out_pin<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachine<PIO, SM>, data: u32) { | 64 | pub fn set_out_pin<PIO: Instance, const SM: usize>(sm: &mut StateMachine<PIO, SM>, data: u32) { |
| 65 | const OUT: u16 = InstructionOperands::OUT { | 65 | const OUT: u16 = InstructionOperands::OUT { |
| 66 | destination: OutDestination::PINS, | 66 | destination: OutDestination::PINS, |
| 67 | bit_count: 32, | 67 | bit_count: 32, |
| @@ -70,7 +70,7 @@ pub fn set_out_pin<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachine<P | |||
| 70 | sm.tx().push(data); | 70 | sm.tx().push(data); |
| 71 | sm.exec_instr(OUT); | 71 | sm.exec_instr(OUT); |
| 72 | } | 72 | } |
| 73 | pub fn set_out_pindir<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachine<PIO, SM>, data: u32) { | 73 | pub fn set_out_pindir<PIO: Instance, const SM: usize>(sm: &mut StateMachine<PIO, SM>, data: u32) { |
| 74 | const OUT: u16 = InstructionOperands::OUT { | 74 | const OUT: u16 = InstructionOperands::OUT { |
| 75 | destination: OutDestination::PINDIRS, | 75 | destination: OutDestination::PINDIRS, |
| 76 | bit_count: 32, | 76 | bit_count: 32, |
| @@ -80,7 +80,7 @@ pub fn set_out_pindir<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachin | |||
| 80 | sm.exec_instr(OUT); | 80 | sm.exec_instr(OUT); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | pub fn exec_jmp<PIO: PioInstance, const SM: usize>(sm: &mut PioStateMachine<PIO, SM>, to_addr: u8) { | 83 | pub fn exec_jmp<PIO: Instance, const SM: usize>(sm: &mut StateMachine<PIO, SM>, to_addr: u8) { |
| 84 | let jmp: u16 = InstructionOperands::JMP { | 84 | let jmp: u16 = InstructionOperands::JMP { |
| 85 | address: to_addr, | 85 | address: to_addr, |
| 86 | condition: JmpCondition::Always, | 86 | condition: JmpCondition::Always, |
diff --git a/examples/rp/src/bin/pio_async.rs b/examples/rp/src/bin/pio_async.rs index 4e0ab5e3c..461ea3ff9 100644 --- a/examples/rp/src/bin/pio_async.rs +++ b/examples/rp/src/bin/pio_async.rs | |||
| @@ -4,12 +4,12 @@ | |||
| 4 | use defmt::info; | 4 | use defmt::info; |
| 5 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| 6 | use embassy_rp::peripherals::PIO0; | 6 | use embassy_rp::peripherals::PIO0; |
| 7 | use embassy_rp::pio::{Pio, PioCommon, PioIrq, PioPin, PioStateMachine, ShiftDirection}; | 7 | use embassy_rp::pio::{Common, Irq, Pio, PioPin, ShiftDirection, StateMachine}; |
| 8 | use embassy_rp::pio_instr_util; | 8 | use embassy_rp::pio_instr_util; |
| 9 | use embassy_rp::relocate::RelocatedProgram; | 9 | use embassy_rp::relocate::RelocatedProgram; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | fn setup_pio_task_sm0(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachine<PIO0, 0>, pin: impl PioPin) { | 12 | fn setup_pio_task_sm0(pio: &mut Common<PIO0>, sm: &mut StateMachine<PIO0, 0>, pin: impl PioPin) { |
| 13 | // Setup sm0 | 13 | // Setup sm0 |
| 14 | 14 | ||
| 15 | // Send data serially to pin | 15 | // Send data serially to pin |
| @@ -37,7 +37,7 @@ fn setup_pio_task_sm0(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachine<PIO0, | |||
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | #[embassy_executor::task] | 39 | #[embassy_executor::task] |
| 40 | async fn pio_task_sm0(mut sm: PioStateMachine<'static, PIO0, 0>) { | 40 | async fn pio_task_sm0(mut sm: StateMachine<'static, PIO0, 0>) { |
| 41 | sm.set_enable(true); | 41 | sm.set_enable(true); |
| 42 | 42 | ||
| 43 | let mut v = 0x0f0caffa; | 43 | let mut v = 0x0f0caffa; |
| @@ -48,7 +48,7 @@ async fn pio_task_sm0(mut sm: PioStateMachine<'static, PIO0, 0>) { | |||
| 48 | } | 48 | } |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | fn setup_pio_task_sm1(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachine<PIO0, 1>) { | 51 | fn setup_pio_task_sm1(pio: &mut Common<PIO0>, sm: &mut StateMachine<PIO0, 1>) { |
| 52 | // Setupm sm1 | 52 | // Setupm sm1 |
| 53 | 53 | ||
| 54 | // Read 0b10101 repeatedly until ISR is full | 54 | // Read 0b10101 repeatedly until ISR is full |
| @@ -67,7 +67,7 @@ fn setup_pio_task_sm1(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachine<PIO0, | |||
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | #[embassy_executor::task] | 69 | #[embassy_executor::task] |
| 70 | async fn pio_task_sm1(mut sm: PioStateMachine<'static, PIO0, 1>) { | 70 | async fn pio_task_sm1(mut sm: StateMachine<'static, PIO0, 1>) { |
| 71 | sm.set_enable(true); | 71 | sm.set_enable(true); |
| 72 | loop { | 72 | loop { |
| 73 | let rx = sm.rx().wait_pull().await; | 73 | let rx = sm.rx().wait_pull().await; |
| @@ -75,7 +75,7 @@ async fn pio_task_sm1(mut sm: PioStateMachine<'static, PIO0, 1>) { | |||
| 75 | } | 75 | } |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | fn setup_pio_task_sm2(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachine<PIO0, 2>) { | 78 | fn setup_pio_task_sm2(pio: &mut Common<PIO0>, sm: &mut StateMachine<PIO0, 2>) { |
| 79 | // Setup sm2 | 79 | // Setup sm2 |
| 80 | 80 | ||
| 81 | // Repeatedly trigger IRQ 3 | 81 | // Repeatedly trigger IRQ 3 |
| @@ -99,7 +99,7 @@ fn setup_pio_task_sm2(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachine<PIO0, | |||
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | #[embassy_executor::task] | 101 | #[embassy_executor::task] |
| 102 | async fn pio_task_sm2(mut irq: PioIrq<'static, PIO0, 3>, mut sm: PioStateMachine<'static, PIO0, 2>) { | 102 | async fn pio_task_sm2(mut irq: Irq<'static, PIO0, 3>, mut sm: StateMachine<'static, PIO0, 2>) { |
| 103 | sm.set_enable(true); | 103 | sm.set_enable(true); |
| 104 | loop { | 104 | loop { |
| 105 | irq.wait().await; | 105 | irq.wait().await; |
diff --git a/examples/rp/src/bin/pio_hd44780.rs b/examples/rp/src/bin/pio_hd44780.rs index f76d334e7..17b2440cf 100644 --- a/examples/rp/src/bin/pio_hd44780.rs +++ b/examples/rp/src/bin/pio_hd44780.rs | |||
| @@ -7,7 +7,7 @@ use core::fmt::Write; | |||
| 7 | use embassy_executor::Spawner; | 7 | use embassy_executor::Spawner; |
| 8 | use embassy_rp::dma::{AnyChannel, Channel}; | 8 | use embassy_rp::dma::{AnyChannel, Channel}; |
| 9 | use embassy_rp::peripherals::PIO0; | 9 | use embassy_rp::peripherals::PIO0; |
| 10 | use embassy_rp::pio::{FifoJoin, Pio, PioPin, PioStateMachine, ShiftDirection}; | 10 | use embassy_rp::pio::{FifoJoin, Pio, PioPin, ShiftDirection, StateMachine}; |
| 11 | use embassy_rp::pwm::{Config, Pwm}; | 11 | use embassy_rp::pwm::{Config, Pwm}; |
| 12 | use embassy_rp::relocate::RelocatedProgram; | 12 | use embassy_rp::relocate::RelocatedProgram; |
| 13 | use embassy_rp::{into_ref, Peripheral, PeripheralRef}; | 13 | use embassy_rp::{into_ref, Peripheral, PeripheralRef}; |
| @@ -64,7 +64,7 @@ async fn main(_spawner: Spawner) { | |||
| 64 | 64 | ||
| 65 | pub struct HD44780<'l> { | 65 | pub struct HD44780<'l> { |
| 66 | dma: PeripheralRef<'l, AnyChannel>, | 66 | dma: PeripheralRef<'l, AnyChannel>, |
| 67 | sm: PioStateMachine<'l, PIO0, 0>, | 67 | sm: StateMachine<'l, PIO0, 0>, |
| 68 | 68 | ||
| 69 | buf: [u8; 40], | 69 | buf: [u8; 40], |
| 70 | } | 70 | } |
diff --git a/examples/rp/src/bin/ws2812-pio.rs b/examples/rp/src/bin/ws2812-pio.rs index c9c701a70..2e6860d8b 100644 --- a/examples/rp/src/bin/ws2812-pio.rs +++ b/examples/rp/src/bin/ws2812-pio.rs | |||
| @@ -4,18 +4,18 @@ | |||
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_rp::pio::{FifoJoin, Pio, PioCommon, PioInstance, PioPin, PioStateMachine, ShiftDirection}; | 7 | use embassy_rp::pio::{Common, FifoJoin, Instance, Pio, PioPin, ShiftDirection, StateMachine}; |
| 8 | use embassy_rp::pio_instr_util; | 8 | use embassy_rp::pio_instr_util; |
| 9 | use embassy_rp::relocate::RelocatedProgram; | 9 | use embassy_rp::relocate::RelocatedProgram; |
| 10 | use embassy_time::{Duration, Timer}; | 10 | use embassy_time::{Duration, Timer}; |
| 11 | use smart_leds::RGB8; | 11 | use smart_leds::RGB8; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | pub struct Ws2812<'d, P: PioInstance, const S: usize> { | 13 | pub struct Ws2812<'d, P: Instance, const S: usize> { |
| 14 | sm: PioStateMachine<'d, P, S>, | 14 | sm: StateMachine<'d, P, S>, |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | impl<'d, P: PioInstance, const S: usize> Ws2812<'d, P, S> { | 17 | impl<'d, P: Instance, const S: usize> Ws2812<'d, P, S> { |
| 18 | pub fn new(mut pio: PioCommon<'d, P>, mut sm: PioStateMachine<'d, P, S>, pin: impl PioPin) -> Self { | 18 | pub fn new(mut pio: Common<'d, P>, mut sm: StateMachine<'d, P, S>, pin: impl PioPin) -> Self { |
| 19 | // Setup sm0 | 19 | // Setup sm0 |
| 20 | 20 | ||
| 21 | // prepare the PIO program | 21 | // prepare the PIO program |
