Skip to content

Commit e069b0e

Browse files
authored
Merge pull request #308 from burrbull/intoaf
generic IntoAf
2 parents a0d9a55 + e3f5d8e commit e069b0e

File tree

15 files changed

+251
-231
lines changed

15 files changed

+251
-231
lines changed

.clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
msrv = "1.52"
1+
msrv = "1.54"

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
- uses: actions/checkout@v2
5858
- uses: actions-rs/toolchain@v1
5959
with:
60-
toolchain: 1.52.0
60+
toolchain: 1.54.0
6161
target: thumbv7em-none-eabihf
6262
override: true
6363
profile: minimal

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1616

1717
### Added
1818

19+
- The MSRV was bumped to 1.54 ([#308])
20+
- Generic `into_af_push_pull<A>` and `into_af_open_drain<A>` ([#308])
1921
- `BusClock` and `BusTimerClock` traits ([#302])
2022
- `RccBus`, `Enable`, `Reset` traits and implementations for peripherals ([#299])
2123
- Support cortex-m-rt `v0.7.0` but still allow `v0.6.13` ([#283])
@@ -508,6 +510,7 @@ let clocks = rcc
508510
[defmt]: https://github.com/knurling-rs/defmt
509511
[filter]: https://defmt.ferrous-systems.com/filtering.html
510512

513+
[#308]: https://github.com/stm32-rs/stm32f3xx-hal/pull/308
511514
[#304]: https://github.com/stm32-rs/stm32f3xx-hal/pull/304
512515
[#302]: https://github.com/stm32-rs/stm32f3xx-hal/pull/302
513516
[#299]: https://github.com/stm32-rs/stm32f3xx-hal/pull/299

Cargo.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ exclude = [
1919
".markdownlint.yml"
2020
]
2121
resolver = "2"
22-
rust-version = "1.52"
22+
rust-version = "1.54"
2323

2424
[workspace]
2525
members = [
@@ -35,7 +35,7 @@ rustc-args = ["--cfg", "docsrs"]
3535

3636
[dependencies]
3737
cfg-if = "1.0.0"
38-
cortex-m = "0.7.2"
38+
cortex-m = "0.7.4"
3939
cortex-m-rt = "0.7"
4040
defmt = { version = ">=0.2.3, <0.4.0", optional = true }
4141
embedded-dma = "0.1.2"
@@ -55,18 +55,17 @@ enumset = { version = "1.0.6", optional = true}
5555
bare-metal = "0.2.5"
5656

5757
[dev-dependencies]
58-
cortex-m = "0.7.2"
5958
cortex-m-semihosting = "0.3.7"
6059
defmt-rtt = "0.3.0"
6160
defmt-test = "0.3.0"
6261
panic-probe = "0.3.0"
6362
panic-semihosting = "0.5.6"
6463
usbd-serial = "0.1.1"
6564
usb-device = "0.2.8"
66-
cortex-m-rtic = "=0.6.0-rc.4, <0.6.0-rc.5"
67-
systick-monotonic = "0.1.0-rc.2"
65+
cortex-m-rtic = "1.0"
66+
systick-monotonic = "1.0"
6867
panic-rtt-target = { version = "0.1", features = ["cortex-m"] }
69-
rtt-target = { version = "0.3.0", features = ["cortex-m"] }
68+
rtt-target = { version = "0.3.1", features = ["cortex-m"] }
7069

7170
[build-dependencies]
7271
slice-group-by = "0.2.6"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![Crate](https://img.shields.io/crates/v/stm32f3xx-hal.svg)](https://crates.io/crates/stm32f3xx-hal)
55
[![Docs](https://docs.rs/stm32f3xx-hal/badge.svg)](https://docs.rs/stm32f3xx-hal)
66
[![Crates.io](https://img.shields.io/crates/d/stm32f3xx-hal.svg)](https://crates.io/crates/stm32f3xx-hal)
7-
![Minimum Supported Rust Version](https://img.shields.io/badge/rustc-1.52+-blue.svg)
7+
![Minimum Supported Rust Version](https://img.shields.io/badge/rustc-1.54+-blue.svg)
88

99
`stm32f3xx-hal` contains a multi device hardware abstraction on top of the
1010
peripheral access API for the STMicro STM32F3 series microcontrollers. The
@@ -139,7 +139,7 @@ See the [examples folder](examples) for more example programs.
139139

140140
## Minimum Supported Rust Version (MSRV)
141141

142-
This crate is guaranteed to compile on stable Rust 1.52.0 and up. It *might*
142+
This crate is guaranteed to compile on stable Rust 1.54.0 and up. It *might*
143143
compile with older versions but that may change in any new patch release.
144144

145145
<!-- This should not prevent anyone to use newer features. -->

examples/can.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,20 @@ fn main() -> ! {
4343
// Configure CAN RX and TX pins (AF9)
4444
let rx = gpioa
4545
.pa11
46-
.into_af9_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrh);
46+
.into_af_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrh);
4747
let tx = gpioa
4848
.pa12
49-
.into_af9_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrh);
49+
.into_af_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrh);
5050

5151
// Initialize the CAN peripheral
52-
let mut can = Can::new(dp.CAN, tx, rx, &mut rcc.apb1);
53-
5452
// Use loopback mode: No pins need to be assigned to peripheral.
5553
// APB1 (PCLK1): 64MHz, Bit rate: 500kBit/s, Sample Point 87.5%
5654
// Value was calculated with http://www.bittiming.can-wiki.info/
57-
can.modify_config()
55+
let mut can = bxcan::Can::builder(Can::new(dp.CAN, tx, rx, &mut rcc.apb1))
5856
.set_bit_timing(0x001c_0003)
5957
.set_loopback(false)
60-
.set_silent(false);
58+
.set_silent(false)
59+
.leave_disabled();
6160

6261
let mut filters = can.modify_filters();
6362

@@ -67,7 +66,7 @@ fn main() -> ! {
6766
drop(filters);
6867

6968
// Sync to the bus and start normal operation.
70-
block!(can.enable()).ok();
69+
block!(can.enable_non_blocking()).ok();
7170

7271
let mut led0 = gpiob
7372
.pb15

examples/i2c_scanner.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ fn main() -> ! {
3131
let mut scl =
3232
gpiob
3333
.pb6
34-
.into_af4_open_drain(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrl);
34+
.into_af_open_drain(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrl);
3535
let mut sda =
3636
gpiob
3737
.pb7
38-
.into_af4_open_drain(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrl);
38+
.into_af_open_drain(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrl);
3939
scl.internal_pull_up(&mut gpiob.pupdr, true);
4040
sda.internal_pull_up(&mut gpiob.pupdr, true);
4141
let mut i2c = hal::i2c::I2c::new(

examples/pwm.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,38 +34,38 @@ fn main() -> ! {
3434
let mut gpioa = dp.GPIOA.split(&mut rcc.ahb);
3535
let pa4 = gpioa
3636
.pa4
37-
.into_af2_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrl);
37+
.into_af_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrl);
3838
let pa6 = gpioa
3939
.pa6
40-
.into_af2_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrl);
40+
.into_af_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrl);
4141
let pa7 = gpioa
4242
.pa7
43-
.into_af2_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrl);
43+
.into_af_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrl);
4444

4545
let mut gpiob = dp.GPIOB.split(&mut rcc.ahb);
4646
let pb0 = gpiob
4747
.pb0
48-
.into_af2_push_pull(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrl);
48+
.into_af_push_pull(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrl);
4949
let pb1 = gpiob
5050
.pb1
51-
.into_af2_push_pull(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrl);
51+
.into_af_push_pull(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrl);
5252
let pb4 = gpiob
5353
.pb4
54-
.into_af2_push_pull(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrl);
54+
.into_af_push_pull(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrl);
5555
let pb5 = gpiob
5656
.pb5
57-
.into_af2_push_pull(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrl);
57+
.into_af_push_pull(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrl);
5858
let pb8 = gpiob
5959
.pb8
60-
.into_af1_push_pull(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrh);
60+
.into_af_push_pull(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrh);
6161
let pb10 = gpiob
6262
.pb10
63-
.into_af1_push_pull(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrh);
63+
.into_af_push_pull(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrh);
6464

6565
let mut gpioc = dp.GPIOC.split(&mut rcc.ahb);
6666
let pc10 = gpioc
6767
.pc10
68-
.into_af4_push_pull(&mut gpioc.moder, &mut gpioc.otyper, &mut gpioc.afrh);
68+
.into_af_push_pull(&mut gpioc.moder, &mut gpioc.otyper, &mut gpioc.afrh);
6969

7070
// TIM3
7171
//

examples/serial_dma.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ fn main() -> ! {
3535
let pins = (
3636
gpioa
3737
.pa9
38-
.into_af7_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrh),
38+
.into_af_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrh),
3939
gpioa
4040
.pa10
41-
.into_af7_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrh),
41+
.into_af_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrh),
4242
);
4343
let serial = Serial::new(dp.USART1, pins, 9600.Bd(), clocks, &mut rcc.apb2);
4444
let (tx, rx) = serial.split();

examples/serial_echo_rtic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ mod app {
6969
// configure this pin to make use of its `USART1_TX` alternative function
7070
// (AF mapping taken from table 14 "Alternate functions for port A" of the datasheet at
7171
// https://www.st.com/en/microcontrollers-microprocessors/stm32f303vc.html)
72-
.into_af7_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrh),
72+
.into_af_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrh),
7373
gpioa
7474
// Rx pin
7575
.pa10
7676
// configure this pin to make use of its `USART1_RX` alternative function
7777
// (AF mapping taken from table 14 "Alternate functions for port A" of the datasheet at
7878
// https://www.st.com/en/microcontrollers-microprocessors/stm32f303vc.html)
79-
.into_af7_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrh),
79+
.into_af_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrh),
8080
);
8181
pins.1.internal_pull_up(&mut gpioa.pupdr, true);
8282
let mut serial: SerialType =

0 commit comments

Comments
 (0)