Skip to content

Commit 0907de0

Browse files
authored
Merge pull request #102 from stm32-rs/pac-instead-of-stm32
Soft-deprecate `stm32` for PAC access and use `pac` instead
2 parents 7b19068 + c4ad055 commit 0907de0

32 files changed

+92
-84
lines changed

CHANGELOG.md

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

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Use `pac` instead of `stm32` for PAC access and soft-deprecate the former
13+
1014
### Added
1115

1216
- Another example resembling a stop watch controlled via serial interface

examples/adc_values.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use panic_halt as _;
55

66
use stm32f0xx_hal as hal;
77

8-
use crate::hal::{prelude::*, stm32};
8+
use crate::hal::{prelude::*, pac};
99

1010
use cortex_m::{interrupt::Mutex, peripheral::syst::SystClkSource::Core};
1111
use cortex_m_rt::{entry, exception};
@@ -14,15 +14,15 @@ use core::{cell::RefCell, fmt::Write};
1414

1515
struct Shared {
1616
adc: hal::adc::Adc,
17-
tx: hal::serial::Tx<stm32::USART1>,
17+
tx: hal::serial::Tx<pac::USART1>,
1818
}
1919

2020
static SHARED: Mutex<RefCell<Option<Shared>>> = Mutex::new(RefCell::new(None));
2121

