Skip to content

Commit 902c28a

Browse files
committed
Introduce SPI3 instead of SPI1 for test and examples
1 parent 89ae854 commit 902c28a

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

examples/spi.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn main() -> ! {
2020

2121
let mut flash = dp.FLASH.constrain();
2222
let mut rcc = dp.RCC.constrain();
23-
let mut gpioa = dp.GPIOA.split(&mut rcc.ahb);
23+
let mut gpioc = dp.GPIOC.split(&mut rcc.ahb);
2424

2525
let clocks = rcc
2626
.cfgr
@@ -30,28 +30,28 @@ fn main() -> ! {
3030
.freeze(&mut flash.acr);
3131

3232
// Configure pins for SPI
33-
let sck = gpioa
34-
.pa5
35-
.into_af5_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrl);
36-
let miso = gpioa
37-
.pa6
38-
.into_af5_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrl);
39-
let mosi = gpioa
40-
.pa7
41-
.into_af5_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrl);
33+
let sck = gpioc
34+
.pc10
35+
.into_af6_push_pull(&mut gpioc.moder, &mut gpioc.otyper, &mut gpioc.afrh);
36+
let miso = gpioc
37+
.pc11
38+
.into_af6_push_pull(&mut gpioc.moder, &mut gpioc.otyper, &mut gpioc.afrh);
39+
let mosi = gpioc
40+
.pc12
41+
.into_af6_push_pull(&mut gpioc.moder, &mut gpioc.otyper, &mut gpioc.afrh);
4242

4343
let spi_mode = Mode {
4444
polarity: Polarity::IdleLow,
4545
phase: Phase::CaptureOnFirstTransition,
4646
};
4747

4848
let mut spi = Spi::new(
49-
dp.SPI1,
49+
dp.SPI3,
5050
(sck, miso, mosi),
5151
spi_mode,
5252
3_000_000.Hz(),
5353
clocks,
54-
&mut rcc.apb2,
54+
&mut rcc.apb1,
5555
);
5656

5757
// Create an `u8` array, which can be transfered via SPI.

testsuite/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ pub struct CrossSerialPair1<T1, T2>(pub PA2<T1>, pub PB11<T2>);
4545
/// This is used for UART, where UART3(TX) is connected to UART2(RX)
4646
pub struct CrossSerialPair2<T1, T2>(pub PB10<T1>, pub PA3<T2>);
4747

48+
/// Pin Pair directly connected to each other.
49+
///
50+
/// This is used for SPI, where SPI3(TX) is connected to SPI3(RX)
51+
pub struct SpiPair<T>(pub PC10<T>, pub PC11<T>, pub PC12<T>);
52+
4853
#[export_name = "main"]
4954
unsafe extern "C" fn __dummy_entry() -> ! {
5055
defmt_test::export::exit()

0 commit comments

Comments
 (0)