Skip to content

Commit f635c08

Browse files
authored
Merge pull request #101 from Sh3Rm4n/pac
Rename stm32 to pac
2 parents b2a4c0f + f97d1b1 commit f635c08

File tree

17 files changed

+78
-64
lines changed

17 files changed

+78
-64
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ let clocks = rcc
3737
- The feature gate requires you to select a subvariant if possible. ([#75](https://github.com/stm32-rs/stm32f3xx-hal/pull/75))
3838
- Split up `stm32f302` into sub-targets `stm32f302xb`,`stm32f302xc`,`stm32f302xd`,`stm32f302xe`
3939
- Bump `stm32f3` dependency to `0.11.0` ([#97](https://github.com/stm32-rs/stm32f3xx-hal/pull/97))
40+
- The `stm32f3` reexport is now renamed from `stm32` to `pac` ([#101](https://github.com/stm32-rs/stm32f3xx-hal/pull/101))
4041

4142
## [v0.4.3] - 2020-04-11
4243

examples/pwm.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,24 @@
55

66
use panic_semihosting as _;
77

8+
use stm32f3xx_hal as hal;
9+
810
use cortex_m_rt::entry;
11+
912
//use cortex_m_semihosting::hprintln;
10-
use embedded_hal::PwmPin;
11-
use stm32f3::stm32f303;
12-
use stm32f3xx_hal::flash::FlashExt;
13-
use stm32f3xx_hal::gpio::GpioExt;
14-
use stm32f3xx_hal::pwm::{tim16, tim2, tim3, tim8};
15-
use stm32f3xx_hal::rcc::RccExt;
16-
use stm32f3xx_hal::time::U32Ext;
13+
use hal::hal::PwmPin;
14+
15+
use hal::flash::FlashExt;
16+
use hal::gpio::GpioExt;
17+
use hal::pac;
18+
use hal::pwm::{tim16, tim2, tim3, tim8};
19+
use hal::rcc::RccExt;
20+
use hal::time::U32Ext;
1721

1822
#[entry]
1923
fn main() -> ! {
2024
// Get our peripherals
21-
let dp = stm32f303::Peripherals::take().unwrap();
25+
let dp = pac::Peripherals::take().unwrap();
2226

2327
// Configure our clocks
2428
let mut flash = dp.FLASH.constrain();

examples/spi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ use stm32f3xx_hal as hal;
99

1010
use cortex_m_rt::entry;
1111

12+
use hal::pac;
1213
use hal::prelude::*;
1314
use hal::spi::{Mode, Phase, Polarity, Spi};
14-
use hal::stm32;
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/toggle.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88

99
use panic_semihosting as _;
1010

11+
use stm32f3xx_hal as hal;
12+
1113
use cortex_m_rt::entry;
12-
use stm32f3xx_hal::prelude::*;
13-
use stm32f3xx_hal::stm32;
14+
use hal::pac;
15+
use hal::prelude::*;
1416

1517
#[entry]
1618
fn main() -> ! {
17-
let dp = stm32::Peripherals::take().unwrap();
19+
let dp = pac::Peripherals::take().unwrap();
1820

1921
let mut rcc = dp.RCC.constrain();
2022
let mut gpioe = dp.GPIOE.split(&mut rcc.ahb);

examples/usb_serial.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,21 @@
55

66
use panic_semihosting as _;
77

8+
use stm32f3xx_hal as hal;
9+
810
use cortex_m::asm::delay;
911
use cortex_m_rt::entry;
10-
use stm32f3xx_hal::usb::{Peripheral, UsbBus};
11-
use stm32f3xx_hal::{hal::digital::v2::OutputPin, prelude::*, stm32};
12+
13+
use hal::pac;
14+
use hal::prelude::*;
15+
use hal::usb::{Peripheral, UsbBus};
16+
1217
use usb_device::prelude::*;
1318
use usbd_serial::{SerialPort, USB_CLASS_CDC};
1419

1520
#[entry]
1621
fn main() -> ! {
17-
let dp = stm32::Peripherals::take().unwrap();
22+
let dp = pac::Peripherals::take().unwrap();
1823

1924
let mut flash = dp.FLASH.constrain();
2025
let mut rcc = dp.RCC.constrain();
@@ -34,7 +39,7 @@ fn main() -> ! {
3439
let mut led = gpioe
3540
.pe13
3641
.into_push_pull_output(&mut gpioe.moder, &mut gpioe.otyper);
37-
led.set_low(); // Turn off
42+
led.set_low().ok(); // Turn off
3843

3944
let mut gpioa = dp.GPIOA.split(&mut rcc.ahb);
4045

@@ -45,7 +50,7 @@ fn main() -> ! {
4550
let mut usb_dp = gpioa
4651
.pa12
4752
.into_push_pull_output(&mut gpioa.moder, &mut gpioa.otyper);
48-
usb_dp.set_low();
53+
usb_dp.set_low().ok();
4954
delay(clocks.sysclk().0 / 100);
5055

5156
let usb_dm = gpioa.pa11.into_af14(&mut gpioa.moder, &mut gpioa.afrh);
@@ -76,7 +81,7 @@ fn main() -> ! {
7681

7782
match serial.read(&mut buf) {
7883
Ok(count) if count > 0 => {
79-
led.set_high(); // Turn on
84+
led.set_high().ok(); // Turn on
8085

8186
// Echo back in upper case
8287
for c in buf[0..count].iter_mut() {

src/flash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Flash memory
22
3-
use crate::stm32::{flash, FLASH};
3+
use crate::pac::{flash, FLASH};
44

55
/// Extension trait to constrain the FLASH peripheral
66
pub trait FlashExt {

src/gpio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ macro_rules! gpio {
121121
), not(any(
122122
$(feature = $device_except,)*
123123
))))]
124-
use crate::stm32::$GPIOX;
124+
use crate::pac::$GPIOX;
125125
)+
126126

127127
pub enum Gpio {
@@ -249,7 +249,7 @@ macro_rules! gpio {
249249
use crate::hal::digital::v2::StatefulOutputPin;
250250
#[cfg(feature = "unproven")]
251251
use crate::hal::digital::v2::toggleable;
252-
use crate::stm32::{$gpioy, $GPIOX};
252+
use crate::pac::{$gpioy, $GPIOX};
253253

254254
use crate::rcc::AHB;
255255
#[allow(unused_imports)]

src/i2c.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Inter-Integrated Circuit (I2C) bus
22
3-
use crate::stm32::{I2C1, I2C2};
3+
use crate::pac::{I2C1, I2C2};
44
use cast::u8;
55

66
use crate::gpio::gpioa::{PA10, PA9};

src/lib.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,19 @@ pub use nb;
8989
pub use nb::block;
9090

9191
#[cfg(feature = "stm32f301")]
92-
pub use stm32f3::stm32f301 as stm32;
92+
pub use stm32f3::stm32f301 as pac;
9393

9494
#[cfg(feature = "stm32f302")]
95-
pub use stm32f3::stm32f302 as stm32;
95+
pub use stm32f3::stm32f302 as pac;
9696

9797
#[cfg(feature = "stm32f303")]
98-
pub use stm32f3::stm32f303 as stm32;
98+
pub use stm32f3::stm32f303 as pac;
9999

100100
#[cfg(feature = "stm32f373")]
101-
pub use stm32f3::stm32f373 as stm32;
101+
pub use stm32f3::stm32f373 as pac;
102102

103103
#[cfg(feature = "stm32f334")]
104-
pub use stm32f3::stm32f3x4 as stm32;
104+
pub use stm32f3::stm32f3x4 as pac;
105105

106106
#[cfg(any(
107107
feature = "stm32f318",
@@ -110,11 +110,15 @@ pub use stm32f3::stm32f3x4 as stm32;
110110
feature = "stm32f378",
111111
feature = "stm32f398"
112112
))]
113-
pub use stm32f3::stm32f3x8 as stm32;
113+
pub use stm32f3::stm32f3x8 as pac;
114+
115+
#[cfg(feature = "device-selected")]
116+
#[deprecated(since = "0.5.0", note = "please use `pac` instead")]
117+
pub use crate::pac as stm32;
114118

115119
// Enable use of interrupt macro
116120
#[cfg(feature = "rt")]
117-
pub use crate::stm32::interrupt;
121+
pub use crate::pac::interrupt;
118122

119123
#[cfg(feature = "device-selected")]
120124
pub mod delay;

src/prelude.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
33
pub use crate::flash::FlashExt as _stm32f3xx_hal_flash_FlashExt;
44
pub use crate::gpio::GpioExt as _stm32f3xx_hal_gpio_GpioExt;
5-
#[cfg(feature = "unproven")]
6-
pub use crate::hal::digital::v2::InputPin as _embedded_hal_digital_InputPin;
7-
#[cfg(feature = "unproven")]
8-
pub use crate::hal::digital::v2::OutputPin as _embedded_hal_digital_OutputPin;
9-
#[cfg(feature = "unproven")]
10-
pub use crate::hal::digital::v2::StatefulOutputPin as _embedded_hal_digital_StatefulOutputPin;
11-
#[cfg(feature = "unproven")]
12-
pub use crate::hal::digital::v2::ToggleableOutputPin as _embedded_hal_digital_ToggleableOutputPin;
135
pub use crate::hal::prelude::*;
146
pub use crate::rcc::RccExt as _stm32f3xx_hal_rcc_RccExt;
157
pub use crate::time::U32Ext as _stm32f3xx_hal_time_U32Ext;
8+
#[cfg(feature = "unproven")]
9+
pub use crate::{
10+
hal::digital::v2::InputPin as _embedded_hal_digital_InputPin,
11+
hal::digital::v2::OutputPin as _embedded_hal_digital_OutputPin,
12+
hal::digital::v2::StatefulOutputPin as _embedded_hal_digital_StatefulOutputPin,
13+
hal::digital::v2::ToggleableOutputPin as _embedded_hal_digital_ToggleableOutputPin,
14+
};

0 commit comments

Comments
 (0)