2222
#[entry]
2323
fn main() -> ! {
2424
if let (Some(p), Some(cp)) = (
25-
hal::stm32::Peripherals::take(),
25+
hal::pac::Peripherals::take(),
2626
cortex_m::peripheral::Peripherals::take(),
2727
) {
2828
cortex_m::interrupt::free(move |cs| {

examples/blinky.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ use panic_halt as _;
55

66
use stm32f0xx_hal as hal;
77

8-
use crate::hal::{prelude::*, stm32};
8+
use crate::hal::{prelude::*, pac};
99

1010
use cortex_m_rt::entry;
1111

1212
#[entry]
1313
fn main() -> ! {
14-
if let Some(mut p) = stm32::Peripherals::take() {
14+
if let Some(mut p) = pac::Peripherals::take() {
1515
let mut led = cortex_m::interrupt::free(|cs| {
1616
let mut rcc = p.RCC.configure().sysclk(8.mhz()).freeze(&mut p.FLASH);
1717

examples/blinky_adc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ use panic_halt as _;
55

66
use stm32f0xx_hal as hal;
77

8-
use crate::hal::{adc::Adc, delay::Delay, prelude::*, stm32};
8+
use crate::hal::{adc::Adc, delay::Delay, prelude::*, pac};
99

1010
use cortex_m::peripheral::Peripherals;
1111
use cortex_m_rt::entry;
1212

1313
#[entry]
1414
fn main() -> ! {
15-
if let (Some(mut p), Some(cp)) = (stm32::Peripherals::take(), Peripherals::take()) {
15+
if let (Some(mut p), Some(cp)) = (pac::Peripherals::take(), Peripherals::take()) {
1616
cortex_m::interrupt::free(move |cs| {
1717
let mut rcc = p.RCC.configure().sysclk(8.mhz()).freeze(&mut p.FLASH);
1818

examples/blinky_delay.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ use panic_halt as _;
55

66
use stm32f0xx_hal as hal;
77

8-
use crate::hal::{delay::Delay, prelude::*, stm32};
8+
use crate::hal::{delay::Delay, prelude::*, pac};
99

1010
use cortex_m::peripheral::Peripherals;
1111
use cortex_m_rt::entry;
1212

1313
#[entry]
1414
fn main() -> ! {
15-
if let (Some(mut p), Some(cp)) = (stm32::Peripherals::take(), Peripherals::take()) {
15+
if let (Some(mut p), Some(cp)) = (pac::Peripherals::take(), Peripherals::take()) {
1616
cortex_m::interrupt::free(move |cs| {
1717
let mut rcc = p.RCC.configure().sysclk(8.mhz()).freeze(&mut p.FLASH);
1818

examples/blinky_multiple.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ use panic_halt as _;
55

66
use stm32f0xx_hal as hal;
77

8-
use crate::hal::{delay::Delay, prelude::*, stm32};
8+
use crate::hal::{delay::Delay, prelude::*, pac};
99

1010
use cortex_m::peripheral::Peripherals;
1111
use cortex_m_rt::entry;
1212

1313
#[entry]
1414
fn main() -> ! {
15-
if let (Some(mut p), Some(cp)) = (stm32::Peripherals::take(), Peripherals::take()) {
15+
if let (Some(mut p), Some(cp)) = (pac::Peripherals::take(), Peripherals::take()) {
1616
cortex_m::interrupt::free(move |cs| {
1717
let mut rcc = p.RCC.configure().sysclk(8.mhz()).freeze(&mut p.FLASH);
1818

examples/blinky_timer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ use panic_halt as _;
55

66
use stm32f0xx_hal as hal;
77

8-
use crate::hal::{prelude::*, stm32, time::Hertz, timers::*};
8+
use crate::hal::{prelude::*, pac, time::Hertz, timers::*};
99

1010
use cortex_m_rt::entry;
1111

1212
#[entry]
1313
fn main() -> ! {
14-
if let Some(mut p) = stm32::Peripherals::take() {
14+
if let Some(mut p) = pac::Peripherals::take() {
1515
cortex_m::interrupt::free(move |cs| {
1616
let mut rcc = p.RCC.configure().sysclk(8.mhz()).freeze(&mut p.FLASH);
1717

examples/blinky_timer_irq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use stm32f0xx_hal as hal;
77

88
use crate::hal::{
99
gpio::*,
10+
pac::{interrupt, Interrupt, Peripherals, TIM7},
1011
prelude::*,
11-
stm32::{interrupt, Interrupt, Peripherals, TIM7},
1212
time::Hertz,
1313
timers::*,
1414
};

examples/dac.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use panic_halt as _;
99
use stm32f0xx_hal as hal;
1010

1111
use crate::hal::dac::*;
12+
use crate::hal::pac;
1213
use crate::hal::prelude::*;
13-
use crate::hal::stm32;
1414

1515
use rt::entry;
1616

@@ -21,7 +21,7 @@ enum Direction {
2121

2222
#[entry]
2323
fn main() -> ! {
24-
if let (Some(mut dp), Some(_cp)) = (stm32::Peripherals::take(), cortex_m::Peripherals::take()) {
24+
if let (Some(mut dp), Some(_cp)) = (pac::Peripherals::take(), cortex_m::Peripherals::take()) {
2525
cortex_m::interrupt::free(move |cs| {
2626
let mut rcc = dp.RCC.configure().sysclk(8.mhz()).freeze(&mut dp.FLASH);
2727

examples/flash_systick.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use panic_halt as _;
55

66
use stm32f0xx_hal as hal;
77

8-
use crate::hal::{gpio::*, prelude::*, stm32};
8+
use crate::hal::{gpio::*, prelude::*, pac};
99

1010
use cortex_m::{interrupt::Mutex, peripheral::syst::SystClkSource::Core, Peripherals};
1111
use cortex_m_rt::{entry, exception};
@@ -18,7 +18,7 @@ static GPIO: Mutex<RefCell<Option<gpioa::PA1<Output<PushPull>>>>> = Mutex::new(R
1818

1919
#[entry]
2020
fn main() -> ! {
21-
if let (Some(mut p), Some(cp)) = (stm32::Peripherals::take(), Peripherals::take()) {
21+
if let (Some(mut p), Some(cp)) = (pac::Peripherals::take(), Peripherals::take()) {
2222
cortex_m::interrupt::free(move |cs| {
2323
let mut rcc = p.RCC.configure().sysclk(48.mhz()).freeze(&mut p.FLASH);
2424

0 commit comments

Comments
 (0)