Skip to content

Commit

Permalink
Split all device features
Browse files Browse the repository at this point in the history
  • Loading branch information
Piroro-hs committed Apr 21, 2021
1 parent 231c959 commit 22f9d06
Show file tree
Hide file tree
Showing 5 changed files with 218 additions and 182 deletions.
38 changes: 21 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,34 @@ jobs:
strategy:
matrix:
mcu:
- stm32f301
- stm32f318
- stm32f301x6
- stm32f318x8
- stm32f302x6
# - stm32f302x8
- stm32f302xb
- stm32f302xc
# - stm32f302xc
- stm32f302xd
- stm32f302xe
- stm32f302x6
- stm32f302x8
# - stm32f302xe
- stm32f303x6
# - stm32f303x8
- stm32f303xb
- stm32f303xc
# - stm32f303xc
- stm32f303xd
- stm32f303xe
- stm32f303x6
- stm32f303x8
- stm32f373
- stm32f378
- stm32f334
- stm32f328
- stm32f358
- stm32f398
# - stm32f303xe
- stm32f328x8
- stm32f358xc
- stm32f398xe
- stm32f373x8
# - stm32f373xb
# - stm32f373xc
- stm32f378xc
- stm32f334x4
# - stm32f334x6
# - stm32f334x8
features: ["rt"]
include:
- mcu: stm32f303xc
features: rt,stm32-usbd
features: rt,can,stm32-usbd
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
Expand Down
39 changes: 29 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ direct-call-deprecated = []
rt = ["stm32f3/rt"]
can = ["embedded-hal-can"]

svd-f301 = ["stm32f3/stm32f301"]
svd-f302 = ["stm32f3/stm32f302"]
svd-f303 = ["stm32f3/stm32f303"]
svd-f373 = ["stm32f3/stm32f373"]
svd-f3x4 = ["stm32f3/stm32f3x4"]

gpio-f302 = []
gpio-f303 = []
gpio-f303e = []
Expand All @@ -77,28 +83,41 @@ gpio-f373 = []

# Any changes here should be mirrored in README.md, src/lib.rs, and
# .github/workflows/ci.yml.
stm32f301 = ["gpio-f302", "stm32f3/stm32f301", "device-selected"]
stm32f318 = ["gpio-f302", "stm32f3/stm32f301", "device-selected"]
stm32f302 = ["stm32f3/stm32f302", "direct-call-deprecated"]
stm32f301 = ["svd-f301", "direct-call-deprecated"]
stm32f301x6 = ["stm32f301", "gpio-f302", "device-selected"]
stm32f301x8 = ["stm32f301", "gpio-f302", "device-selected"]
stm32f318 = ["svd-f301", "direct-call-deprecated"]
stm32f318x8 = ["stm32f318", "gpio-f302", "device-selected"]
stm32f302 = ["svd-f302", "direct-call-deprecated"]
stm32f302x6 = ["stm32f302", "gpio-f302", "device-selected"]
stm32f302x8 = ["stm32f302", "gpio-f302", "device-selected"]
stm32f302xb = ["stm32f302", "gpio-f303", "device-selected"]
stm32f302xc = ["stm32f302", "gpio-f303", "device-selected"]
stm32f302xd = ["stm32f302", "gpio-f303e", "device-selected"]
stm32f302xe = ["stm32f302", "gpio-f303e", "device-selected"]
stm32f303 = ["stm32f3/stm32f303", "direct-call-deprecated"]
stm32f303 = ["svd-f303", "direct-call-deprecated"]
stm32f303x6 = ["stm32f303", "gpio-f333", "device-selected"]
stm32f303x8 = ["stm32f303", "gpio-f333", "device-selected"]
stm32f303xb = ["stm32f303", "gpio-f303", "device-selected"]
stm32f303xc = ["stm32f303", "gpio-f303", "device-selected"]
stm32f303xd = ["stm32f303", "gpio-f303e", "device-selected"]
stm32f303xe = ["stm32f303", "gpio-f303e", "device-selected"]
stm32f328 = ["gpio-f333", "stm32f3/stm32f303", "device-selected"]
stm32f358 = ["gpio-f303", "stm32f3/stm32f303", "device-selected"]
stm32f398 = ["gpio-f303e", "stm32f3/stm32f303", "device-selected"]
stm32f373 = ["gpio-f373", "stm32f3/stm32f373", "device-selected"]
stm32f378 = ["gpio-f373", "stm32f3/stm32f373", "device-selected"]
stm32f334 = ["gpio-f333", "stm32f3/stm32f3x4", "device-selected"]
stm32f328 = ["svd-f303", "direct-call-deprecated"]
stm32f328x8 = ["stm32f328", "gpio-f333", "device-selected"]
stm32f358 = ["svd-f303", "direct-call-deprecated"]
stm32f358xc = ["stm32f358", "gpio-f303", "device-selected"]
stm32f398 = ["svd-f303", "direct-call-deprecated"]
stm32f398xe = ["stm32f398", "gpio-f303e", "device-selected"]
stm32f373 = ["svd-f373", "direct-call-deprecated"]
stm32f373x8 = ["stm32f373", "gpio-f373", "device-selected"]
stm32f373xb = ["stm32f373", "gpio-f373", "device-selected"]
stm32f373xc = ["stm32f373", "gpio-f373", "device-selected"]
stm32f378 = ["svd-f373", "direct-call-deprecated"]
stm32f378xc = ["stm32f378", "gpio-f373", "device-selected"]
stm32f334 = ["svd-f3x4", "direct-call-deprecated"]
stm32f334x4 = ["stm32f334", "gpio-f333", "device-selected"]
stm32f334x6 = ["stm32f334", "gpio-f333", "device-selected"]
stm32f334x8 = ["stm32f334", "gpio-f333", "device-selected"]

