aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-stm32')
-rw-r--r--embassy-stm32/CHANGELOG.md4
-rw-r--r--embassy-stm32/Cargo.toml119
-rw-r--r--embassy-stm32/release.toml5
-rw-r--r--embassy-stm32/src/sai/mod.rs52
4 files changed, 134 insertions, 46 deletions
diff --git a/embassy-stm32/CHANGELOG.md b/embassy-stm32/CHANGELOG.md
index bf451da79..c8ae7a357 100644
--- a/embassy-stm32/CHANGELOG.md
+++ b/embassy-stm32/CHANGELOG.md
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8<!-- next-header --> 8<!-- next-header -->
9## Unreleased - ReleaseDate 9## Unreleased - ReleaseDate
10 10
11## 0.4.0 - 2025-08-26
12
13- feat: stm32/sai: make NODIV independent of MCKDIV
14- fix: stm32/sai: fix WB MCKDIV
11- fix: stm32/i2c: pull-down was enabled instead of pull-none when no internal pull-up was needed. 15- fix: stm32/i2c: pull-down was enabled instead of pull-none when no internal pull-up was needed.
12- feat: Improve blocking hash speed 16- feat: Improve blocking hash speed
13- fix: Fix vrefbuf building with log feature 17- fix: Fix vrefbuf building with log feature
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml
index 45b351acf..cdb4e07d1 100644
--- a/embassy-stm32/Cargo.toml
+++ b/embassy-stm32/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2name = "embassy-stm32" 2name = "embassy-stm32"
3version = "0.3.0" 3version = "0.4.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Embassy Hardware Abstraction Layer (HAL) for ST STM32 series microcontrollers" 6description = "Embassy Hardware Abstraction Layer (HAL) for ST STM32 series microcontrollers"
@@ -9,6 +9,99 @@ categories = ["embedded", "hardware-support", "no-std", "asynchronous"]
9repository = "https://github.com/embassy-rs/embassy" 9repository = "https://github.com/embassy-rs/embassy"
10documentation = "https://docs.embassy.dev/embassy-stm32" 10documentation = "https://docs.embassy.dev/embassy-stm32"
11 11
12[package.metadata.embassy]
13build = [
14 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "dual-bank", "exti", "stm32l552ze", "time", "time-driver-any"]},
15 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "dual-bank", "stm32l552ze", "time", "time-driver-any"]},
16 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "dual-bank", "exti", "stm32l552ze", "time"]},
17 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "dual-bank", "stm32l552ze", "time"]},
18 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "dual-bank", "exti", "stm32l552ze"]},
19 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "dual-bank", "stm32l552ze"]},
20 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "single-bank", "stm32l552ze"]},
21 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32c071rb", "time", "time-driver-any"]},
22 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32c051f6", "time", "time-driver-any"]},
23 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32c091gb", "time", "time-driver-any"]},
24 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32c092rc", "time", "time-driver-any"]},
25 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32f038f6", "time", "time-driver-any"]},
26 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32f030c6", "time", "time-driver-any"]},
27 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32f058t8", "time", "time-driver-any"]},
28 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32f030r8", "time", "time-driver-any"]},
29 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32f031k6", "time", "time-driver-any"]},
30 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32f030rc", "time", "time-driver-any"]},
31 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32f070f6", "time", "time-driver-any"]},
32 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32f078vb", "time", "time-driver-any"]},
33 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32f042g4", "time", "time-driver-any"]},
34 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32f072c8", "time", "time-driver-any"]},
35 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f401ve", "time-driver-any"]},
36 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f405zg", "time-driver-any"]},
37 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f407zg", "time-driver-any"]},
38 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f401ve", "time", "time-driver-any"]},
39 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f405zg", "time", "time-driver-any"]},
40 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f407zg", "time", "time-driver-any"]},
41 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f410tb", "time", "time-driver-any"]},
42 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f411ce", "time", "time-driver-any"]},
43 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f412zg", "time", "time-driver-any"]},
44 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f413vh", "time", "time-driver-any"]},
45 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f415zg", "time", "time-driver-any"]},
46 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f417zg", "time", "time-driver-any"]},
47 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f423zh", "time", "time-driver-any"]},
48 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f427zi", "time", "time-driver-any"]},
49 {target = "thumbv7em-none-eabi", features = ["exti", "log", "stm32f429zi", "time", "time-driver-any"]},
50 {target = "thumbv7em-none-eabi", features = ["exti", "log", "stm32f437zi", "time", "time-driver-any"]},
51 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f439zi", "time", "time-driver-any"]},
52 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f446ze", "time", "time-driver-any"]},
53 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f469zi", "time", "time-driver-any"]},
54 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f479zi", "time", "time-driver-any"]},
55 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f730i8", "time", "time-driver-any"]},
56 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32h753zi", "time", "time-driver-any"]},
57 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32h735zg", "time", "time-driver-any"]},
58 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "split-pc2", "split-pc3", "stm32h755zi-cm7", "time", "time-driver-any"]},
59 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32h725re", "time", "time-driver-any"]},
60 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32h7b3ai", "time", "time-driver-any"]},
61 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32h7b3ai", "time", "time-driver-tim1"]},
62 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32h7r3z8", "time", "time-driver-tim1"]},
63 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32h7r7a8", "time", "time-driver-tim1"]},
64 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32h7s3a8", "time", "time-driver-tim1"]},
65 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32h7s7z8", "time", "time-driver-tim1"]},
66 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32l431cb", "time", "time-driver-any"]},
67 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32l476vg", "time", "time-driver-any"]},
68 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32l422cb", "time", "time-driver-any"]},
69 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32wb15cc", "time", "time-driver-any"]},
70 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32l072cz", "time", "time-driver-any"]},
71 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32l041f6", "time", "time-driver-any"]},
72 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32l051k8", "time", "time-driver-any"]},
73 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "low-power", "stm32l073cz", "time", "time-driver-any"]},
74 {target = "thumbv7m-none-eabi", features = ["defmt", "exti", "stm32l151cb-a", "time", "time-driver-any"]},
75 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f303c8", "time", "time-driver-any"]},
76 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f398ve", "time", "time-driver-any"]},
77 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32f378cc", "time", "time-driver-any"]},
78 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32g0b0ce", "time", "time-driver-any"]},
79 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32g0c1ve", "time", "time-driver-any"]},
80 {target = "thumbv7m-none-eabi", features = ["defmt", "exti", "stm32f217zg", "time", "time-driver-any"]},
81 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "dual-bank", "exti", "low-power", "stm32l552ze", "time", "time-driver-any"]},
82 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32wl54jc-cm0p", "time", "time-driver-any"]},
83 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32wle5jb", "time", "time-driver-any"]},
84 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32g431kb", "time", "time-driver-any"]},
85 {target = "thumbv7em-none-eabi", features = ["defmt", "dual-bank", "exti", "stm32g474pe", "time", "time-driver-any"]},
86 {target = "thumbv7m-none-eabi", features = ["defmt", "exti", "stm32f107vc", "time", "time-driver-any"]},
87 {target = "thumbv7m-none-eabi", features = ["defmt", "exti", "stm32f103re", "time", "time-driver-any"]},
88 {target = "thumbv7m-none-eabi", features = ["defmt", "exti", "stm32f100c4", "time", "time-driver-any"]},
89 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "exti", "stm32h503rb", "time", "time-driver-any"]},
90 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "exti", "stm32h523cc", "time", "time-driver-any"]},
91 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "exti", "stm32h562ag", "time", "time-driver-any"]},
92 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "exti", "stm32wba50ke", "time", "time-driver-any"]},
93 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "exti", "stm32wba55ug", "time", "time-driver-any"]},
94 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "exti", "stm32wba62cg", "time", "time-driver-any"]},
95 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "exti", "low-power", "stm32wba65ri", "time", "time-driver-any"]},
96 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "exti", "stm32u5f9zj", "time", "time-driver-any"]},
97 {target = "thumbv8m.main-none-eabihf", features = ["defmt", "exti", "stm32u5g9nj", "time", "time-driver-any"]},
98 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "stm32wb35ce", "time", "time-driver-any"]},
99 {target = "thumbv7em-none-eabi", features = ["defmt", "exti", "low-power", "stm32wb55rg", "time", "time-driver-any"]},
100 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32u031r8", "time", "time-driver-any"]},
101 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32u073mb", "time", "time-driver-any"]},
102 {target = "thumbv6m-none-eabi", features = ["defmt", "exti", "stm32u083rc", "time", "time-driver-any"]},
103]
104
12[package.metadata.embassy_docs] 105[package.metadata.embassy_docs]
13src_base = "https://github.com/embassy-rs/embassy/blob/embassy-stm32-v$VERSION/embassy-stm32/src/" 106src_base = "https://github.com/embassy-rs/embassy/blob/embassy-stm32-v$VERSION/embassy-stm32/src/"
14src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-stm32/src/" 107src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-stm32/src/"
@@ -48,17 +141,17 @@ features = ["defmt", "unstable-pac", "exti", "time-driver-any", "time", "stm32h7
48rustdoc-args = ["--cfg", "docsrs"] 141rustdoc-args = ["--cfg", "docsrs"]
49 142
50[dependencies] 143[dependencies]
51embassy-sync = { version = "0.7.1", path = "../embassy-sync" } 144embassy-sync = { version = "0.7.2", path = "../embassy-sync" }
52embassy-time = { version = "0.4.0", path = "../embassy-time", optional = true } 145embassy-time = { version = "0.5.0", path = "../embassy-time", optional = true }
53embassy-time-driver = { version = "0.2", path = "../embassy-time-driver", optional = true } 146embassy-time-driver = { version = "0.2.1", path = "../embassy-time-driver", optional = true }
54embassy-time-queue-utils = { version = "0.2", path = "../embassy-time-queue-utils", optional = true } 147embassy-time-queue-utils = { version = "0.3.0", path = "../embassy-time-queue-utils", optional = true }
55embassy-futures = { version = "0.1.0", path = "../embassy-futures" } 148embassy-futures = { version = "0.1.2", path = "../embassy-futures" }
56embassy-hal-internal = { version = "0.3.0", path = "../embassy-hal-internal", features = ["cortex-m", "prio-bits-4"] } 149embassy-hal-internal = { version = "0.3.0", path = "../embassy-hal-internal", features = ["cortex-m", "prio-bits-4"] }
57embassy-embedded-hal = { version = "0.4.0", path = "../embassy-embedded-hal", default-features = false } 150embassy-embedded-hal = { version = "0.5.0", path = "../embassy-embedded-hal", default-features = false }
58embassy-net-driver = { version = "0.2.0", path = "../embassy-net-driver" } 151embassy-net-driver = { version = "0.2.0", path = "../embassy-net-driver" }
59embassy-usb-driver = { version = "0.2.0", path = "../embassy-usb-driver" } 152embassy-usb-driver = { version = "0.2.0", path = "../embassy-usb-driver" }
60embassy-usb-synopsys-otg = { version = "0.3.0", path = "../embassy-usb-synopsys-otg" } 153embassy-usb-synopsys-otg = { version = "0.3.1", path = "../embassy-usb-synopsys-otg" }
61embassy-executor = { version = "0.8.0", path = "../embassy-executor", optional = true } 154embassy-executor = { version = "0.9.0", path = "../embassy-executor", optional = true }
62 155
63embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } 156embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
64embedded-hal-1 = { package = "embedded-hal", version = "1.0" } 157embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
@@ -80,8 +173,8 @@ cortex-m = "0.7.6"
80futures-util = { version = "0.3.30", default-features = false } 173futures-util = { version = "0.3.30", default-features = false }
81sdio-host = "0.9.0" 174sdio-host = "0.9.0"
82critical-section = "1.1" 175critical-section = "1.1"
83# stm32-metapac = { version = "17" } 176stm32-metapac = { version = "18" }
84stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-ecb93d42a6cbcd9e09cab74873908a2ca22327f7" } 177#stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-ecb93d42a6cbcd9e09cab74873908a2ca22327f7" }
85 178
86vcell = "0.1.3" 179vcell = "0.1.3"
87nb = "1.0.0" 180nb = "1.0.0"
@@ -109,8 +202,8 @@ proptest-state-machine = "0.3.0"
109proc-macro2 = "1.0.36" 202proc-macro2 = "1.0.36"
110quote = "1.0.15" 203quote = "1.0.15"
111 204
112# stm32-metapac = { version = "17", default-features = false, features = ["metadata"]} 205stm32-metapac = { version = "18", default-features = false, features = ["metadata"]}
113stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-ecb93d42a6cbcd9e09cab74873908a2ca22327f7", default-features = false, features = ["metadata"] } 206#stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-ecb93d42a6cbcd9e09cab74873908a2ca22327f7", default-features = false, features = ["metadata"] }
114 207
115[features] 208[features]
116default = ["rt"] 209default = ["rt"]
diff --git a/embassy-stm32/release.toml b/embassy-stm32/release.toml
deleted file mode 100644
index fb6feaf21..000000000
--- a/embassy-stm32/release.toml
+++ /dev/null
@@ -1,5 +0,0 @@
1pre-release-replacements = [
2 {file="CHANGELOG.md", search="Unreleased", replace="{{version}}", min=1},
3 {file="CHANGELOG.md", search="ReleaseDate", replace="{{date}}", min=1},
4 {file="CHANGELOG.md", search="<!-- next-header -->", replace="<!-- next-header -->\n## Unreleased - ReleaseDate\n", exactly=1},
5]
diff --git a/embassy-stm32/src/sai/mod.rs b/embassy-stm32/src/sai/mod.rs
index 0c9c27797..4965f8b04 100644
--- a/embassy-stm32/src/sai/mod.rs
+++ b/embassy-stm32/src/sai/mod.rs
@@ -48,7 +48,7 @@ pub enum Mode {
48} 48}
49 49
50impl Mode { 50impl Mode {
51 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 51 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
52 const fn mode(&self, tx_rx: TxRx) -> vals::Mode { 52 const fn mode(&self, tx_rx: TxRx) -> vals::Mode {
53 match tx_rx { 53 match tx_rx {
54 TxRx::Transmitter => match self { 54 TxRx::Transmitter => match self {
@@ -83,7 +83,7 @@ pub enum SlotSize {
83} 83}
84 84
85impl SlotSize { 85impl SlotSize {
86 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 86 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
87 const fn slotsz(&self) -> vals::Slotsz { 87 const fn slotsz(&self) -> vals::Slotsz {
88 match self { 88 match self {
89 SlotSize::DataSize => vals::Slotsz::DATA_SIZE, 89 SlotSize::DataSize => vals::Slotsz::DATA_SIZE,
@@ -106,7 +106,7 @@ pub enum DataSize {
106} 106}
107 107
108impl DataSize { 108impl DataSize {
109 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 109 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
110 const fn ds(&self) -> vals::Ds { 110 const fn ds(&self) -> vals::Ds {
111 match self { 111 match self {
112 DataSize::Data8 => vals::Ds::BIT8, 112 DataSize::Data8 => vals::Ds::BIT8,
@@ -131,7 +131,7 @@ pub enum FifoThreshold {
131} 131}
132 132
133impl FifoThreshold { 133impl FifoThreshold {
134 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 134 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
135 const fn fth(&self) -> vals::Fth { 135 const fn fth(&self) -> vals::Fth {
136 match self { 136 match self {
137 FifoThreshold::Empty => vals::Fth::EMPTY, 137 FifoThreshold::Empty => vals::Fth::EMPTY,
@@ -152,7 +152,7 @@ pub enum MuteValue {
152} 152}
153 153
154impl MuteValue { 154impl MuteValue {
155 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 155 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
156 const fn muteval(&self) -> vals::Muteval { 156 const fn muteval(&self) -> vals::Muteval {
157 match self { 157 match self {
158 MuteValue::Zero => vals::Muteval::SEND_ZERO, 158 MuteValue::Zero => vals::Muteval::SEND_ZERO,
@@ -171,7 +171,7 @@ pub enum Protocol {
171} 171}
172 172
173impl Protocol { 173impl Protocol {
174 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 174 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
175 const fn prtcfg(&self) -> vals::Prtcfg { 175 const fn prtcfg(&self) -> vals::Prtcfg {
176 match self { 176 match self {
177 Protocol::Free => vals::Prtcfg::FREE, 177 Protocol::Free => vals::Prtcfg::FREE,
@@ -229,7 +229,7 @@ pub enum StereoMono {
229} 229}
230 230
231impl StereoMono { 231impl StereoMono {
232 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 232 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
233 const fn mono(&self) -> vals::Mono { 233 const fn mono(&self) -> vals::Mono {
234 match self { 234 match self {
235 StereoMono::Stereo => vals::Mono::STEREO, 235 StereoMono::Stereo => vals::Mono::STEREO,
@@ -248,7 +248,7 @@ pub enum BitOrder {
248} 248}
249 249
250impl BitOrder { 250impl BitOrder {
251 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 251 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
252 const fn lsbfirst(&self) -> vals::Lsbfirst { 252 const fn lsbfirst(&self) -> vals::Lsbfirst {
253 match self { 253 match self {
254 BitOrder::LsbFirst => vals::Lsbfirst::LSB_FIRST, 254 BitOrder::LsbFirst => vals::Lsbfirst::LSB_FIRST,
@@ -267,7 +267,7 @@ pub enum FrameSyncOffset {
267} 267}
268 268
269impl FrameSyncOffset { 269impl FrameSyncOffset {
270 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 270 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
271 const fn fsoff(&self) -> vals::Fsoff { 271 const fn fsoff(&self) -> vals::Fsoff {
272 match self { 272 match self {
273 FrameSyncOffset::OnFirstBit => vals::Fsoff::ON_FIRST, 273 FrameSyncOffset::OnFirstBit => vals::Fsoff::ON_FIRST,
@@ -286,7 +286,7 @@ pub enum FrameSyncPolarity {
286} 286}
287 287
288impl FrameSyncPolarity { 288impl FrameSyncPolarity {
289 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 289 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
290 const fn fspol(&self) -> vals::Fspol { 290 const fn fspol(&self) -> vals::Fspol {
291 match self { 291 match self {
292 FrameSyncPolarity::ActiveLow => vals::Fspol::FALLING_EDGE, 292 FrameSyncPolarity::ActiveLow => vals::Fspol::FALLING_EDGE,
@@ -304,7 +304,7 @@ pub enum FrameSyncDefinition {
304} 304}
305 305
306impl FrameSyncDefinition { 306impl FrameSyncDefinition {
307 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 307 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
308 const fn fsdef(&self) -> bool { 308 const fn fsdef(&self) -> bool {
309 match self { 309 match self {
310 FrameSyncDefinition::StartOfFrame => false, 310 FrameSyncDefinition::StartOfFrame => false,
@@ -322,7 +322,7 @@ pub enum ClockStrobe {
322} 322}
323 323
324impl ClockStrobe { 324impl ClockStrobe {
325 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 325 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
326 const fn ckstr(&self) -> vals::Ckstr { 326 const fn ckstr(&self) -> vals::Ckstr {
327 match self { 327 match self {
328 ClockStrobe::Falling => vals::Ckstr::FALLING_EDGE, 328 ClockStrobe::Falling => vals::Ckstr::FALLING_EDGE,
@@ -340,7 +340,7 @@ pub enum ComplementFormat {
340} 340}
341 341
342impl ComplementFormat { 342impl ComplementFormat {
343 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 343 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
344 const fn cpl(&self) -> vals::Cpl { 344 const fn cpl(&self) -> vals::Cpl {
345 match self { 345 match self {
346 ComplementFormat::OnesComplement => vals::Cpl::ONES_COMPLEMENT, 346 ComplementFormat::OnesComplement => vals::Cpl::ONES_COMPLEMENT,
@@ -359,7 +359,7 @@ pub enum Companding {
359} 359}
360 360
361impl Companding { 361impl Companding {
362 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 362 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
363 const fn comp(&self) -> vals::Comp { 363 const fn comp(&self) -> vals::Comp {
364 match self { 364 match self {
365 Companding::None => vals::Comp::NO_COMPANDING, 365 Companding::None => vals::Comp::NO_COMPANDING,
@@ -378,7 +378,7 @@ pub enum OutputDrive {
378} 378}
379 379
380impl OutputDrive { 380impl OutputDrive {
381 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 381 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
382 const fn outdriv(&self) -> vals::Outdriv { 382 const fn outdriv(&self) -> vals::Outdriv {
383 match self { 383 match self {
384 OutputDrive::OnStart => vals::Outdriv::ON_START, 384 OutputDrive::OnStart => vals::Outdriv::ON_START,
@@ -414,7 +414,7 @@ pub enum MasterClockDivider {
414/// Master clock divider. 414/// Master clock divider.
415#[derive(Copy, Clone, PartialEq)] 415#[derive(Copy, Clone, PartialEq)]
416#[allow(missing_docs)] 416#[allow(missing_docs)]
417#[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 417#[cfg(any(sai_v1_4pdm, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
418pub enum MasterClockDivider { 418pub enum MasterClockDivider {
419 MasterClockDisabled, 419 MasterClockDisabled,
420 Div1, 420 Div1,
@@ -506,7 +506,7 @@ impl MasterClockDivider {
506 } 506 }
507 } 507 }
508 508
509 #[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 509 #[cfg(any(sai_v1_4pdm, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
510 const fn mckdiv(&self) -> u8 { 510 const fn mckdiv(&self) -> u8 {
511 match self { 511 match self {
512 MasterClockDivider::MasterClockDisabled => 0, 512 MasterClockDivider::MasterClockDisabled => 0,
@@ -602,6 +602,7 @@ pub struct Config {
602 pub clock_strobe: ClockStrobe, 602 pub clock_strobe: ClockStrobe,
603 pub output_drive: OutputDrive, 603 pub output_drive: OutputDrive,
604 pub master_clock_divider: MasterClockDivider, 604 pub master_clock_divider: MasterClockDivider,
605 pub nodiv: bool,
605 pub is_high_impedance_on_inactive_slot: bool, 606 pub is_high_impedance_on_inactive_slot: bool,
606 pub fifo_threshold: FifoThreshold, 607 pub fifo_threshold: FifoThreshold,
607 pub companding: Companding, 608 pub companding: Companding,
@@ -631,6 +632,7 @@ impl Default for Config {
631 frame_sync_definition: FrameSyncDefinition::ChannelIdentification, 632 frame_sync_definition: FrameSyncDefinition::ChannelIdentification,
632 frame_length: 32, 633 frame_length: 32,
633 master_clock_divider: MasterClockDivider::MasterClockDisabled, 634 master_clock_divider: MasterClockDivider::MasterClockDisabled,
635 nodiv: false,
634 clock_strobe: ClockStrobe::Rising, 636 clock_strobe: ClockStrobe::Rising,
635 output_drive: OutputDrive::Immediately, 637 output_drive: OutputDrive::Immediately,
636 is_high_impedance_on_inactive_slot: false, 638 is_high_impedance_on_inactive_slot: false,
@@ -704,7 +706,7 @@ fn update_synchronous_config(config: &mut Config) {
704 config.mode = Mode::Slave; 706 config.mode = Mode::Slave;
705 config.sync_output = false; 707 config.sync_output = false;
706 708
707 #[cfg(any(sai_v1, sai_v2))] 709 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2))]
708 { 710 {
709 config.sync_input = SyncInput::Internal; 711 config.sync_input = SyncInput::Internal;
710 } 712 }
@@ -858,7 +860,7 @@ impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> {
858 ) -> Self { 860 ) -> Self {
859 let ch = T::REGS.ch(sub_block as usize); 861 let ch = T::REGS.ch(sub_block as usize);
860 862
861 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 863 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
862 { 864 {
863 ch.cr1().modify(|w| w.set_saien(false)); 865 ch.cr1().modify(|w| w.set_saien(false));
864 } 866 }
@@ -884,7 +886,7 @@ impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> {
884 } 886 }
885 } 887 }
886 888
887 #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] 889 #[cfg(any(sai_v1, sai_v1_4pdm, sai_v2, sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))]
888 { 890 {
889 ch.cr1().modify(|w| { 891 ch.cr1().modify(|w| {
890 w.set_mode(config.mode.mode(if Self::is_transmitter(&ring_buffer) { 892 w.set_mode(config.mode.mode(if Self::is_transmitter(&ring_buffer) {
@@ -899,14 +901,8 @@ impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> {
899 w.set_syncen(config.sync_input.syncen()); 901 w.set_syncen(config.sync_input.syncen());
900 w.set_mono(config.stereo_mono.mono()); 902 w.set_mono(config.stereo_mono.mono());
901 w.set_outdriv(config.output_drive.outdriv()); 903 w.set_outdriv(config.output_drive.outdriv());
902 w.set_mckdiv(config.master_clock_divider.mckdiv()); 904 w.set_mckdiv(config.master_clock_divider.mckdiv().into());
903 w.set_nodiv( 905 w.set_nodiv(config.nodiv);
904 if config.master_clock_divider == MasterClockDivider::MasterClockDisabled {
905 vals::Nodiv::NO_DIV
906 } else {
907 vals::Nodiv::MASTER_CLOCK
908 },
909 );
910 w.set_dmaen(true); 906 w.set_dmaen(true);
911 }); 907 });
912 908