Skip to content

Commit 39574dd

Browse files
committed
use fugit::Rate types instead of custom
1 parent ab33c09 commit 39574dd

Some content is hidden

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

43 files changed

+232
-405
lines changed

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ nb = "1"
2222
stm32f1 = "0.14.0"
2323
embedded-dma = "0.1.2"
2424
bxcan = "0.6"
25-
cast = { default-features = false, version = "0.3.0" }
2625
void = { default-features = false, version = "1.0.2" }
2726
embedded-hal = { features = ["unproven"], version = "0.2.6" }
28-
fugit = "0.3.0"
27+
fugit = "0.3.5"
2928
rtic-monotonic = { version = "1.0", optional = true }
3029

3130
[dependencies.stm32-usbd]

examples/adc-dma-circ.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn main() -> ! {
2323
// clock is configurable. So its frequency may be tweaked to meet certain
2424
// practical needs. User specified value is be approximated using supported
2525
// prescaler values 2/4/6/8.
26-
let clocks = rcc.cfgr.adcclk(2.mhz()).freeze(&mut flash.acr);
26+
let clocks = rcc.cfgr.adcclk(2.MHz()).freeze(&mut flash.acr);
2727

2828
let dma_ch1 = p.DMA1.split().1;
2929

examples/adc-dma-rx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn main() -> ! {
2323
// clock is configurable. So its frequency may be tweaked to meet certain
2424
// practical needs. User specified value is be approximated using supported
2525
// prescaler values 2/4/6/8.
26-
let clocks = rcc.cfgr.adcclk(2.mhz()).freeze(&mut flash.acr);
26+
let clocks = rcc.cfgr.adcclk(2.MHz()).freeze(&mut flash.acr);
2727

2828
let dma_ch1 = p.DMA1.split().1;
2929

examples/adc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ fn main() -> ! {
2121
// clock is configurable. So its frequency may be tweaked to meet certain
2222
// practical needs. User specified value is be approximated using supported
2323
// prescaler values 2/4/6/8.
24-
let clocks = rcc.cfgr.adcclk(2.mhz()).freeze(&mut flash.acr);
25-
hprintln!("adc freq: {}", clocks.adcclk().0).unwrap();
24+
let clocks = rcc.cfgr.adcclk(2.MHz()).freeze(&mut flash.acr);
25+
hprintln!("adc freq: {}", clocks.adcclk()).unwrap();
2626

2727
// Setup ADC
2828
let mut adc1 = adc::Adc::adc1(p.ADC1, clocks);

examples/adc_temperature.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ fn main() -> ! {
1818

1919
let clocks = rcc
2020
.cfgr
21-
.use_hse(8.mhz())
22-
.sysclk(56.mhz())
23-
.pclk1(28.mhz())
24-
.adcclk(14.mhz())
21+
.use_hse(8.MHz())
22+
.sysclk(56.MHz())
23+
.pclk1(28.MHz())
24+
.adcclk(14.MHz())
2525
.freeze(&mut flash.acr);
2626
/*
2727
// Alternative configuration using dividers and multipliers directly
@@ -34,8 +34,8 @@ fn main() -> ! {
3434
usbpre: rcc::UsbPre::DIV1_5,
3535
adcpre: rcc::AdcPre::DIV2,
3636
}, &mut flash.acr);*/
37-
hprintln!("sysclk freq: {}", clocks.sysclk().0).unwrap();
38-
hprintln!("adc freq: {}", clocks.adcclk().0).unwrap();
37+
hprintln!("sysclk freq: {}", clocks.sysclk()).unwrap();
38+
hprintln!("adc freq: {}", clocks.adcclk()).unwrap();
3939

4040
// Setup ADC
4141
let mut adc = adc::Adc::adc1(p.ADC1, clocks);

examples/blinky.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn main() -> ! {
3939
// in order to configure the port. For pins 0-7, crl should be passed instead.
4040
let mut led = gpioc.pc13.into_push_pull_output(&mut gpioc.crh);
4141
// Configure the syst timer to trigger an update every second
42-
let mut timer = Timer::syst(cp.SYST, &clocks).start_count_down(1.hz());
42+
let mut timer = Timer::syst(cp.SYST, &clocks).start_count_down(1.Hz());
4343

4444
// Wait for the timer to trigger an update and change the state of the LED
4545
loop {

examples/blinky_generic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn main() -> ! {
2626
let mut gpioc = dp.GPIOC.split();
2727

2828
// Configure the syst timer to trigger an update every second
29-
let mut timer = Timer::syst(cp.SYST, &clocks).start_count_down(1.hz());
29+
let mut timer = Timer::syst(cp.SYST, &clocks).start_count_down(1.Hz());
3030

3131
// Create an array of LEDS to blink
3232
let mut leds = [

examples/blinky_timer_irq.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ fn main() -> ! {
7373
let mut flash = dp.FLASH.constrain();
7474
let clocks = rcc
7575
.cfgr
76-
.sysclk(8.mhz())
77-
.pclk1(8.mhz())
76+
.sysclk(8.MHz())
77+
.pclk1(8.MHz())
7878
.freeze(&mut flash.acr);
7979

8080
// Configure PC13 pin to blink LED
@@ -86,7 +86,7 @@ fn main() -> ! {
8686
cortex_m::interrupt::free(|cs| *G_LED.borrow(cs).borrow_mut() = Some(led));
8787

8888
// Set up a timer expiring after 1s
89-
let mut timer = Timer::new(dp.TIM2, &clocks).start_count_down(1.hz());
89+
let mut timer = Timer::new(dp.TIM2, &clocks).start_count_down(1.Hz());
9090

9191
// Generate an interrupt when the timer expires
9292
timer.listen(Event::Update);

examples/can-echo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ 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(&mut flash.acr);
24+
rcc.cfgr.use_hse(8.MHz()).freeze(&mut flash.acr);
2525

2626
let mut afio = dp.AFIO.constrain();
2727

examples/can-loopback.rs

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

2424
// To meet CAN clock accuracy requirements, an external crystal or ceramic
2525
// resonator must be used.
26-
rcc.cfgr.use_hse(8.mhz()).freeze(&mut flash.acr);
26+
rcc.cfgr.use_hse(8.MHz()).freeze(&mut flash.acr);
2727

2828
#[cfg(not(feature = "connectivity"))]
2929
let can = Can::new(dp.CAN1, dp.USB);

0 commit comments

Comments
 (0)