Skip to content

Commit e31050a

Browse files
bors[bot]burrbull
andauthored
Merge #430
430: fugit-rate & PERExt traits r=therealprof a=burrbull Require korken89/fugit#18 Co-authored-by: Andrey Zgarbul <[email protected]>
2 parents 3abe07d + 2493f36 commit e31050a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+425
-402
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1818
- Move `i2c` `embedded-hal` trait impls to `I2c` methods [#431]
1919
- Reexport pins in `gpio` module
2020
- Pwm channels now constants [#432]
21+
- Use fugit rate types instead of custom [#430]
2122
- Add channel events, make Event use bitflags (simplify interrupt handling) [#425]
2223
- reexport `digital::v2::PinState` again [#428]
2324
- Timer impls with time based on `fugit` moved to `fugit` module, added `Pwm` and `fugit-timer` impls [#423]
@@ -55,6 +56,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
5556
[#440]: https://github.com/stm32-rs/stm32f4xx-hal/pull/440
5657
[#443]: https://github.com/stm32-rs/stm32f4xx-hal/pull/443
5758
[#441]: https://github.com/stm32-rs/stm32f4xx-hal/pull/441
59+
[#430]: https://github.com/stm32-rs/stm32f4xx-hal/pull/430
5860

5961
### Changed
6062

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ cast = { default-features = false, version = "0.3.0" }
4141
void = { default-features = false, version = "1.0.2" }
4242
embedded-hal = { features = ["unproven"], version = "0.2.7" }
4343
display-interface = { version = "0.4.1", optional = true }
44-
fugit = "0.3.3"
44+
fugit = "0.3.5"
4545
fugit-timer = "0.1.3"
4646
rtic-monotonic = { version = "1.0", optional = true }
4747
bitflags = "1.3.2"

examples/adc_dma_rtic.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ mod app {
4444
let rcc = device.RCC.constrain();
4545
let _clocks = rcc
4646
.cfgr
47-
.use_hse(25.mhz())
47+
.use_hse(25.MHz())
4848
.require_pll48clk()
49-
.sysclk(84.mhz())
50-
.hclk(84.mhz())
51-
.pclk1(42.mhz())
52-
.pclk2(84.mhz())
49+
.sysclk(MONO_HZ.Hz())
50+
.hclk(MONO_HZ.Hz())
51+
.pclk1(42.MHz())
52+
.pclk2(84.MHz())
5353
.freeze();
5454

5555
let mut dcb = cx.core.DCB;

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ fn main() -> ! {
101101
polarity: Polarity::IdleLow,
102102
phase: Phase::CaptureOnFirstTransition,
103103
},
104-
2000.khz(),
104+
2000.kHz(),
105105
&clocks,
106106
);
107107

@@ -209,10 +209,10 @@ fn main() -> ! {
209209

210210
fn setup_clocks(rcc: Rcc) -> Clocks {
211211
rcc.cfgr
212-
.hclk(180.mhz())
213-
.sysclk(180.mhz())
214-
.pclk1(45.mhz())
215-
.pclk2(90.mhz())
212+
.hclk(180.MHz())
213+
.sysclk(180.MHz())
214+
.pclk1(45.MHz())
215+
.pclk2(90.MHz())
216216
.freeze()
217217
}
218218

examples/blinky-timer-irq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ fn main() -> ! {
6767
let dp = Peripherals::take().unwrap();
6868

6969
let rcc = dp.RCC.constrain();
70-
let clocks = rcc.cfgr.sysclk(16.mhz()).pclk1(8.mhz()).freeze();
70+
let clocks = rcc.cfgr.sysclk(16.MHz()).pclk1(8.MHz()).freeze();
7171

7272
// Configure PA5 pin to blink LED
7373
let gpioa = dp.GPIOA.split();

examples/can-send.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use bxcan::filter::Mask32;
1010
use bxcan::{Frame, StandardId};
1111
use cortex_m_rt::entry;
1212
use nb::block;
13-
use stm32f4xx_hal::{can::Can, pac, prelude::*};
13+
use stm32f4xx_hal::{pac, prelude::*};
1414

1515
#[entry]
1616
fn main() -> ! {
@@ -21,14 +21,16 @@ fn main() -> ! {
2121
// To meet CAN clock accuracy requirements an external crystal or ceramic
2222
// resonator must be used. The blue pill has a 8MHz external crystal.
2323
// Other boards might have a crystal with another frequency or none at all.
24-
rcc.cfgr.use_hse(8.mhz()).freeze();
24+
rcc.cfgr.use_hse(8.MHz()).freeze();
2525

2626
let gpiob = dp.GPIOB.split();
2727
let mut can1 = {
2828
let rx = gpiob.pb8.into_alternate::<9>();
2929
let tx = gpiob.pb9.into_alternate();
3030

31-
let can = Can::new(dp.CAN1, (tx, rx));
31+
// let can = Can::new(dp.CAN1, (tx, rx));
32+
// or
33+
let can = dp.CAN1.can((tx, rx));
3234

3335
bxcan::Can::builder(can)
3436
// APB1 (PCLK1): 8MHz, Bit rate: 500kBit/s, Sample Point 87.5%
@@ -45,7 +47,7 @@ fn main() -> ! {
4547
let tx = gpiob.pb13.into_alternate();
4648
let rx = gpiob.pb12.into_alternate();
4749

48-
let can = Can::new(dp.CAN2, (tx, rx));
50+
let can = dp.CAN2.can((tx, rx));
4951

5052
let can2 = bxcan::Can::builder(can)
5153
// APB1 (PCLK1): 8MHz, Bit rate: 500kBit/s, Sample Point 87.5%

examples/delay-syst-blinky.rs

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

2626
// Set up the system clock. We want to run at 48MHz for this one.
2727
let rcc = dp.RCC.constrain();
28-
let clocks = rcc.cfgr.sysclk(48.mhz()).freeze();
28+
let clocks = rcc.cfgr.sysclk(48.MHz()).freeze();
2929

3030
// Create a delay abstraction based on SysTick
3131
let mut delay = hal::delay::Delay::new(cp.SYST, &clocks);

examples/delay-timer-blinky.rs

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

2626
// Set up the system clock. We want to run at 48MHz for this one.
2727
let rcc = dp.RCC.constrain();
28-
let clocks = rcc.cfgr.use_hse(25.mhz()).sysclk(48.mhz()).freeze();
28+
let clocks = rcc.cfgr.use_hse(25.MHz()).sysclk(48.MHz()).freeze();
2929

3030
// Create a delay abstraction based on general-pupose 32-bit timer TIM5
3131
let mut delay = dp.TIM5.delay_us(&clocks);

examples/dwt-blinky.rs

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

2727
// Set up the system clock. We want to run at 48MHz for this one.
2828
let rcc = dp.RCC.constrain();
29-
let clocks = rcc.cfgr.sysclk(48.mhz()).freeze();
29+
let clocks = rcc.cfgr.sysclk(48.MHz()).freeze();
3030

3131
// Create a delay abstraction based on DWT cycle counter
3232
let dwt = cp.DWT.constrain(cp.DCB, &clocks);

examples/f413disco_lcd_ferris.rs

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

707707
// Configure and lock the clocks at maximum warp
708708
let rcc = p.RCC.constrain();
709-
let clocks = rcc.cfgr.sysclk(100.mhz()).freeze();
709+
let clocks = rcc.cfgr.sysclk(100.MHz()).freeze();
710710

711711
// Define the pins we need for our 16bit parallel bus
712712
let lcd_pins = LcdPins {

0 commit comments

Comments
 (0)