rp/pio: move instructions to methods of the SM.
This commit is contained in:
@@ -8,7 +8,7 @@ use core::slice;
|
||||
use cyw43::SpiBusCyw43;
|
||||
use embassy_rp::dma::Channel;
|
||||
use embassy_rp::gpio::{Drive, Level, Output, Pull, SlewRate};
|
||||
use embassy_rp::pio::{instr, Common, Config, Direction, Instance, Irq, PioPin, ShiftDirection, StateMachine};
|
||||
use embassy_rp::pio::{Common, Config, Direction, Instance, Irq, PioPin, ShiftDirection, StateMachine};
|
||||
use embassy_rp::{Peripheral, PeripheralRef};
|
||||
use fixed::types::extra::U8;
|
||||
use fixed::FixedU32;
|
||||
@@ -161,10 +161,10 @@ where
|
||||
defmt::trace!("write={} read={}", write_bits, read_bits);
|
||||
|
||||
unsafe {
|
||||
instr::set_x(&mut self.sm, write_bits as u32);
|
||||
instr::set_y(&mut self.sm, read_bits as u32);
|
||||
instr::set_pindir(&mut self.sm, 0b1);
|
||||
instr::exec_jmp(&mut self.sm, self.wrap_target);
|
||||
self.sm.set_x(write_bits as u32);
|
||||
self.sm.set_y(read_bits as u32);
|
||||
self.sm.set_pindir(0b1);
|
||||
self.sm.exec_jmp(self.wrap_target);
|
||||
}
|
||||
|
||||
self.sm.set_enable(true);
|
||||
@@ -192,10 +192,10 @@ where
|
||||
defmt::trace!("cmd_read cmd = {:02x} len = {}", cmd, read.len());
|
||||
|
||||
unsafe {
|
||||
instr::set_y(&mut self.sm, read_bits as u32);
|
||||
instr::set_x(&mut self.sm, write_bits as u32);
|
||||
instr::set_pindir(&mut self.sm, 0b1);
|
||||
instr::exec_jmp(&mut self.sm, self.wrap_target);
|
||||
self.sm.set_y(read_bits as u32);
|
||||
self.sm.set_x(write_bits as u32);
|
||||
self.sm.set_pindir(0b1);
|
||||
self.sm.exec_jmp(self.wrap_target);
|
||||
}
|
||||
|
||||
// self.cs.set_low();
|
||||
|
||||
Reference in New Issue
Block a user