Skip to content

Commit 773836d

Browse files
authored
Merge pull request #467 from stm32-rs/merge-queue
merge queue
2 parents 49aefa1 + 318f25f commit 773836d

File tree

12 files changed

+116
-40
lines changed

12 files changed

+116
-40
lines changed

.github/bors.toml

-11
This file was deleted.

.github/workflows/changelog.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
on:
2+
pull_request_target:
3+
4+
name: Changelog check
5+
6+
jobs:
7+
changelog:
8+
name: Changelog check
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout sources
12+
uses: actions/checkout@v3
13+
14+
- name: Changelog updated
15+
uses: Zomzog/[email protected]
16+
with:
17+
fileName: CHANGELOG.md
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yml

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
on:
22
push:
3-
branches: [ staging, trying, master ]
3+
branches: master
44
pull_request:
5+
merge_group:
56

67
name: Continuous integration
78

89
jobs:
910
ci:
11+
name: CI
12+
runs-on: ubuntu-latest
13+
needs: [check]
14+
if: always()
15+
steps:
16+
- name: Done
17+
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
18+
19+
check:
1020
runs-on: ubuntu-latest
1121
strategy:
1222
matrix:
@@ -33,7 +43,7 @@ jobs:
3343
- uses: actions-rs/cargo@v1
3444
with:
3545
command: check
36-
args: --features=${{ matrix.mcu }},rt --examples
46+
args: --features=${{ matrix.mcu }},rtic,high --examples
3747

3848
- uses: actions-rs/cargo@v1
3949
with:

.github/workflows/clippy.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
on: [push, pull_request]
1+
on:
2+
push:
3+
branches: master
4+
pull_request:
25

36
name: Clippy check
47
jobs:

.github/workflows/rustfmt.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
on: [push, pull_request]
1+
on:
2+
push:
3+
branches: master
4+
pull_request:
5+
merge_group:
26

37
name: Code formatting check
48

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
- Move from bors/manual merge to GH merge queue
11+
- Add tools/check.py python script for local check
12+
- Add changelog check on PRs
13+
1014
## [v0.10.0] - 2022-12-12
1115

1216
- `Timer`: adds `get_interrupt` to `Timer`

Cargo.toml

+12-11
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ unwrap-infallible = "0.1.5"
5050
[features]
5151
device-selected = []
5252
doc = []
53-
rt = ["stm32f1/rt"]
53+
# deprecated feature
54+
rt = []
5455
stm32f100 = ["stm32f1/stm32f100", "device-selected"]
5556
stm32f101 = ["stm32f1/stm32f101", "device-selected"]
5657
stm32f103 = ["stm32f1/stm32f103", "device-selected", "has-can", "stm32-usbd"]
@@ -68,7 +69,7 @@ connectivity = ["medium", "has-can"]
6869
# Devices with CAN interface
6970
has-can = []
7071

71-
rtic = ["rt", "rtic-monotonic"]
72+
rtic = ["rtic-monotonic"]
7273

7374
[profile.dev]
7475
incremental = false
@@ -81,35 +82,35 @@ lto = true
8182

8283
[[example]]
8384
name = "usb_serial"
84-
required-features = ["rt", "stm32-usbd"]
85+
required-features = ["stm32-usbd"]
8586

8687
[[example]]
8788
name = "usb_serial_interrupt"
88-
required-features = ["rt", "stm32-usbd"]
89+
required-features = ["stm32-usbd"]
8990

9091
[[example]]
9192
name = "usb_serial_rtic"
92-
required-features = ["rt", "stm32-usbd"]
93+
required-features = ["stm32-usbd"]
9394

9495
[[example]]
9596
name = "blinky_timer_irq"
96-
required-features = ["rt"]
97+
required-features = []
9798

9899
[[example]]
99100
name = "blinky_rtcalarm_irq"
100-
required-features = ["rt"]
101+
required-features = []
101102

102103
[[example]]
103104
name = "qei"
104105
required-features = ["medium"]
105106

106107
[[example]]
107108
name = "timer-interrupt-rtic"
108-
required-features = ["rt", "medium"]
109+
required-features = ["stm32f103", "medium"]
109110

110111
[[example]]
111112
name = "exti"
112-
required-features = ["rt"]
113+
required-features = []
113114

114115
[[example]]
115116
name = "can-echo"
@@ -121,12 +122,12 @@ required-features = ["has-can"]
121122

122123
[[example]]
123124
name = "can-rtic"
124-
required-features = ["has-can", "rt"]
125+
required-features = ["has-can"]
125126

126127
[[example]]
127128
name = "gpio_input"
128129
required-features = ["stm32f103"]
129130

130131
[[example]]
131132
name = "serial-interrupt-idle"
132-
required-features = ["stm32f103", "rt", "medium"]
133+
required-features = ["stm32f103", "medium"]

