diff --git a/rp235x-hal/src/spi.rs b/rp235x-hal/src/spi.rs index 0414342df..61cf85f85 100644 --- a/rp235x-hal/src/spi.rs +++ b/rp235x-hal/src/spi.rs @@ -273,26 +273,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, @@ -313,6 +296,23 @@ impl, const DS: u8> Spi { w }); } +} + +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 your 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) {