Skip to content

Commit

Permalink
mode after pin number
Browse files Browse the repository at this point in the history
  • Loading branch information
burrbull committed Mar 20, 2022
1 parent b72ab2a commit f76f433
Show file tree
Hide file tree
Showing 14 changed files with 244 additions and 254 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## Changed

- `gpio` updates & cleanups: mode after pin numbers (Rust 1.59), default modes
- Use `fugit` duration nd rate units instead of custom
- Use const-generics for GPIO (require Rust 1.51)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ _formerly [MabezDev/stm32l4xx-hal](https://github.com/mabezdev/stm32l4xx-hal)_

## About

- Minimum rustc version 1.31
- Minimum rustc version 1.59

## License

Expand Down
10 changes: 3 additions & 7 deletions src/can.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ pub trait Pins: sealed::Sealed {
macro_rules! pins {
($($PER:ident => ($tx:ident<$txaf:literal>, $rx:ident<$rxaf:literal>),)+) => {
$(
impl crate::can::sealed::Sealed for ($tx<crate::gpio::Alternate<PushPull, $txaf, >>, $rx<crate::gpio::Alternate<PushPull, $rxaf>>) {}
impl crate::can::Pins for ($tx<crate::gpio::Alternate<PushPull, $txaf, >>, $rx<crate::gpio::Alternate<PushPull, $rxaf>>) {
impl crate::can::sealed::Sealed for ($tx<crate::gpio::Alternate<$txaf>>, $rx<crate::gpio::Alternate<$rxaf>>) {}
impl crate::can::Pins for ($tx<crate::gpio::Alternate<$txaf>>, $rx<crate::gpio::Alternate<$rxaf>>) {
type Instance = $PER;
}
)+
Expand All @@ -33,7 +33,6 @@ mod common_pins {
gpioa::{PA11, PA12},
gpiob::{PB8, PB9},
gpiod::{PD0, PD1},
PushPull,
};
use crate::pac::CAN1;

Expand All @@ -48,10 +47,7 @@ mod common_pins {
// L4x1
#[cfg(any(feature = "stm32l431", feature = "stm32l451", feature = "stm32l471"))]
mod pb13_pb12_af10 {
use crate::gpio::{
gpiob::{PB12, PB13},
PushPull,
};
use crate::gpio::gpiob::{PB12, PB13};
use crate::pac::CAN1;
pins! { CAN1 => (PB13<10>, PB12<10>), }
}
Expand Down
Loading

0 comments on commit f76f433

Please sign in to comment.