Skip to content

Commit 1baef64

Browse files
bors[bot]burrbull
andauthored
Merge #418
418: const generics before mode r=therealprof a=burrbull Requires Rust 1.59 Co-authored-by: Andrey Zgarbul <[email protected]>
2 parents be4d08d + 461df42 commit 1baef64

21 files changed

+493
-484
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Move pin mode at the end of generics, add defaults for modes,
13+
bump MSRV to 1.59 [#418]
14+
1015
### Added
1116

1217
- Support eMMC peripherals using SDIO module [#458]
1318

19+
[#418]: https://github.com/stm32-rs/stm32f4xx-hal/pull/418
20+
[#458]: https://github.com/stm32-rs/stm32f4xx-hal/pull/458
21+
1422
## [v0.12.0] - 2022-02-23
1523

1624
### Changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[package]
2-
edition = "2018"
2+
edition = "2021"
3+
rust-version = "1.59"
34

45
authors = ["Daniel Egger <[email protected]>"]
56
categories = [

examples/i2s-audio-out-dma.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ use stm32_i2s_v12x::{MasterClock, MasterConfig, Polarity, TransmitMode};
5151
use stm32f4xx_hal::dma::config::DmaConfig;
5252
use stm32f4xx_hal::dma::MemoryToPeripheral;
5353
use stm32f4xx_hal::dma::{Stream5, StreamsTuple, Transfer};
54-
use stm32f4xx_hal::gpio::{Alternate, PushPull, PA4, PC10, PC12, PC7};
54+
use stm32f4xx_hal::gpio::{Alternate, PA4, PC10, PC12, PC7};
5555
use stm32f4xx_hal::i2c::I2c;
5656
use stm32f4xx_hal::i2s::I2s;
5757
use stm32f4xx_hal::pac::{interrupt, Interrupt};
@@ -214,10 +214,10 @@ type I2sDmaTransfer = Transfer<
214214
I2s<
215215
SPI3,
216216
(
217-
PA4<Alternate<PushPull, 6>>,
218-
PC10<Alternate<PushPull, 6>>,
219-
PC7<Alternate<PushPull, 6>>,
220-
PC12<Alternate<PushPull, 6>>,
217+
PA4<Alternate<6>>,
218+
PC10<Alternate<6>>,
219+
PC7<Alternate<6>>,
220+
PC12<Alternate<6>>,
221221
),
222222
>,
223223
TransmitMode<Data16Frame16>,

examples/rtic-tick.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use panic_halt as _;
66
#[rtic::app(device = stm32f4xx_hal::pac, dispatchers = [USART1])]
77
mod app {
88
use stm32f4xx_hal::{
9-
gpio::{Output, PushPull, PC13},
9+
gpio::{Output, PC13},
1010
pac,
1111
prelude::*,
1212
timer::MonoTimerUs,
@@ -17,7 +17,7 @@ mod app {
1717

1818
#[local]
1919
struct Local {
20-
led: PC13<Output<PushPull>>,
20+
led: PC13<Output>,
2121
}
2222

2323
#[monotonic(binds = TIM2, default = true)]

src/can.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ pub trait Pins<CAN> {
2727

2828
impl<CAN, TX, RX, const TXA: u8, const RXA: u8> Pins<CAN> for (TX, RX)
2929
where
30-
TX: PinA<Tx, CAN, A = Const<TXA>> + SetAlternate<PushPull, TXA>,
31-
RX: PinA<Rx, CAN, A = Const<RXA>> + SetAlternate<PushPull, RXA>,
30+
TX: PinA<Tx, CAN, A = Const<TXA>> + SetAlternate<TXA, PushPull>,
31+
RX: PinA<Rx, CAN, A = Const<RXA>> + SetAlternate<RXA, PushPull>,
3232
{
3333
fn set_alt_mode(&mut self) {
3434
self.0.set_alt_mode();

src/fsmc_lcd/pins.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ mod common_pins {
604604
};
605605

606606
// All FSMC/FMC pins use AF12
607-
type FmcAlternate = Alternate<PushPull, 12>;
607+
type FmcAlternate = Alternate<12, PushPull>;
608608

609609
impl PinD2 for PD0<FmcAlternate> {}
610610
impl PinD3 for PD1<FmcAlternate> {}
@@ -723,36 +723,36 @@ mod extra_pins {
723723
};
724724

725725
// Most FSMC/FMC pins use AF12, but a few use AF10
726-
type FmcAlternate = Alternate<PushPull, 12>;
726+
type FmcAlternate = Alternate<12, PushPull>;
727727

728728
impl PinD4 for PA2<FmcAlternate> {}
729729
impl PinD5 for PA3<FmcAlternate> {}
730730
impl PinD6 for PA4<FmcAlternate> {}
731731
impl PinD7 for PA5<FmcAlternate> {}
732732
impl PinD13 for PB12<FmcAlternate> {}
733-
impl PinD0 for PB14<Alternate<PushPull, 10>> {}
733+
impl PinD0 for PB14<Alternate<10, PushPull>> {}
734734
impl PinWriteEnable for PC2<FmcAlternate> {}
735735
impl PinAddress for PC3<FmcAlternate> {}
736736
impl Sealed for PC3<FmcAlternate> {}
737737
impl PinChipSelect4 for PC4<FmcAlternate> {}
738738
impl Sealed for PC4<FmcAlternate> {}
739739
impl PinReadEnable for PC5<FmcAlternate> {}
740-
impl PinD1 for PC6<Alternate<PushPull, 10>> {}
741-
impl PinD2 for PC11<Alternate<PushPull, 10>> {}
742-
impl PinD3 for PC12<Alternate<PushPull, 10>> {}
743-
impl PinWriteEnable for PD2<Alternate<PushPull, 10>> {}
740+
impl PinD1 for PC6<Alternate<10, PushPull>> {}
741+
impl PinD2 for PC11<Alternate<10, PushPull>> {}
742+
impl PinD3 for PC12<Alternate<10, PushPull>> {}
743+
impl PinWriteEnable for PD2<Alternate<10, PushPull>> {}
744744

745745
// Sealed trait boilerplate
746746
impl Sealed for PA2<FmcAlternate> {}
747747
impl Sealed for PA3<FmcAlternate> {}
748748
impl Sealed for PA4<FmcAlternate> {}
749749
impl Sealed for PA5<FmcAlternate> {}
750750
impl Sealed for PB12<FmcAlternate> {}
751-
impl Sealed for PB14<Alternate<PushPull, 10>> {}
751+
impl Sealed for PB14<Alternate<10, PushPull>> {}
752752
impl Sealed for PC2<FmcAlternate> {}
753753
impl Sealed for PC5<FmcAlternate> {}
754-
impl Sealed for PC6<Alternate<PushPull, 10>> {}
755-
impl Sealed for PC11<Alternate<PushPull, 10>> {}
756-
impl Sealed for PC12<Alternate<PushPull, 10>> {}
757-
impl Sealed for PD2<Alternate<PushPull, 10>> {}
754+
impl Sealed for PC6<Alternate<10, PushPull>> {}
755+
impl Sealed for PC11<Alternate<10, PushPull>> {}
756+
impl Sealed for PC12<Alternate<10, PushPull>> {}
757+
impl Sealed for PD2<Alternate<10, PushPull>> {}
758758
}

0 commit comments

Comments
 (0)