examples/serial-interrupt-idle.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use stm32f1xx_hal::{
1313
pac::interrupt,
1414
pac::USART1,
1515
prelude::*,
16-
serial::{Config, Rx, Serial, Tx},
16+
serial::{Rx, Serial, Tx},
1717
};
1818

1919
static mut RX: Option<Rx<USART1>> = None;
@@ -44,14 +44,8 @@ fn main() -> ! {
4444

4545
// Set up the usart device. Takes ownership over the USART register and tx/rx pins. The rest of
4646
// the registers are used to enable and configure the device.
47-
let (mut tx, mut rx) = Serial::usart1(
48-
p.USART1,
49-
(tx, rx),
50-
&mut afio.mapr,
51-
Config::default().baudrate(115200.bps()),
52-
clocks,
53-
)
54-
.split();
47+
let (mut tx, mut rx) =
48+
Serial::new(p.USART1, (tx, rx), &mut afio.mapr, 115200.bps(), &clocks).split();
5549
tx.listen();
5650
rx.listen();
5751
rx.listen_idle();

src/flash.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl<'a> FlashWriter<'a> {
112112
}
113113

114114
fn valid_length(&self, offset: u32, length: usize) -> Result<()> {
115-
if offset + length as u32 > self.flash_sz.kbytes() as u32 {
115+
if offset + length as u32 > self.flash_sz.kbytes() {
116116
Err(Error::LengthTooLong)
117117
} else if length & 0x1 != 0 {
118118
Err(Error::LengthNotMultiple2)
@@ -178,7 +178,7 @@ impl<'a> FlashWriter<'a> {
178178
let size = self.sector_sz.kbytes() as u32;
179179
let start = start_offset & !(size - 1);
180180
for idx in (start..start + size).step_by(2) {
181-
let write_address = (FLASH_START + idx as u32) as *const u16;
181+
let write_address = (FLASH_START + idx) as *const u16;
182182
let verify: u16 = unsafe { core::ptr::read_volatile(write_address) };
183183
if verify != 0xFFFF {
184184
return Err(Error::VerifyError);
@@ -209,7 +209,7 @@ impl<'a> FlashWriter<'a> {
209209
pub fn read(&self, offset: u32, length: usize) -> Result<&[u8]> {
210210
self.valid_address(offset)?;
211211

212-
if offset + length as u32 > self.flash_sz.kbytes() as u32 {
212+
if offset + length as u32 > self.flash_sz.kbytes() {
213213
return Err(Error::LengthTooLong);
214214
}
215215

src/gpio.rs

+3
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ pub trait GpioExt {
125125
fn split(self) -> Self::Parts;
126126

127127
/// Splits the GPIO block into independent pins and registers without resetting its state.
128+
///
129+
/// # Safety
130+
/// Make sure that all pins modes are set in reset state.
128131
unsafe fn split_without_reset(self) -> Self::Parts;
129132
}
130133

src/timer.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ use crate::time::Hertz;
6262
pub mod monotonic;
6363
#[cfg(feature = "rtic")]
6464
pub use monotonic::*;
65-
pub mod pwm_input;
66-
pub use pwm_input::*;
6765
pub(crate) mod pins;
66+
pub mod pwm_input;
6867
pub use pins::*;
6968
pub mod delay;
7069
pub use delay::*;

tools/check.py

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#! /usr/bin/env python3
2+
3+
import json
4+
import subprocess
5+
import sys
6+
7+
8+
def run_inner(args):
9+
print("Running `{}`...".format(" ".join(args)))
10+
ret = subprocess.call(args) == 0
11+
print("")
12+
return ret
13+
14+
15+
def run(mcu, cargo_cmd):
16+
if mcu == "":
17+
return run_inner(cargo_cmd)
18+
else:
19+
return run_inner(cargo_cmd + ["--features={}".format(mcu)])
20+
21+
22+
def main():
23+
cargo_meta = json.loads(
24+
subprocess.check_output("cargo metadata --no-deps --format-version=1",
25+
shell=True,
26+
universal_newlines=True)
27+
)
28+
29+
crate_info = cargo_meta["packages"][0]
30+
31+
features = ["{},rtic,high".format(x)
32+
for x in crate_info["features"].keys()
33+
if x.startswith("stm32f1")]
34+
35+
if 'size_check' in sys.argv:
36+
cargo_cmd = ['cargo', 'build', '--release']
37+
else:
38+
cargo_cmd = ['cargo', 'check']
39+
40+
if '--examples' in sys.argv:
41+
cargo_cmd += ['--examples']
42+
43+
if not all(map(lambda f: run(f, cargo_cmd),
44+
features)):
45+
sys.exit(-1)
46+
47+
48+
if __name__ == "__main__":
49+
main()
50+

0 commit comments

Comments
 (0)