defmt-default = ["defmt"]
defmt-trace = ["defmt"]
Expand Down
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,31 @@ So you want to expand your call to `cargo` with `--features stm32f303xc`.*

Note: `x` denotes any character in [a-z]

* stm32f301xb
* stm32f301xc
* stm32f301xd
* stm32f301xe
* stm32f318
* stm32f301x6
* stm32f301x8
* stm32f318x8
* stm32f302x6
* stm32f302x8
* stm32f302xb
* stm32f302xc
* stm32f302xd
* stm32f302xe
* stm32f302x6
* stm32f302x8
* stm32f303x6
* stm32f303x8
* stm32f303xb
* stm32f303xc
* stm32f303xd
* stm32f303xe
* stm32f303x6
* stm32f303x8
* stm32f373
* stm32f378
* stm32f334
* stm32f328
* stm32f358
* stm32f398
* stm32f328x8
* stm32f358xc
* stm32f398xe
* stm32f373x8
* stm32f373xb
* stm32f373xc
* stm32f378xc
* stm32f334x4
* stm32f334x6
* stm32f334x8

### Background

Expand Down
12 changes: 6 additions & 6 deletions src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,15 +533,15 @@ where
}

/// Return an EXTI register for the current CPU
#[cfg(any(feature = "stm32f373", feature = "stm32f378"))]
#[cfg(feature = "svd-f373")]
macro_rules! reg_for_cpu {
($exti:expr, $xr:ident) => {
$exti.$xr
};
}

/// Return an EXTI register for the current CPU
#[cfg(not(any(feature = "stm32f373", feature = "stm32f378")))]
#[cfg(not(feature = "svd-f373"))]
macro_rules! reg_for_cpu {
($exti:expr, $xr:ident) => {
paste::paste! {
Expand All @@ -561,15 +561,15 @@ where
match self.index.index() {
0 => Interrupt::EXTI0,
1 => Interrupt::EXTI1,
#[cfg(any(feature = "stm32f373", feature = "stm32f378"))]
#[cfg(feature = "svd-f373")]
2 => Interrupt::EXTI2_TS,
#[cfg(not(any(feature = "stm32f373", feature = "stm32f378")))]
#[cfg(not(feature = "svd-f373"))]
2 => Interrupt::EXTI2_TSC,
3 => Interrupt::EXTI3,
4 => Interrupt::EXTI4,
#[cfg(any(feature = "stm32f373", feature = "stm32f378"))]
#[cfg(feature = "svd-f373")]
5..=9 => Interrupt::EXTI5_9,
#[cfg(not(any(feature = "stm32f373", feature = "stm32f378")))]
#[cfg(not(feature = "svd-f373"))]
5..=9 => Interrupt::EXTI9_5,
10..=15 => Interrupt::EXTI15_10,
_ => unreachable!(),
Expand Down
Loading

0 comments on commit 22f9d06

Please sign in to comment.