Skip to content

Commit b2573c3

Browse files
committed
clean
1 parent 57a03a5 commit b2573c3

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

src/spi.rs

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ use crate::stm32::rcc::{d2ccip1r as ccip1r, d3ccipr as srdccipr};
8282
use crate::stm32::spi1::{
8383
cfg1::MBR_A as MBR, cfg2::COMM_A as COMM, cfg2::SSIOP_A as SSIOP,
8484
};
85-
use crate::stm32::{SPI1, SPI2, SPI3, SPI4, SPI5, SPI6};
8685
use crate::time::Hertz;
8786

8887
/// SPI error
@@ -547,7 +546,7 @@ macro_rules! word {
547546
word!(u8, u16, u32);
548547

549548
macro_rules! spi {
550-
($($SPIX:ident: $Rec:ident,)+) => {
549+
($($SPIX:ty: $Rec:ident,)+) => {
551550
$(
552551
impl<TY> Spi<$SPIX, Disabled, TY> where $SPIX: Instance {
553552
/// Deconstructs the SPI peripheral and returns the component parts.
@@ -558,6 +557,14 @@ macro_rules! spi {
558557
)+
559558
}
560559
}
560+
spi! {
561+
pac::SPI1: Spi1,
562+
pac::SPI2: Spi2,
563+
pac::SPI3: Spi3,
564+
pac::SPI4: Spi4,
565+
pac::SPI5: Spi5,
566+
pac::SPI6: Spi6,
567+
}
561568

562569
impl<SPI: Instance, TY: Word> Spi<SPI, Enabled, TY> {
563570
fn new<PINS>(
@@ -1188,7 +1195,7 @@ impl<SPI: Instance, WORD> Spi<SPI, Enabled, WORD> {
11881195
}
11891196

11901197
macro_rules! spi123sel {
1191-
($($SPIX:ident: ($spiX:ident, $Rec:ident),)+) => {
1198+
($($SPIX:ty: ($spiX:ident, $Rec:ident),)+) => {
11921199
$(
11931200
impl crate::Sealed for $SPIX { }
11941201
impl Instance for $SPIX {
@@ -1244,7 +1251,7 @@ macro_rules! spi123sel {
12441251
}
12451252
}
12461253
macro_rules! spi45sel {
1247-
($($SPIX:ident: ($spiX:ident, $Rec:ident),)+) => {
1254+
($($SPIX:ty: ($spiX:ident, $Rec:ident),)+) => {
12481255
$(
12491256
impl crate::Sealed for $SPIX { }
12501257
impl Instance for $SPIX {
@@ -1302,7 +1309,7 @@ macro_rules! spi45sel {
13021309
}
13031310
}
13041311
macro_rules! spi6sel {
1305-
($($SPIX:ident: ($spiX:ident, $Rec:ident),)+) => {
1312+
($($SPIX:ty: ($spiX:ident, $Rec:ident),)+) => {
13061313
$(
13071314
impl crate::Sealed for $SPIX { }
13081315
impl Instance for $SPIX {
@@ -1360,24 +1367,15 @@ macro_rules! spi6sel {
13601367
}
13611368
}
13621369

1363-
spi! {
1364-
SPI1: Spi1,
1365-
SPI2: Spi2,
1366-
SPI3: Spi3,
1367-
SPI4: Spi4,
1368-
SPI5: Spi5,
1369-
SPI6: Spi6,
1370-
}
1371-
13721370
spi123sel! {
1373-
SPI1: (spi1, Spi1),
1374-
SPI2: (spi2, Spi2),
1375-
SPI3: (spi3, Spi3),
1371+
pac::SPI1: (spi1, Spi1),
1372+
pac::SPI2: (spi2, Spi2),
1373+
pac::SPI3: (spi3, Spi3),
13761374
}
13771375
spi45sel! {
1378-
SPI4: (spi4, Spi4),
1379-
SPI5: (spi5, Spi5),
1376+
pac::SPI4: (spi4, Spi4),
1377+
pac::SPI5: (spi5, Spi5),
13801378
}
13811379
spi6sel! {
1382-
SPI6: (spi6, Spi6),
1380+
pac::SPI6: (spi6, Spi6),
13831381
}

0 commit comments

Comments
 (0)