Skip to content

Commit b5e5865

Browse files
authored
Merge pull request #282 from Sh3Rm4n/pac-upgrade
Upgrade to stm32f3 v0.14.0
2 parents 91b47e1 + 2c3b8b7 commit b5e5865

File tree

7 files changed

+15
-20
lines changed

7 files changed

+15
-20
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3131
- Enable `rt`, `usb`, `can`, `rtc` and `ld` feature by default.
3232
To disable that behavior, set `default-features = false`. ([#283])
3333
- The MSRV was bumped to 1.52 ([#283])
34+
- Update `stm32f3` pac to v0.14.0 ([#282])
3435

3536
## [v0.8.1] - 2021-10-27
3637

@@ -501,6 +502,7 @@ let clocks = rcc
501502

502503
[#291]: https://github.com/stm32-rs/stm32f3xx-hal/pull/291
503504
[#283]: https://github.com/stm32-rs/stm32f3xx-hal/pull/283
505+
[#282]: https://github.com/stm32-rs/stm32f3xx-hal/pull/282
504506
[#278]: https://github.com/stm32-rs/stm32f3xx-hal/pull/278
505507
[#277]: https://github.com/stm32-rs/stm32f3xx-hal/pull/277
506508
[#273]: https://github.com/stm32-rs/stm32f3xx-hal/pull/273

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ embedded-time = "0.12.0"
4444
nb = "1.0.0"
4545
paste = "1.0.5"
4646
rtcc = { version = "0.2.1", optional = true }
47-
stm32f3 = { version = "0.13.2", default-features = false }
47+
stm32f3 = { version = "0.14.0", default-features = false }
4848
bxcan = { version = ">=0.4, <0.6", optional = true }
4949
stm32-usbd = { version = "0.6.0", optional = true }
5050
void = { version = "1.0.2", default-features = false }
@@ -59,8 +59,8 @@ panic-probe = "0.2.0"
5959
panic-semihosting = "0.5.6"
6060
usbd-serial = "0.1.1"
6161
usb-device = "0.2.8"
62-
cortex-m-rtic = "=0.6.0-rc.2"
63-
dwt-systick-monotonic = "=0.1.0-rc.1"
62+
cortex-m-rtic = "=0.6.0-rc.4, <0.6.0-rc.5"
63+
systick-monotonic = "0.1.0-rc.2"
6464
panic-rtt-target = { version = "0.1", features = ["cortex-m"] }
6565
rtt-target = { version = "0.3.0", features = ["cortex-m"] }
6666

examples/serial_echo_rtic.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use panic_rtt_target as _;
1313
// has instructions on how to connect to your Serial device (make sure to adjust the baud rate)
1414
#[rtic::app(device = stm32f3xx_hal::pac, dispatchers = [TIM20_BRK, TIM20_UP, TIM20_TRG_COM])]
1515
mod app {
16-
use dwt_systick_monotonic::DwtSystick;
1716
use rtt_target::{rprintln, rtt_init_print};
1817
use stm32f3xx_hal::{
1918
gpio::{self, Output, PushPull, AF7},
@@ -22,9 +21,10 @@ mod app {
2221
serial::{Event, Serial},
2322
Toggle,
2423
};
24+
use systick_monotonic::*;
2525

2626
#[monotonic(binds = SysTick, default = true)]
27-
type DwtMono = DwtSystick<48_000_000>;
27+
type AppMono = Systick<100>; // 100 Hz / 10 ms granularity
2828

2929
type SerialType = Serial<pac::USART1, (gpio::PA9<AF7<PushPull>>, gpio::PA10<AF7<PushPull>>)>;
3030
// The LED that will light up when data is received via serial
@@ -43,16 +43,14 @@ mod app {
4343
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
4444
let mut flash = cx.device.FLASH.constrain();
4545
let mut rcc = cx.device.RCC.constrain();
46-
let mut dcb = cx.core.DCB;
47-
let dwt = cx.core.DWT;
4846
let systick = cx.core.SYST;
4947

5048
rtt_init_print!(NoBlockSkip, 4096);
5149
rprintln!("pre init");
5250

5351
// Initialize the clocks
5452
let clocks = rcc.cfgr.sysclk(48.MHz()).freeze(&mut flash.acr);
55-
let mono = DwtSystick::new(&mut dcb, dwt, systick, clocks.sysclk().0);
53+
let mono = Systick::new(systick, 48_000_000);
5654

5755
// Initialize the peripherals
5856
// DIR (the LED that lights up during serial rx)

src/pwm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,8 +1355,8 @@ pwm_timer_with_break!(
13551355
);
13561356

13571357
// Channels
1358-
pwm_pin_for_pwm_n_channel!(TIM15, Tim15Ch1, u16, cc1e, cc1ne, ccr1, ccr1);
1359-
pwm_pin_for_pwm_channel!(TIM15, Tim15Ch2, u16, cc2e, ccr2, ccr2);
1358+
pwm_pin_for_pwm_n_channel!(TIM15, Tim15Ch1, u16, cc1e, cc1ne, ccr1, ccr);
1359+
pwm_pin_for_pwm_channel!(TIM15, Tim15Ch2, u16, cc2e, ccr2, ccr);
13601360

13611361
// Pins
13621362
pwm_channel1_pin!(TIM15, Tim15Ch1, output_to_pa2, gpioa::PA2<AF9>);
@@ -1413,7 +1413,7 @@ pwm_timer_with_break!(
14131413
);
14141414

14151415
// Channels
1416-
pwm_pin_for_pwm_n_channel!(TIM16, Tim16Ch1, u16, cc1e, cc1ne, ccr1, ccr1);
1416+
pwm_pin_for_pwm_n_channel!(TIM16, Tim16Ch1, u16, cc1e, cc1ne, ccr1, ccr);
14171417

14181418
// Pins
14191419
pwm_channel1_pin!(TIM16, Tim16Ch1, output_to_pa9, gpioa::PA6<AF1>);
@@ -1453,7 +1453,7 @@ pwm_timer_with_break!(
14531453
);
14541454

14551455
// Channels
1456-
pwm_pin_for_pwm_n_channel!(TIM17, Tim17Ch1, u16, cc1e, cc1ne, ccr1, ccr1);
1456+
pwm_pin_for_pwm_n_channel!(TIM17, Tim17Ch1, u16, cc1e, cc1ne, ccr1, ccr);
14571457

14581458
// Pins
14591459
pwm_channel1_pin!(TIM17, Tim17Ch1, output_to_pa7, gpioa::PA7<AF1>);

src/timer/interrupts.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ pub struct InterruptTypes {
1919
// TODO: Check if pub is needed.
2020
pub(crate) const TIM2: Interrupt = Interrupt::TIM2;
2121
cfg_if::cfg_if! {
22-
if #[cfg(feature = "svd-f301")] {
23-
#[allow(unused)]
24-
pub(crate) const TIM3: Interrupt = Interrupt::TIM3_IRQ;
25-
#[allow(unused)]
26-
pub(crate) const TIM4: Interrupt = Interrupt::TIM4_IRQ;
27-
} else if #[cfg(any(feature = "svd-f303", feature = "svd-f302", feature = "svd-f373"))] {
22+
if #[cfg(any(feature = "svd-f303", feature = "svd-f302", feature = "svd-f373"))] {
2823
pub(crate) const TIM3: Interrupt = Interrupt::TIM3;
2924
pub(crate) const TIM4: Interrupt = Interrupt::TIM4;
3025
} else if #[cfg(any(feature = "svd-f3x4"))] {

testsuite/tests/adc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ mod tests {
7676
let adc_level: u16 = defmt::unwrap!(adc.read(&mut state.analog).ok());
7777
defmt::debug!("{}", adc_level);
7878
// nearly zero (always zero can not be guaranteed)
79-
assert!(adc_level <= 300);
79+
assert!(adc_level <= 500);
8080
}
8181

8282
// put adc back in place

testsuite/tests/timer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ mod tests {
107107

108108
// Deviation is high for smaller timer durations. Higher duratinons are pretty accurate.
109109
// TODO: Maybe the allowed deviation should changed depending on the duration?
110-
defmt::assert!(deviation < 40e-4);
110+
defmt::assert!(deviation < 11e-02);
111111
}
112112
state.timer = Some(timer);
113113
}

0 commit comments

Comments
 (0)