diff --git a/rp2040-hal/src/spi.rs b/rp2040-hal/src/spi.rs index f890e9aa6..a3e9ae466 100644 --- a/rp2040-hal/src/spi.rs +++ b/rp2040-hal/src/spi.rs @@ -247,26 +247,9 @@ impl, const DS: u8> Spi, const DS: u8> Spi { - /// Create new not initialized Spi bus. Initialize it with [`.init`][Self::init] - /// or [`.init_slave`][Self::init_slave]. - /// - /// Valid pin sets are in the form of `(Tx, Sck)` or `(Tx, Rx, Sck)` - /// - /// If you pins are dynamically identified (`Pin`) they will first need to pass - /// validation using their corresponding [`ValidatedPinXX`](ValidatedPinTx). - pub fn new(device: D, pins: P) -> Spi { - Spi { - device, - pins, - state: PhantomData, - } - } /// Set format and datasize - fn set_format(&mut self, data_bits: u8, frame_format: FrameFormat) { + pub fn set_format(&mut self, data_bits: u8, frame_format: FrameFormat) { self.device.sspcr0().modify(|_, w| unsafe { w.dss().bits(data_bits - 1).frf().bits(match &frame_format { FrameFormat::MotorolaSpi(_) => 0x00, @@ -288,6 +271,24 @@ impl, const DS: u8> Spi { }); } +} + +impl, const DS: u8> Spi { + /// Create new not initialized Spi bus. Initialize it with [`.init`][Self::init] + /// or [`.init_slave`][Self::init_slave]. + /// + /// Valid pin sets are in the form of `(Tx, Sck)` or `(Tx, Rx, Sck)` + /// + /// If you pins are dynamically identified (`Pin`) they will first need to pass + /// validation using their corresponding [`ValidatedPinXX`](ValidatedPinTx). + pub fn new(device: D, pins: P) -> Spi { + Spi { + device, + pins, + state: PhantomData, + } + } + /// Set master/slave fn set_slave(&mut self, slave: bool) { if slave {