Skip to content

Commit 2d815bf

Browse files
authored
Merge pull request #842 from jannic/update-rp2350-spi
2 parents 84e1bf0 + 1adf2b4 commit 2d815bf

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

rp235x-hal/src/spi.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -273,26 +273,9 @@ impl<S: State, D: SpiDevice, P: ValidSpiPinout<D>, const DS: u8> Spi<S, D, P, DS
273273
// Return the frequency we were able to achieve
274274
(freq_in / (prescale as u32 * (1 + postdiv as u32))).Hz()
275275
}
276-
}
277-
278-
impl<D: SpiDevice, P: ValidSpiPinout<D>, const DS: u8> Spi<Disabled, D, P, DS> {
279-
/// Create new not initialized Spi bus. Initialize it with [`.init`][Self::init]
280-
/// or [`.init_slave`][Self::init_slave].
281-
///
282-
/// Valid pin sets are in the form of `(Tx, Sck)` or `(Tx, Rx, Sck)`
283-
///
284-
/// If you pins are dynamically identified (`Pin<DynPinId, _, _>`) they will first need to pass
285-
/// validation using their corresponding [`ValidatedPinXX`](ValidatedPinTx).
286-
pub fn new(device: D, pins: P) -> Spi<Disabled, D, P, DS> {
287-
Spi {
288-
device,
289-
pins,
290-
state: PhantomData,
291-
}
292-
}
293276

294277
/// Set format and datasize
295-
fn set_format(&mut self, data_bits: u8, frame_format: FrameFormat) {
278+
pub fn set_format(&mut self, data_bits: u8, frame_format: FrameFormat) {
296279
self.device.sspcr0().modify(|_, w| unsafe {
297280
w.dss().bits(data_bits - 1).frf().bits(match &frame_format {
298281
FrameFormat::MotorolaSpi(_) => 0x00,
@@ -313,6 +296,23 @@ impl<D: SpiDevice, P: ValidSpiPinout<D>, const DS: u8> Spi<Disabled, D, P, DS> {
313296
w
314297
});
315298
}
299+
}
300+
301+
impl<D: SpiDevice, P: ValidSpiPinout<D>, const DS: u8> Spi<Disabled, D, P, DS> {
302+
/// Create new not initialized Spi bus. Initialize it with [`.init`][Self::init]
303+
/// or [`.init_slave`][Self::init_slave].
304+
///
305+
/// Valid pin sets are in the form of `(Tx, Sck)` or `(Tx, Rx, Sck)`
306+
///
307+
/// If your pins are dynamically identified (`Pin<DynPinId, _, _>`) they will first need to pass
308+
/// validation using their corresponding [`ValidatedPinXX`](ValidatedPinTx).
309+
pub fn new(device: D, pins: P) -> Spi<Disabled, D, P, DS> {
310+
Spi {
311+
device,
312+
pins,
313+
state: PhantomData,
314+
}
315+
}
316316

317317
/// Set master/slave
318318
fn set_slave(&mut self, slave: bool) {

0 commit comments

Comments
 (0)