Skip to content

Commit cf11d55

Browse files
committed
Remove stm32 module in favor of pac
1 parent 321a503 commit cf11d55

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ let clocks = rcc
6262
in alternate function mode ([#189])
6363
- GPIO internal resistor configuration is no longer encoded into pin typestate
6464
in input mode ([#189])
65+
- Remove `stm32` module. Use `use stm32f3xx_hal::pac` instead.
66+
This module was a deprecated in [v0.5.0][] and is now subject for
67+
removal. ([#220])
6568

6669
## [v0.6.1] - 2020-12-10
6770

@@ -316,6 +319,7 @@ let clocks = rcc
316319
[defmt]: https://github.com/knurling-rs/defmt
317320
[filter]: https://defmt.ferrous-systems.com/filtering.html
318321

322+
[#220]: https://github.com/stm32-rs/stm32f3xx-hal/pull/220
319323
[#217]: https://github.com/stm32-rs/stm32f3xx-hal/pull/217
320324
[#216]: https://github.com/stm32-rs/stm32f3xx-hal/pull/216
321325
[#211]: https://github.com/stm32-rs/stm32f3xx-hal/pull/211

examples/can.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use stm32f3xx_hal as hal;
99
use cortex_m::asm;
1010
use cortex_m_rt::entry;
1111

12+
use hal::pac;
1213
use hal::prelude::*;
13-
use hal::stm32;
1414
use hal::watchdog::IndependentWatchDog;
1515

1616
use hal::can::{Can, CanFilter, CanFrame, CanId, Filter, Frame, Receiver, Transmitter};
@@ -22,7 +22,7 @@ const ID: u16 = 0b100;
2222

2323
#[entry]
2424
fn main() -> ! {
25-
let dp = stm32::Peripherals::take().unwrap();
25+
let dp = pac::Peripherals::take().unwrap();
2626

2727
let mut flash = dp.FLASH.constrain();
2828
let mut rcc = dp.RCC.constrain();

src/can.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ pub use embedded_hal_can::{self, Filter, Frame, Id, Receiver, Transmitter};
1515

1616
use crate::gpio::gpioa;
1717
use crate::gpio::{PushPull, AF9};
18+
use crate::pac;
1819
use crate::rcc::APB1;
19-
use crate::stm32;
2020
use nb::{self, Error};
2121

2222
use core::sync::atomic::{AtomicU8, Ordering};
23-
pub use stm32::can::btr::LBKM_A;
23+
pub use pac::can::btr::LBKM_A;
2424

2525
const EXID_MASK: u32 = 0b1_1111_1111_1100_0000_0000_0000_0000;
2626
const MAX_EXTENDED_ID: u32 = 0x1FFF_FFFF;
@@ -147,7 +147,7 @@ static FILTER_INDEX: AtomicU8 = AtomicU8::new(0);
147147

148148
/// Controll Area Network (CAN) Peripheral
149149
pub struct Can {
150-
can: stm32::CAN,
150+
can: pac::CAN,
151151
_rx: gpioa::PA11<AF9<PushPull>>,
152152
_tx: gpioa::PA12<AF9<PushPull>>,
153153
}
@@ -160,7 +160,7 @@ pub struct CanFifo {
160160

161161
/// A CAN transmitter which is used to send messages to the CAN network.
162162
pub struct CanTransmitter {
163-
_can: stm32::CAN,
163+
_can: pac::CAN,
164164
_rx: gpioa::PA11<AF9<PushPull>>,
165165
_tx: gpioa::PA12<AF9<PushPull>>,
166166
}
@@ -316,7 +316,7 @@ impl CanFilterData {
316316
impl Can {
317317
/// Initialize the CAN peripheral using the options specified by `opts`.
318318
pub fn new_with_opts(
319-
can: stm32::CAN,
319+
can: pac::CAN,
320320
rx: gpioa::PA11<AF9<PushPull>>,
321321
tx: gpioa::PA12<AF9<PushPull>>,
322322
apb1: &mut APB1,
@@ -362,7 +362,7 @@ impl Can {
362362
}
363363
/// Initialize the CAN Peripheral using default options from `CanOpts::default()`
364364
pub fn new(
365-
can: stm32::CAN,
365+
can: pac::CAN,
366366
rx: gpioa::PA11<AF9<PushPull>>,
367367
tx: gpioa::PA12<AF9<PushPull>>,
368368
apb1: &mut APB1,
@@ -399,7 +399,7 @@ impl Can {
399399
pub fn free(
400400
self,
401401
) -> (
402-
stm32::CAN,
402+
pac::CAN,
403403
gpioa::PA11<AF9<PushPull>>,
404404
gpioa::PA12<AF9<PushPull>>,
405405
) {
@@ -426,7 +426,7 @@ impl embedded_hal_can::Transmitter for CanTransmitter {
426426
&mut self,
427427
frame: &Self::Frame,
428428
) -> Result<Option<Self::Frame>, nb::Error<Self::Error>> {
429-
let can = unsafe { &*stm32::CAN::ptr() };
429+
let can = unsafe { &*pac::CAN::ptr() };
430430

431431
for tx_idx in 0..3 {
432432
let free = match tx_idx {
@@ -489,7 +489,7 @@ impl embedded_hal_can::Transmitter for CanTransmitter {
489489

490490
impl Receiver for CanFifo {
491491
fn receive(&mut self) -> Result<Self::Frame, Error<Self::Error>> {
492-
let can = unsafe { &*stm32::CAN::ptr() };
492+
let can = unsafe { &*pac::CAN::ptr() };
493493

494494
let rx = &can.rx[self.idx];
495495
if can.rfr[self.idx].read().fmp().bits() > 0 {
@@ -541,7 +541,7 @@ impl Receiver for CanFifo {
541541
/// Sets a filter in the next open filter register.
542542
fn set_filter(&mut self, filter: Self::Filter) {
543543
cortex_m::interrupt::free(|_cs| {
544-
let can = unsafe { &*stm32::CAN::ptr() };
544+
let can = unsafe { &*pac::CAN::ptr() };
545545

546546
// Filter init mode
547547
can.fmr.modify(|_, w| w.finit().set_bit());

src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,7 @@ pub use stm32f3::stm32f373 as pac;
104104
#[cfg(feature = "svd-f3x4")]
105105
pub use stm32f3::stm32f3x4 as pac;
106106

107-
/// Peripheral access
108-
#[deprecated(since = "0.5.0", note = "please use `pac` instead")]
109-
pub use crate::pac as stm32;
110-
111-
// Enable use of interrupt macro
107+
/// Enable use of interrupt macro
112108
#[cfg(feature = "rt")]
113109
pub use crate::pac::interrupt;
114110

src/spi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::stm32::spi1;
2121
feature = "stm32f303xe",
2222
feature = "stm32f398",
2323
))]
24-
use crate::stm32::SPI4;
24+
use crate::pac::SPI4;
2525

2626
#[cfg(any(feature = "stm32f373", feature = "stm32f378"))]
2727
use crate::gpio::gpioa::{PA1, PA10, PA12, PA13, PA2, PA3, PA8, PA9};

0 commit comments

Comments
 (0)