@@ -273,26 +273,9 @@ impl<S: State, D: SpiDevice, P: ValidSpiPinout<D>, const DS: u8> Spi<S, D, P, DS
273
273
// Return the frequency we were able to achieve
274
274
( freq_in / ( prescale as u32 * ( 1 + postdiv as u32 ) ) ) . Hz ( )
275
275
}
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
- }
293
276
294
277
/// 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 ) {
296
279
self . device . sspcr0 ( ) . modify ( |_, w| unsafe {
297
280
w. dss ( ) . bits ( data_bits - 1 ) . frf ( ) . bits ( match & frame_format {
298
281
FrameFormat :: MotorolaSpi ( _) => 0x00 ,
@@ -313,6 +296,23 @@ impl<D: SpiDevice, P: ValidSpiPinout<D>, const DS: u8> Spi<Disabled, D, P, DS> {
313
296
w
314
297
} ) ;
315
298
}
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
+ }
316
316
317
317
/// Set master/slave
318
318
fn set_slave ( & mut self , slave : bool ) {
0 commit comments