Skip to content

Commit

Permalink
Fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
little-arhat committed Jun 5, 2019
1 parent 1464d63 commit a1d25eb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
20 changes: 10 additions & 10 deletions src/rcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,12 @@ impl CFGR {
0 => panic!("Requested HCLK is higher than generated SYSCLK"),
1 => 0b0111,
2 => 0b1000,
3...5 => 0b1001,
6...11 => 0b1010,
12...39 => 0b1011,
40...95 => 0b1100,
96...191 => 0b1101,
192...383 => 0b1110,
3..=5 => 0b1001,
6..=11 => 0b1010,
12..=39 => 0b1011,
40..=95 => 0b1100,
96..=191 => 0b1101,
192..=383 => 0b1110,
_ => 0b1111,
}
})
Expand All @@ -280,8 +280,8 @@ impl CFGR {
0 => panic!("Requested PCLK1 is higher than generated HCLK"),
1 => 0b011,
2 => 0b100,
3...5 => 0b101,
6...11 => 0b110,
3..=5 => 0b101,
6..=11 => 0b110,
_ => 0b111,
}
})
Expand All @@ -298,8 +298,8 @@ impl CFGR {
0 => panic!("Requested PCLK2 is higher than generated HCLK"),
1 => 0b011,
2 => 0b100,
3...5 => 0b101,
6...11 => 0b110,
3..=5 => 0b101,
6..=11 => 0b110,
_ => 0b111,
}
})
Expand Down
18 changes: 10 additions & 8 deletions src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
use core::ptr;

use crate::pac::{RCC, SPI1, SPI2, SPI3};
use hal::spi::{FullDuplex, Mode, Phase, Polarity};
use nb;
use crate::pac::{RCC, SPI1, SPI2, SPI3};

use crate::gpio::{AltFn, PullType, AF5, AF6};
use crate::gpio::{HighSpeed, PinMode, PushPull};
Expand Down Expand Up @@ -169,13 +169,13 @@ macro_rules! spi {

let br = match clocks.$pclkX().0 / freq.into().0 {
0 => unreachable!(),
1...2 => 0b000,
3...5 => 0b001,
6...11 => 0b010,
12...23 => 0b011,
24...39 => 0b100,
40...95 => 0b101,
96...191 => 0b110,
1..=2 => 0b000,
3..=5 => 0b001,
6..=11 => 0b010,
12..=23 => 0b011,
24..=39 => 0b100,
40..=95 => 0b101,
96..=191 => 0b110,
_ => 0b111,
};

Expand Down Expand Up @@ -284,6 +284,8 @@ macro_rules! spi {
};
}

//// DEFINE traits for Spi1Sck, Spi1Miso or, even better Sck<dev = SPI1>

spi!(SPI1,
apb2enr,
apb2rstr,
Expand Down

0 comments on commit a1d25eb

Please sign in to comment.