diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-02-09 23:23:35 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-02-18 18:14:35 +0100 |
| commit | e3edd671b6653325f9425886e008f6f37860f1b4 (patch) | |
| tree | 23a8c2f29f555946f279fff852b428a111fde666 /cyw43-pio/src | |
| parent | 1780f8479e8c8b5145e56861eb3cb4d57dd80185 (diff) | |
rp/pio: move instructions to methods of the SM.
Diffstat (limited to 'cyw43-pio/src')
| -rw-r--r-- | cyw43-pio/src/lib.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/cyw43-pio/src/lib.rs b/cyw43-pio/src/lib.rs index 5fe7af95d..b08e68307 100644 --- a/cyw43-pio/src/lib.rs +++ b/cyw43-pio/src/lib.rs | |||
| @@ -8,7 +8,7 @@ use core::slice; | |||
| 8 | use cyw43::SpiBusCyw43; | 8 | use cyw43::SpiBusCyw43; |
| 9 | use embassy_rp::dma::Channel; | 9 | use embassy_rp::dma::Channel; |
| 10 | use embassy_rp::gpio::{Drive, Level, Output, Pull, SlewRate}; | 10 | use embassy_rp::gpio::{Drive, Level, Output, Pull, SlewRate}; |
| 11 | use embassy_rp::pio::{instr, Common, Config, Direction, Instance, Irq, PioPin, ShiftDirection, StateMachine}; | 11 | use embassy_rp::pio::{Common, Config, Direction, Instance, Irq, PioPin, ShiftDirection, StateMachine}; |
| 12 | use embassy_rp::{Peripheral, PeripheralRef}; | 12 | use embassy_rp::{Peripheral, PeripheralRef}; |
| 13 | use fixed::types::extra::U8; | 13 | use fixed::types::extra::U8; |
| 14 | use fixed::FixedU32; | 14 | use fixed::FixedU32; |
| @@ -161,10 +161,10 @@ where | |||
| 161 | defmt::trace!("write={} read={}", write_bits, read_bits); | 161 | defmt::trace!("write={} read={}", write_bits, read_bits); |
| 162 | 162 | ||
| 163 | unsafe { | 163 | unsafe { |
| 164 | instr::set_x(&mut self.sm, write_bits as u32); | 164 | self.sm.set_x(write_bits as u32); |
| 165 | instr::set_y(&mut self.sm, read_bits as u32); | 165 | self.sm.set_y(read_bits as u32); |
| 166 | instr::set_pindir(&mut self.sm, 0b1); | 166 | self.sm.set_pindir(0b1); |
| 167 | instr::exec_jmp(&mut self.sm, self.wrap_target); | 167 | self.sm.exec_jmp(self.wrap_target); |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | self.sm.set_enable(true); | 170 | self.sm.set_enable(true); |
| @@ -192,10 +192,10 @@ where | |||
| 192 | defmt::trace!("cmd_read cmd = {:02x} len = {}", cmd, read.len()); | 192 | defmt::trace!("cmd_read cmd = {:02x} len = {}", cmd, read.len()); |
| 193 | 193 | ||
| 194 | unsafe { | 194 | unsafe { |
| 195 | instr::set_y(&mut self.sm, read_bits as u32); | 195 | self.sm.set_y(read_bits as u32); |
| 196 | instr::set_x(&mut self.sm, write_bits as u32); | 196 | self.sm.set_x(write_bits as u32); |
| 197 | instr::set_pindir(&mut self.sm, 0b1); | 197 | self.sm.set_pindir(0b1); |
| 198 | instr::exec_jmp(&mut self.sm, self.wrap_target); | 198 | self.sm.exec_jmp(self.wrap_target); |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | // self.cs.set_low(); | 201 | // self.cs.set_low(); |
