Skip to content

Commit d1bb6e6

Browse files
committed
merge
1 parent dd4832e commit d1bb6e6

32 files changed

+697
-718
lines changed

examples/analog-stopwatch-with-spi-ssd1306.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ use panic_semihosting as _;
1111
use stm32f4xx_hal as hal;
1212

1313
use crate::hal::{
14-
fugit::{CounterUs, Event, Timer},
1514
gpio::{Edge, Input, PullDown, PA0},
1615
interrupt, pac,
1716
prelude::*,
1817
rcc::{Clocks, Rcc},
1918
spi::Spi,
19+
timer::{CounterUs, Event, FTimer, Timer},
2020
};
2121

2222
use core::cell::{Cell, RefCell};
@@ -112,7 +112,7 @@ fn main() -> ! {
112112

113113
let dc = gpioe.pe3.into_push_pull_output();
114114
let mut ss = gpioe.pe4.into_push_pull_output();
115-
let mut delay = hal::delay::Delay::new(cp.SYST, &clocks);
115+
let mut delay = Timer::syst(cp.SYST, &clocks).delay();
116116

117117
ss.set_high();
118118
delay.delay_ms(100_u32);
@@ -126,7 +126,7 @@ fn main() -> ! {
126126
disp.flush().unwrap();
127127

128128
// Create a 1ms periodic interrupt from TIM2
129-
let mut timer = Timer::new(dp.TIM2, &clocks).counter();
129+
let mut timer = FTimer::new(dp.TIM2, &clocks).counter();
130130
timer.start(1.secs()).unwrap();
131131
timer.listen(Event::Update);
132132

examples/blinky-timer-irq.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ use panic_halt as _;
1111
use stm32f4xx_hal as hal;
1212

1313
use crate::hal::{
14-
fugit::{CounterUs, Event, Timer},
1514
gpio::{self, Output, PushPull},
1615
pac::{interrupt, Interrupt, Peripherals, TIM2},
1716
prelude::*,
17+
timer::{CounterUs, Event},
1818
};
1919

2020
use core::cell::RefCell;
@@ -78,7 +78,7 @@ fn main() -> ! {
7878
cortex_m::interrupt::free(|cs| *G_LED.borrow(cs).borrow_mut() = Some(led));
7979

8080
// Set up a timer expiring after 1s
81-
let mut timer = Timer::new(dp.TIM2, &clocks).counter();
81+
let mut timer = dp.TIM2.counter(&clocks);
8282
timer.start(1.secs()).unwrap();
8383

8484
// Generate an interrupt when the timer expires

examples/delay-syst-blinky.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use panic_halt as _; // panic handler
1111
use cortex_m_rt::entry;
1212
use stm32f4xx_hal as hal;
1313

14-
use crate::hal::{pac, prelude::*, timer::Timer};
14+
use crate::hal::{pac, prelude::*};
1515

1616
#[entry]
1717
fn main() -> ! {
@@ -28,7 +28,7 @@ fn main() -> ! {
2828
let clocks = rcc.cfgr.sysclk(48.MHz()).freeze();
2929

3030
// Create a delay abstraction based on SysTick
31-
let mut delay = Timer::syst(cp.SYST, &clocks).delay();
31+
let mut delay = cp.SYST.delay(&clocks);
3232

3333
loop {
3434
// On for 1s, off for 1s.

examples/f413disco_lcd_ferris.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::hal::{
1919
fsmc_lcd::{ChipSelect3, FsmcLcd, LcdPins, Timing},
2020
gpio::Speed,
2121
pac::{CorePeripherals, Peripherals},
22-
{delay::Delay, prelude::*},
22+
prelude::*,
2323
};
2424

2525
use embedded_graphics::geometry::Size;
@@ -747,7 +747,7 @@ fn main() -> ! {
747747
gpioe.pe5.into_push_pull_output().set_high();
748748

749749
// Get delay provider
750-
let mut delay = Delay::new(cp.SYST, &clocks);
750+
let mut delay = cp.SYST.delay(&clocks);
751751

752752
// Set up timing
753753
let write_timing = Timing::default().data(3).address_setup(3).bus_turnaround(0);

examples/i2s-audio-out-dma.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ use cortex_m_rt::entry;
4848
use stm32_i2s_v12x::format::{Data16Frame16, FrameFormat};
4949
use stm32_i2s_v12x::{MasterClock, MasterConfig, Polarity, TransmitMode};
5050

51-
use stm32f4xx_hal::delay::Delay;
5251
use stm32f4xx_hal::dma::config::DmaConfig;
5352
use stm32f4xx_hal::dma::MemoryToPeripheral;
5453
use stm32f4xx_hal::dma::{Stream5, StreamsTuple, Transfer};
@@ -100,7 +99,7 @@ fn main() -> ! {
10099
let gpioc = dp.GPIOC.split();
101100
let gpiod = dp.GPIOD.split();
102101

103-
let mut delay = Delay::new(cp.SYST, &clocks);
102+
let mut delay = cp.SYST.delay(&clocks);
104103

105104
let i2c = I2c::new(
106105
dp.I2C1,

examples/i2s-audio-out.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ use cortex_m_rt::entry;
4545
use stm32_i2s_v12x::format::{Data16Frame16, FrameFormat};
4646
use stm32_i2s_v12x::{MasterClock, MasterConfig, Polarity};
4747

48-
use stm32f4xx_hal::delay::Delay;
4948
use stm32f4xx_hal::i2c::I2c;
5049
use stm32f4xx_hal::i2s::I2s;
5150
use stm32f4xx_hal::nb::block;
@@ -100,7 +99,7 @@ fn main() -> ! {
10099
// The 86 MHz frequency can be divided to get a sample rate very close to 48 kHz.
101100
let clocks = rcc.cfgr.use_hse(8.MHz()).i2s_clk(86.MHz()).freeze();
102101

103-
let mut delay = Delay::new(cp.SYST, &clocks);
102+
let mut delay = cp.SYST.delay(&clocks);
104103

105104
let i2c = I2c::new(
106105
dp.I2C1,

examples/pwm-input.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn main() -> ! {
2020

2121
let channels = (gpioa.pa8.into_alternate(), gpioa.pa9.into_alternate());
2222
// configure tim1 as a PWM output of known frequency.
23-
let pwm = Timer::new(dp.TIM1, &clocks).pwm(channels, 501.Hz());
23+
let pwm = Timer::new(dp.TIM1, &clocks).pwm_hz(channels, 501.Hz());
2424
let (mut ch1, _ch2) = pwm.split();
2525
let max_duty = ch1.get_max_duty();
2626
ch1.set_duty(max_duty / 2);

examples/pwm-sinus.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use panic_halt as _;
88
use core::f32::consts::FRAC_PI_2;
99
use cortex_m_rt::entry;
1010
use micromath::F32Ext;
11-
use stm32f4xx_hal::{fugit::Channel, pac, prelude::*};
11+
use stm32f4xx_hal::{pac, prelude::*, timer::Channel};
1212

1313
#[entry]
1414
fn main() -> ! {

examples/pwm.rs

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

88
use cortex_m_rt::entry;
9-
use stm32f4xx_hal::{pac, prelude::*, timer::Timer};
9+
use stm32f4xx_hal::{pac, prelude::*};
1010

1111
#[entry]
1212
fn main() -> ! {
@@ -18,7 +18,7 @@ fn main() -> ! {
1818
let gpioa = dp.GPIOA.split();
1919
let channels = (gpioa.pa8.into_alternate(), gpioa.pa9.into_alternate());
2020

21-
let pwm = Timer::new(dp.TIM1, &clocks).pwm(channels, 20.kHz()).split();
21+
let pwm = dp.TIM1.pwm_hz(&clocks, channels, 20.kHz()).split();
2222
let (mut ch1, _ch2) = pwm;
2323
let max_duty = ch1.get_max_duty();
2424
ch1.set_duty(max_duty / 2);

examples/rng-display.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fn main() -> ! {
6565
.sysclk(128.MHz())
6666
.freeze();
6767

68-
let mut delay_source = hal::delay::Delay::new(cp.SYST, &clocks);
68+
let mut delay_source = cp.SYST.delay(&clocks);
6969

7070
// Set up I2C1: SCL is PB8 and SDA is PB9; they are set to Alternate Function 4
7171
// as per the STM32F407 datasheet. Pin assignment as per the

0 commit comments

Comments
 (0)