Skip to content

Commit 37d1a7b

Browse files
authored
Consistently use PAC as pac (#196)
Signed-off-by: Daniel Egger <daniel@eggers-club.de>
1 parent 9e87923 commit 37d1a7b

File tree

9 files changed

+15
-12
lines changed

9 files changed

+15
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1919

2020
### Changed
2121

22+
- Consistently use PAC as `pac` and mark `device` and `stm32` informally as deprecated
2223
- Replace default blocking spi Write implementation with an optimized one
2324
- Use `Deref` for SPI generic implementations instead of macros
2425

examples/blinky_timer_irq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use stm32f1xx_hal as hal;
1515
use crate::hal::{
1616
gpio::*,
1717
prelude::*,
18-
stm32::{interrupt, Interrupt, Peripherals, TIM2},
18+
pac::{interrupt, Interrupt, Peripherals, TIM2},
1919
timer::*,
2020
};
2121

examples/usb_serial.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use usbd_serial::{SerialPort, USB_CLASS_CDC};
1515

1616
#[entry]
1717
fn main() -> ! {
18-
let dp = stm32::Peripherals::take().unwrap();
18+
let dp = pac::Peripherals::take().unwrap();
1919

2020
let mut flash = dp.FLASH.constrain();
2121
let mut rcc = dp.RCC.constrain();

examples/usb_serial_interrupt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extern crate panic_semihosting;
88
use cortex_m::asm::{delay, wfi};
99
use cortex_m_rt::entry;
1010
use embedded_hal::digital::v2::OutputPin;
11-
use stm32f1xx_hal::stm32::{interrupt, Interrupt};
11+
use stm32f1xx_hal::pac::{interrupt, Interrupt};
1212
use stm32f1xx_hal::usb::{Peripheral, UsbBus, UsbBusType};
1313
use stm32f1xx_hal::{prelude::*, stm32};
1414
use usb_device::{bus::UsbBusAllocator, prelude::*};
@@ -21,7 +21,7 @@ static mut USB_DEVICE: Option<UsbDevice<UsbBusType>> = None;
2121
#[entry]
2222
fn main() -> ! {
2323
let p = cortex_m::Peripherals::take().unwrap();
24-
let dp = stm32::Peripherals::take().unwrap();
24+
let dp = pac::Peripherals::take().unwrap();
2525

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

src/adc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ use crate::dma::{Receive, TransferPayload, dma1::C1, CircBuffer, Transfer, W, Rx
1010
use core::sync::atomic::{self, Ordering};
1111
use cortex_m::asm::delay;
1212

13-
use crate::stm32::ADC1;
13+
use crate::pac::ADC1;
1414
#[cfg(feature = "stm32f103")]
15-
use crate::stm32::ADC2;
15+
use crate::pac::ADC2;
1616
#[cfg(all(
1717
feature = "stm32f103",
1818
feature = "high",
1919
))]
20-
use crate::stm32::ADC3;
20+
use crate::pac::ADC3;
2121

2222
/// Continuous mode
2323
pub struct Continuous;

src/gpio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use core::marker::PhantomData;
1818

1919
use crate::rcc::APB2;
20-
use crate::stm32::EXTI;
20+
use crate::pac::EXTI;
2121
use crate::afio;
2222

2323
/// Extension trait to split a GPIO peripheral in independent pins and registers
@@ -108,7 +108,7 @@ macro_rules! gpio {
108108

109109
use crate::hal::digital::v2::{InputPin, OutputPin, StatefulOutputPin, toggleable};
110110
use crate::pac::{$gpioy, $GPIOX};
111-
use crate::stm32::EXTI;
111+
use crate::pac::EXTI;
112112
use crate::afio;
113113

114114
use crate::rcc::{APB2, Enable, Reset};

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,11 @@ pub use stm32f1::stm32f101 as pac;
9090
pub use stm32f1::stm32f103 as pac;
9191

9292
#[cfg(feature = "device-selected")]
93+
#[deprecated(since="0.6.0", note="please use `pac` instead")]
9394
pub use crate::pac as device;
9495

9596
#[cfg(feature = "device-selected")]
97+
#[deprecated(since="0.6.0", note="please use `pac` instead")]
9698
pub use crate::pac as stm32;
9799

98100
#[cfg(feature = "device-selected")]

src/serial.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ pub struct Tx<USART> {
193193
}
194194

195195
/// Internal trait for the serial read / write logic.
196-
trait UsartReadWrite: Deref<Target=crate::stm32::usart1::RegisterBlock> {
196+
trait UsartReadWrite: Deref<Target=crate::pac::usart1::RegisterBlock> {
197197
fn read(&self) -> nb::Result<u8, Error> {
198198
let sr = self.sr.read();
199199

@@ -259,7 +259,7 @@ trait UsartReadWrite: Deref<Target=crate::stm32::usart1::RegisterBlock> {
259259
}
260260
}
261261
}
262-
impl UsartReadWrite for &crate::stm32::usart1::RegisterBlock {}
262+
impl UsartReadWrite for &crate::pac::usart1::RegisterBlock {}
263263

264264
macro_rules! hal {
265265
($(

src/watchdog.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Watchdog peripherals
22
33
use crate::{
4-
stm32::{IWDG, DBGMCU as DBG},
4+
pac::{IWDG, DBGMCU as DBG},
55
hal::watchdog::{Watchdog, WatchdogEnable},
66
time::MilliSeconds,
77
};

0 commit comments

Comments
 (0)