Skip to content

Commit b2f2fb3

Browse files
committed
Review comments and various fixes
1 parent bd36c7b commit b2f2fb3

File tree

5 files changed

+243
-196
lines changed

5 files changed

+243
-196
lines changed

CHANGELOG.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99

1010
### Added
1111

12-
- Replace custom time based units with types defined in the [embedded-time][]
13-
crate ([#192])
1412
- Make `Clocks` `ppre1()` and `ppre2()` methods public, to get the current
1513
Prescaler value. ([#210])
1614
- Implement `into_xxx` methods for partially erased pins ([#189])
1715
- Enable better GPIO internal resistor configuration ([#189])
1816
- Support for GPIO output slew rate configuration ([#189])
1917
- Support for GPIO interrupts ([#189])
2018

21-
[embedded-time]: https://github.com/FluenTech/embedded-time/
22-
2319
### Changed
2420

2521
- Added support for more CAN bit rates and modes. ([#186])
@@ -33,10 +29,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3329

3430
### Breaking Changes
3531

32+
- Replace custom time based units with types defined in the [embedded-time][]
33+
crate ([#192])
3634
- The `rcc` public API now expects time based units in `Megahertz`.
3735
If the supplied frequency cannot be converted to `Hertz` the code
3836
will `panic`. This will occur if the supplied `Megahertz` frequency
39-
cannot fit into `u32::MAX` when converting to `Hertz`
37+
cannot fit into `u32::MAX` when converting to `Hertz` ([#192])
4038

4139
```rust
4240
// The supplied frequencies must be in `MHz`.
@@ -55,9 +53,10 @@ let clocks = rcc
5553
- `cortex-m` to 0.7
5654
- `stm32-usbd` to 0.6
5755
- `defmt` to 0.2
58-
5956
- `into_afx` methods are splitted into `into_afx_push_pull` and
6057
`into_afx_open_drain` ([#189])
58+
- GPIO output mode (`PushPull` or `OpenDrain`) is encoded into pin typestate
59+
in alternate function mode ([#189])
6160
- GPIO internal resistor configuration is no longer encoded into pin typestate
6261
in input mode ([#189])
6362

@@ -95,9 +94,6 @@ let clocks = rcc
9594
The support of this feature is subject to change as the development
9695
of [defmt][] is advancing.
9796

98-
[defmt]: https://github.com/knurling-rs/defmt
99-
[filter]: https://defmt.ferrous-systems.com/filtering.html
100-
10197
### Changed
10298

10399
- Introduced auto-generated GPIO mappings based on the STM32CubeMX database
@@ -109,8 +105,6 @@ let clocks = rcc
109105
([#152])
110106
- Wrong I2C clock source ([#164])
111107

112-
[#151]: https://github.com/stm32-rs/stm32f3xx-hal/issues/151
113-
114108
### Breaking Changes
115109

116110
- Removed impl for `SckPin<SPI2>` for `PB13<AF5>` from `stm32f328` and
@@ -315,6 +309,10 @@ let clocks = rcc
315309

316310
- Support `stm32f303` device
317311

312+
[embedded-time]: https://github.com/FluenTech/embedded-time/
313+
[defmt]: https://github.com/knurling-rs/defmt
314+
[filter]: https://defmt.ferrous-systems.com/filtering.html
315+
318316
[#211]: https://github.com/stm32-rs/stm32f3xx-hal/pull/211
319317
[#210]: https://github.com/stm32-rs/stm32f3xx-hal/pull/210
320318
[#208]: https://github.com/stm32-rs/stm32f3xx-hal/pull/208

examples/gpio_interrupts.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use cortex_m_rt::entry;
1212
use hal::gpio::{gpioa, gpioe, Edge, Input, Output, PushPull};
1313
use hal::interrupt;
1414
use hal::pac;
15-
use hal::pac::{Interrupt, NVIC};
15+
use hal::pac::NVIC;
1616
use hal::prelude::*;
1717

1818
type LedPin = gpioe::PE9<Output<PushPull>>;
@@ -21,7 +21,7 @@ static LED: Mutex<RefCell<Option<LedPin>>> = Mutex::new(RefCell::new(None));
2121
type ButtonPin = gpioa::PA0<Input>;
2222
static BUTTON: Mutex<RefCell<Option<ButtonPin>>> = Mutex::new(RefCell::new(None));
2323

24-
// When the user button is pressed. The north LED with toggle.
24+
// When the user button is pressed. The north LED will toggle.
2525
#[entry]
2626
fn main() -> ! {
2727
// Getting access to registers we will need for configuration.
@@ -48,10 +48,12 @@ fn main() -> ! {
4848
user_button.make_interrupt_source(&mut syscfg);
4949
user_button.trigger_on_edge(&mut exti, Edge::Rising);
5050
user_button.enable_interrupt(&mut exti);
51+
let interrupt_num = user_button.nvic(); // hal::pac::Interrupt::EXTI0
52+
5153
// Moving ownership to the global BUTTON so we can clear the interrupt pending bit.
5254
cortex_m::interrupt::free(|cs| *BUTTON.borrow(cs).borrow_mut() = Some(user_button));
5355

54-
unsafe { NVIC::unmask(Interrupt::EXTI0) };
56+
unsafe { NVIC::unmask(interrupt_num) };
5557

5658
loop {
5759
asm::wfi();

0 commit comments

Comments
 (0)