aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Munns <[email protected]>2025-11-13 18:11:22 +0100
committerJames Munns <[email protected]>2025-11-13 18:11:22 +0100
commit0f8e7650b937aa5d4accef3fdf01047afe099df3 (patch)
treef14a38f1ce61d8749224304c6c84bf3673cb3b01
parentdd7a90eb51197fae6ef6c6b7beae977a9143e268 (diff)
parent7480db25d5cc1866a3e037bfb89f990d9847bd10 (diff)
Merge remote-tracking branch 'origin/main' into james/impl-clocks
-rw-r--r--.github/workflows/cargo-vet-pr-comment.yml2
-rw-r--r--.github/workflows/check.yml18
-rw-r--r--.github/workflows/nostd.yml11
-rw-r--r--.github/workflows/rolling.yml4
-rw-r--r--.gitignore1
-rw-r--r--Cargo.lock597
-rw-r--r--Cargo.toml2
-rw-r--r--src/adc.rs4
-rw-r--r--src/interrupt.rs4
-rw-r--r--src/lib.rs3
-rw-r--r--src/lpuart/buffered.rs23
-rw-r--r--src/lpuart/mod.rs19
-rw-r--r--src/ostimer.rs6
-rw-r--r--src/rtc.rs27
-rw-r--r--src/uart.rs12
15 files changed, 687 insertions, 46 deletions
diff --git a/.github/workflows/cargo-vet-pr-comment.yml b/.github/workflows/cargo-vet-pr-comment.yml
index 4dec76822..fafb21641 100644
--- a/.github/workflows/cargo-vet-pr-comment.yml
+++ b/.github/workflows/cargo-vet-pr-comment.yml
@@ -134,4 +134,4 @@ jobs:
134 134
135 comment-tag: [cargo-vet] 135 comment-tag: [cargo-vet]
136 --> 136 -->
137 edit-mode: replace \ No newline at end of file 137 edit-mode: replace
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index 5d4271145..8e05f5c5d 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -34,7 +34,7 @@ jobs:
34 strategy: 34 strategy:
35 fail-fast: false 35 fail-fast: false
36 matrix: 36 matrix:
37 workdir: [ ".", "examples/rt633", "examples/rt685s-evk",] 37 workdir: [ ".", "examples",]
38 38
39 steps: 39 steps:
40 - uses: actions/checkout@v5 40 - uses: actions/checkout@v5
@@ -45,6 +45,7 @@ jobs:
45 uses: dtolnay/rust-toolchain@nightly 45 uses: dtolnay/rust-toolchain@nightly
46 with: 46 with:
47 components: rustfmt 47 components: rustfmt
48 targets: thumbv8m.main-none-eabihf
48 49
49 - name: cargo fmt --check 50 - name: cargo fmt --check
50 run: cargo fmt --check 51 run: cargo fmt --check
@@ -75,6 +76,7 @@ jobs:
75 with: 76 with:
76 toolchain: ${{ matrix.toolchain }} 77 toolchain: ${{ matrix.toolchain }}
77 components: clippy 78 components: clippy
79 targets: thumbv8m.main-none-eabihf
78 80
79 - name: cargo clippy 81 - name: cargo clippy
80 working-directory: ${{ matrix.workdir }} 82 working-directory: ${{ matrix.workdir }}
@@ -110,6 +112,8 @@ jobs:
110 112
111 - name: Install nightly 113 - name: Install nightly
112 uses: dtolnay/rust-toolchain@nightly 114 uses: dtolnay/rust-toolchain@nightly
115 with:
116 targets: thumbv8m.main-none-eabihf
113 117
114 - name: cargo doc 118 - name: cargo doc
115 run: | 119 run: |
@@ -136,9 +140,10 @@ jobs:
136 with: 140 with:
137 toolchain: stable 141 toolchain: stable
138 components: clippy 142 components: clippy
143 targets: thumbv8m.main-none-eabihf
139 144
140 - name: rustup target add thumbv8m.main-none-eabihf 145 - name: cargo install cargo-hack
141 run: rustup target add thumbv8m.main-none-eabihf 146 uses: taiki-e/install-action@cargo-hack
142 147
143 - name: cargo hack 148 - name: cargo hack
144 run: cargo hack --feature-powerset check 149 run: cargo hack --feature-powerset check
@@ -156,6 +161,8 @@ jobs:
156 161
157 - name: Install stable 162 - name: Install stable
158 uses: dtolnay/rust-toolchain@stable 163 uses: dtolnay/rust-toolchain@stable
164 with:
165 targets: thumbv8m.main-none-eabihf
159 166
160 - name: cargo install cargo-deny 167 - name: cargo install cargo-deny
161 uses: EmbarkStudios/cargo-deny-action@v2 168 uses: EmbarkStudios/cargo-deny-action@v2
@@ -173,7 +180,7 @@ jobs:
173 strategy: 180 strategy:
174 fail-fast: false 181 fail-fast: false
175 matrix: 182 matrix:
176 msrv: ["1.90"] # We're relying on namespaced-features, which 183 msrv: ["1.91"] # We're relying on namespaced-features, which
177 # was released in 1.60 184 # was released in 1.60
178 # 185 #
179 # We also depend on `fixed' which requires rust 186 # We also depend on `fixed' which requires rust
@@ -188,6 +195,8 @@ jobs:
188 # embassy upstream switched to rust 1.85 195 # embassy upstream switched to rust 1.85
189 # 196 #
190 # unsigned_is_multiple_of requires 1.90, else we get clippy warnings 197 # unsigned_is_multiple_of requires 1.90, else we get clippy warnings
198 #
199 # [email protected] requires rustc 1.91
191 200
192 name: ubuntu / ${{ matrix.msrv }} 201 name: ubuntu / ${{ matrix.msrv }}
193 steps: 202 steps:
@@ -199,6 +208,7 @@ jobs:
199 uses: dtolnay/rust-toolchain@master 208 uses: dtolnay/rust-toolchain@master
200 with: 209 with:
201 toolchain: ${{ matrix.msrv }} 210 toolchain: ${{ matrix.msrv }}
211 targets: thumbv8m.main-none-eabihf
202 212
203 - name: cargo +${{ matrix.msrv }} check 213 - name: cargo +${{ matrix.msrv }} check
204 run: | 214 run: |
diff --git a/.github/workflows/nostd.yml b/.github/workflows/nostd.yml
index fbada0516..6083577da 100644
--- a/.github/workflows/nostd.yml
+++ b/.github/workflows/nostd.yml
@@ -20,10 +20,6 @@ jobs:
20 runs-on: ubuntu-latest 20 runs-on: ubuntu-latest
21 name: ${{ matrix.target }} 21 name: ${{ matrix.target }}
22 22
23 strategy:
24 matrix:
25 target: [thumbv8m.main-none-eabihf]
26
27 steps: 23 steps:
28 - uses: actions/checkout@v5 24 - uses: actions/checkout@v5
29 with: 25 with:
@@ -31,13 +27,12 @@ jobs:
31 27
32 - name: Install stable 28 - name: Install stable
33 uses: dtolnay/rust-toolchain@stable 29 uses: dtolnay/rust-toolchain@stable
34 30 with:
35 - name: rustup target add ${{ matrix.target }} 31 targets: thumbv8m.main-none-eabihf
36 run: rustup target add ${{ matrix.target }}
37 32
38 - name: Show variable 33 - name: Show variable
39 run: echo ${{ env.TOKEN }} 34 run: echo ${{ env.TOKEN }}
40 35
41 - name: cargo check 36 - name: cargo check
42 run: | 37 run: |
43 cargo check --target ${{ matrix.target }} --all-features --locked 38 cargo check --target thumbv8m.main-none-eabihf --all-features --locked
diff --git a/.github/workflows/rolling.yml b/.github/workflows/rolling.yml
index 4c9e9718a..386c0df5c 100644
--- a/.github/workflows/rolling.yml
+++ b/.github/workflows/rolling.yml
@@ -25,6 +25,9 @@ jobs:
25 submodules: true 25 submodules: true
26 - name: Install stable 26 - name: Install stable
27 uses: dtolnay/rust-toolchain@stable 27 uses: dtolnay/rust-toolchain@stable
28 with:
29 targets: thumbv8m.main-none-eabihf
30
28 - name: cargo install cargo-hack 31 - name: cargo install cargo-hack
29 uses: taiki-e/install-action@cargo-hack 32 uses: taiki-e/install-action@cargo-hack
30 - name: cargo check 33 - name: cargo check
@@ -62,6 +65,7 @@ jobs:
62 uses: dtolnay/rust-toolchain@master 65 uses: dtolnay/rust-toolchain@master
63 with: 66 with:
64 toolchain: ${{ matrix.msrv }} 67 toolchain: ${{ matrix.msrv }}
68 targets: thumbv8m.main-none-eabihf
65 - name: cargo +${{ matrix.msrv }} check 69 - name: cargo +${{ matrix.msrv }} check
66 run: | 70 run: |
67 cargo update 71 cargo update
diff --git a/.gitignore b/.gitignore
index a23881a76..d128a49cb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
1# Rust 1# Rust
2/target/ 2/target/
3Cargo.lock
4 3
5# IDE 4# IDE
6.vscode/ 5.vscode/
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644
index 000000000..953a71ee0
--- /dev/null
+++ b/Cargo.lock
@@ -0,0 +1,597 @@
1# This file is automatically @generated by Cargo.
2# It is not intended for manual editing.
3version = 4
4
5[[package]]
6name = "autocfg"
7version = "1.5.0"
8source = "registry+https://github.com/rust-lang/crates.io-index"
9checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
10
11[[package]]
12name = "bare-metal"
13version = "0.2.5"
14source = "registry+https://github.com/rust-lang/crates.io-index"
15checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3"
16dependencies = [
17 "rustc_version",
18]
19
20[[package]]
21name = "bitfield"
22version = "0.13.2"
23source = "registry+https://github.com/rust-lang/crates.io-index"
24checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719"
25
26[[package]]
27name = "bitflags"
28version = "1.3.2"
29source = "registry+https://github.com/rust-lang/crates.io-index"
30checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
31
32[[package]]
33name = "byteorder"
34version = "1.5.0"
35source = "registry+https://github.com/rust-lang/crates.io-index"
36checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
37
38[[package]]
39name = "cfg-if"
40version = "1.0.4"
41source = "registry+https://github.com/rust-lang/crates.io-index"
42checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
43
44[[package]]
45name = "cortex-m"
46version = "0.7.7"
47source = "registry+https://github.com/rust-lang/crates.io-index"
48checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9"
49dependencies = [
50 "bare-metal",
51 "bitfield",
52 "critical-section",
53 "embedded-hal 0.2.7",
54 "volatile-register",
55]
56
57[[package]]
58name = "cortex-m-rt"
59version = "0.7.5"
60source = "registry+https://github.com/rust-lang/crates.io-index"
61checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6"
62dependencies = [
63 "cortex-m-rt-macros",
64]
65
66[[package]]
67name = "cortex-m-rt-macros"
68version = "0.7.5"
69source = "registry+https://github.com/rust-lang/crates.io-index"
70checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472"
71dependencies = [
72 "proc-macro2",
73 "quote",
74 "syn",
75]
76
77[[package]]
78name = "critical-section"
79version = "1.2.0"
80source = "registry+https://github.com/rust-lang/crates.io-index"
81checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
82
83[[package]]
84name = "darling"
85version = "0.20.11"
86source = "registry+https://github.com/rust-lang/crates.io-index"
87checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee"
88dependencies = [
89 "darling_core",
90 "darling_macro",
91]
92
93[[package]]
94name = "darling_core"
95version = "0.20.11"
96source = "registry+https://github.com/rust-lang/crates.io-index"
97checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e"
98dependencies = [
99 "fnv",
100 "ident_case",
101 "proc-macro2",
102 "quote",
103 "strsim",
104 "syn",
105]
106
107[[package]]
108name = "darling_macro"
109version = "0.20.11"
110source = "registry+https://github.com/rust-lang/crates.io-index"
111checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
112dependencies = [
113 "darling_core",
114 "quote",
115 "syn",
116]
117
118[[package]]
119name = "defmt"
120version = "1.0.1"
121source = "registry+https://github.com/rust-lang/crates.io-index"
122checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78"
123dependencies = [
124 "bitflags",
125 "defmt-macros",
126]
127
128[[package]]
129name = "defmt-macros"
130version = "1.0.1"
131source = "registry+https://github.com/rust-lang/crates.io-index"
132checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e"
133dependencies = [
134 "defmt-parser",
135 "proc-macro-error2",
136 "proc-macro2",
137 "quote",
138 "syn",
139]
140
141[[package]]
142name = "defmt-parser"
143version = "1.0.0"
144source = "registry+https://github.com/rust-lang/crates.io-index"
145checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e"
146dependencies = [
147 "thiserror",
148]
149
150[[package]]
151name = "defmt-rtt"
152version = "1.1.0"
153source = "registry+https://github.com/rust-lang/crates.io-index"
154checksum = "93d5a25c99d89c40f5676bec8cefe0614f17f0f40e916f98e345dae941807f9e"
155dependencies = [
156 "critical-section",
157 "defmt",
158]
159
160[[package]]
161name = "document-features"
162version = "0.2.12"
163source = "registry+https://github.com/rust-lang/crates.io-index"
164checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61"
165dependencies = [
166 "litrs",
167]
168
169[[package]]
170name = "embassy-embedded-hal"
171version = "0.5.0"
172source = "registry+https://github.com/rust-lang/crates.io-index"
173checksum = "554e3e840696f54b4c9afcf28a0f24da431c927f4151040020416e7393d6d0d8"
174dependencies = [
175 "embassy-futures",
176 "embassy-hal-internal",
177 "embassy-sync",
178 "embedded-hal 0.2.7",
179 "embedded-hal 1.0.0",
180 "embedded-hal-async",
181 "embedded-storage",
182 "embedded-storage-async",
183 "nb 1.1.0",
184]
185
186[[package]]
187name = "embassy-executor"
188version = "0.9.1"
189source = "registry+https://github.com/rust-lang/crates.io-index"
190checksum = "06070468370195e0e86f241c8e5004356d696590a678d47d6676795b2e439c6b"
191dependencies = [
192 "cortex-m",
193 "critical-section",
194 "document-features",
195 "embassy-executor-macros",
196 "embassy-executor-timer-queue",
197]
198
199[[package]]
200name = "embassy-executor-macros"
201version = "0.7.0"
202source = "registry+https://github.com/rust-lang/crates.io-index"
203checksum = "dfdddc3a04226828316bf31393b6903ee162238576b1584ee2669af215d55472"
204dependencies = [
205 "darling",
206 "proc-macro2",
207 "quote",
208 "syn",
209]
210
211[[package]]
212name = "embassy-executor-timer-queue"
213version = "0.1.0"
214source = "registry+https://github.com/rust-lang/crates.io-index"
215checksum = "2fc328bf943af66b80b98755db9106bf7e7471b0cf47dc8559cd9a6be504cc9c"
216
217[[package]]
218name = "embassy-futures"
219version = "0.1.2"
220source = "registry+https://github.com/rust-lang/crates.io-index"
221checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01"
222
223[[package]]
224name = "embassy-hal-internal"
225version = "0.3.0"
226source = "registry+https://github.com/rust-lang/crates.io-index"
227checksum = "95285007a91b619dc9f26ea8f55452aa6c60f7115a4edc05085cd2bd3127cd7a"
228dependencies = [
229 "cortex-m",
230 "critical-section",
231 "num-traits",
232]
233
234[[package]]
235name = "embassy-mcxa276"
236version = "0.1.0"
237dependencies = [
238 "cortex-m",
239 "cortex-m-rt",
240 "critical-section",
241 "defmt",
242 "defmt-rtt",
243 "embassy-embedded-hal",
244 "embassy-executor",
245 "embassy-hal-internal",
246 "embassy-sync",
247 "embassy-time",
248 "embassy-time-driver",
249 "embedded-hal 0.2.7",
250 "embedded-hal 1.0.0",
251 "embedded-hal-async",
252 "embedded-hal-nb",
253 "embedded-io",
254 "embedded-io-async",
255 "heapless",
256 "mcxa-pac",
257 "nb 1.1.0",
258 "panic-probe",
259 "paste",
260]
261
262[[package]]
263name = "embassy-sync"
264version = "0.7.2"
265source = "registry+https://github.com/rust-lang/crates.io-index"
266checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b"
267dependencies = [
268 "cfg-if",
269 "critical-section",
270 "embedded-io-async",
271 "futures-core",
272 "futures-sink",
273 "heapless",
274]
275
276[[package]]
277name = "embassy-time"
278version = "0.5.0"
279source = "registry+https://github.com/rust-lang/crates.io-index"
280checksum = "f4fa65b9284d974dad7a23bb72835c4ec85c0b540d86af7fc4098c88cff51d65"
281dependencies = [
282 "cfg-if",
283 "critical-section",
284 "document-features",
285 "embassy-time-driver",
286 "embedded-hal 0.2.7",
287 "embedded-hal 1.0.0",
288 "embedded-hal-async",
289 "futures-core",
290]
291
292[[package]]
293name = "embassy-time-driver"
294version = "0.2.1"
295source = "registry+https://github.com/rust-lang/crates.io-index"
296checksum = "a0a244c7dc22c8d0289379c8d8830cae06bb93d8f990194d0de5efb3b5ae7ba6"
297dependencies = [
298 "document-features",
299]
300
301[[package]]
302name = "embedded-hal"
303version = "0.2.7"
304source = "registry+https://github.com/rust-lang/crates.io-index"
305checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff"
306dependencies = [
307 "nb 0.1.3",
308 "void",
309]
310
311[[package]]
312name = "embedded-hal"
313version = "1.0.0"
314source = "registry+https://github.com/rust-lang/crates.io-index"
315checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89"
316
317[[package]]
318name = "embedded-hal-async"
319version = "1.0.0"
320source = "registry+https://github.com/rust-lang/crates.io-index"
321checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884"
322dependencies = [
323 "embedded-hal 1.0.0",
324]
325
326[[package]]
327name = "embedded-hal-nb"
328version = "1.0.0"
329source = "registry+https://github.com/rust-lang/crates.io-index"
330checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605"
331dependencies = [
332 "embedded-hal 1.0.0",
333 "nb 1.1.0",
334]
335
336[[package]]
337name = "embedded-io"
338version = "0.6.1"
339source = "registry+https://github.com/rust-lang/crates.io-index"
340checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d"
341
342[[package]]
343name = "embedded-io-async"
344version = "0.6.1"
345source = "registry+https://github.com/rust-lang/crates.io-index"
346checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f"
347dependencies = [
348 "embedded-io",
349]
350
351[[package]]
352name = "embedded-storage"
353version = "0.3.1"
354source = "registry+https://github.com/rust-lang/crates.io-index"
355checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032"
356
357[[package]]
358name = "embedded-storage-async"
359version = "0.4.1"
360source = "registry+https://github.com/rust-lang/crates.io-index"
361checksum = "1763775e2323b7d5f0aa6090657f5e21cfa02ede71f5dc40eead06d64dcd15cc"
362dependencies = [
363 "embedded-storage",
364]
365
366[[package]]
367name = "fnv"
368version = "1.0.7"
369source = "registry+https://github.com/rust-lang/crates.io-index"
370checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
371
372[[package]]
373name = "futures-core"
374version = "0.3.31"
375source = "registry+https://github.com/rust-lang/crates.io-index"
376checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
377
378[[package]]
379name = "futures-sink"
380version = "0.3.31"
381source = "registry+https://github.com/rust-lang/crates.io-index"
382checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
383
384[[package]]
385name = "hash32"
386version = "0.3.1"
387source = "registry+https://github.com/rust-lang/crates.io-index"
388checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"
389dependencies = [
390 "byteorder",
391]
392
393[[package]]
394name = "heapless"
395version = "0.8.0"
396source = "registry+https://github.com/rust-lang/crates.io-index"
397checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
398dependencies = [
399 "hash32",
400 "stable_deref_trait",
401]
402
403[[package]]
404name = "ident_case"
405version = "1.0.1"
406source = "registry+https://github.com/rust-lang/crates.io-index"
407checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
408
409[[package]]
410name = "litrs"
411version = "1.0.0"
412source = "registry+https://github.com/rust-lang/crates.io-index"
413checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092"
414
415[[package]]
416name = "mcxa-pac"
417version = "0.1.0"
418source = "git+https://github.com/OpenDevicePartnership/mcxa-pac?rev=3ab4c868f75a9240bb8fdce24982d34f2273aabf#3ab4c868f75a9240bb8fdce24982d34f2273aabf"
419dependencies = [
420 "cortex-m",
421 "cortex-m-rt",
422 "vcell",
423]
424
425[[package]]
426name = "nb"
427version = "0.1.3"
428source = "registry+https://github.com/rust-lang/crates.io-index"
429checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f"
430dependencies = [
431 "nb 1.1.0",
432]
433
434[[package]]
435name = "nb"
436version = "1.1.0"
437source = "registry+https://github.com/rust-lang/crates.io-index"
438checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d"
439
440[[package]]
441name = "num-traits"
442version = "0.2.19"
443source = "registry+https://github.com/rust-lang/crates.io-index"
444checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
445dependencies = [
446 "autocfg",
447]
448
449[[package]]
450name = "panic-probe"
451version = "1.0.0"
452source = "registry+https://github.com/rust-lang/crates.io-index"
453checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a"
454dependencies = [
455 "cortex-m",
456 "defmt",
457]
458
459[[package]]
460name = "paste"
461version = "1.0.15"
462source = "registry+https://github.com/rust-lang/crates.io-index"
463checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
464
465[[package]]
466name = "proc-macro-error-attr2"
467version = "2.0.0"
468source = "registry+https://github.com/rust-lang/crates.io-index"
469checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5"
470dependencies = [
471 "proc-macro2",
472 "quote",
473]
474
475[[package]]
476name = "proc-macro-error2"
477version = "2.0.1"
478source = "registry+https://github.com/rust-lang/crates.io-index"
479checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802"
480dependencies = [
481 "proc-macro-error-attr2",
482 "proc-macro2",
483 "quote",
484 "syn",
485]
486
487[[package]]
488name = "proc-macro2"
489version = "1.0.103"
490source = "registry+https://github.com/rust-lang/crates.io-index"
491checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
492dependencies = [
493 "unicode-ident",
494]
495
496[[package]]
497name = "quote"
498version = "1.0.42"
499source = "registry+https://github.com/rust-lang/crates.io-index"
500checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
501dependencies = [
502 "proc-macro2",
503]
504
505[[package]]
506name = "rustc_version"
507version = "0.2.3"
508source = "registry+https://github.com/rust-lang/crates.io-index"
509checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
510dependencies = [
511 "semver",
512]
513
514[[package]]
515name = "semver"
516version = "0.9.0"
517source = "registry+https://github.com/rust-lang/crates.io-index"
518checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
519dependencies = [
520 "semver-parser",
521]
522
523[[package]]
524name = "semver-parser"
525version = "0.7.0"
526source = "registry+https://github.com/rust-lang/crates.io-index"
527checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
528
529[[package]]
530name = "stable_deref_trait"
531version = "1.2.1"
532source = "registry+https://github.com/rust-lang/crates.io-index"
533checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
534
535[[package]]
536name = "strsim"
537version = "0.11.1"
538source = "registry+https://github.com/rust-lang/crates.io-index"
539checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
540
541[[package]]
542name = "syn"
543version = "2.0.109"
544source = "registry+https://github.com/rust-lang/crates.io-index"
545checksum = "2f17c7e013e88258aa9543dcbe81aca68a667a9ac37cd69c9fbc07858bfe0e2f"
546dependencies = [
547 "proc-macro2",
548 "quote",
549 "unicode-ident",
550]
551
552[[package]]
553name = "thiserror"
554version = "2.0.17"
555source = "registry+https://github.com/rust-lang/crates.io-index"
556checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
557dependencies = [
558 "thiserror-impl",
559]
560
561[[package]]
562name = "thiserror-impl"
563version = "2.0.17"
564source = "registry+https://github.com/rust-lang/crates.io-index"
565checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
566dependencies = [
567 "proc-macro2",
568 "quote",
569 "syn",
570]
571
572[[package]]
573name = "unicode-ident"
574version = "1.0.22"
575source = "registry+https://github.com/rust-lang/crates.io-index"
576checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
577
578[[package]]
579name = "vcell"
580version = "0.1.3"
581source = "registry+https://github.com/rust-lang/crates.io-index"
582checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002"
583
584[[package]]
585name = "void"
586version = "1.0.2"
587source = "registry+https://github.com/rust-lang/crates.io-index"
588checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
589
590[[package]]
591name = "volatile-register"
592version = "0.2.2"
593source = "registry+https://github.com/rust-lang/crates.io-index"
594checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc"
595dependencies = [
596 "vcell",
597]
diff --git a/Cargo.toml b/Cargo.toml
index 34eba8d23..19d1c7174 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,7 +23,7 @@ embassy-time = "0.5.0"
23embassy-time-driver = "0.2.1" 23embassy-time-driver = "0.2.1"
24embedded-io = "0.6" 24embedded-io = "0.6"
25heapless = "0.8" 25heapless = "0.8"
26mcxa-pac = { git = "https://github.com/OpenDevicePartnership/mcxa-pac", features = ["rt"], rev = "f25b7aed0b8ad8e610012046e09340926cbd51a2", version = "0.1.0" } 26mcxa-pac = { git = "https://github.com/OpenDevicePartnership/mcxa-pac", features = ["rt"], rev = "3ab4c868f75a9240bb8fdce24982d34f2273aabf", version = "0.1.0" }
27paste = "1.0.15" 27paste = "1.0.15"
28 28
29embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = [ 29embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = [
diff --git a/src/adc.rs b/src/adc.rs
index d456971f7..655bf934f 100644
--- a/src/adc.rs
+++ b/src/adc.rs
@@ -228,7 +228,7 @@ impl<I: Instance> Adc<I> {
228 let step = 1.0 / (1u32 << shift) as f32; 228 let step = 1.0 / (1u32 << shift) as f32;
229 let tmp = (gain_adjustment / step) as u32; 229 let tmp = (gain_adjustment / step) as u32;
230 gcra_array[i - 1] = tmp; 230 gcra_array[i - 1] = tmp;
231 gain_adjustment = gain_adjustment - tmp as f32 * step; 231 gain_adjustment -= tmp as f32 * step;
232 } 232 }
233 233
234 for i in (1..=17).rev() { 234 for i in (1..=17).rev() {
@@ -244,7 +244,7 @@ impl<I: Instance> Adc<I> {
244 while adc.gcc0().read().rdy().is_gain_cal_not_valid() {} 244 while adc.gcc0().read().rdy().is_gain_cal_not_valid() {}
245 245
246 let mut gcca = adc.gcc0().read().gain_cal().bits() as u32; 246 let mut gcca = adc.gcc0().read().gain_cal().bits() as u32;
247 if gcca & (((0xFFFF >> 0) + 1) >> 1) != 0 { 247 if gcca & ((0xFFFF + 1) >> 1) != 0 {
248 gcca |= !0xFFFF; 248 gcca |= !0xFFFF;
249 } 249 }
250 250
diff --git a/src/interrupt.rs b/src/interrupt.rs
index 09d7acbef..134ff03fd 100644
--- a/src/interrupt.rs
+++ b/src/interrupt.rs
@@ -2,6 +2,10 @@
2//! Type-level interrupt traits and bindings are provided by the 2//! Type-level interrupt traits and bindings are provided by the
3//! `embassy_hal_internal::interrupt_mod!` macro via the generated module below. 3//! `embassy_hal_internal::interrupt_mod!` macro via the generated module below.
4 4
5// TODO(AJM): As of 2025-11-13, we need to do a pass to ensure safety docs
6// are complete prior to release.
7#![allow(clippy::missing_safety_doc)]
8
5mod generated { 9mod generated {
6 embassy_hal_internal::interrupt_mod!(OS_EVENT, LPUART2, RTC, ADC1); 10 embassy_hal_internal::interrupt_mod!(OS_EVENT, LPUART2, RTC, ADC1);
7} 11}
diff --git a/src/lib.rs b/src/lib.rs
index fe27aadba..9899564d8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,7 @@
1#![no_std] 1#![no_std]
2// TODO(AJM): As of 2025-11-13, we need to do a pass to ensure safety docs
3// are complete prior to release.
4#![allow(clippy::missing_safety_doc)]
2 5
3pub mod clocks; // still provide clock helpers 6pub mod clocks; // still provide clock helpers
4pub mod gpio; 7pub mod gpio;
diff --git a/src/lpuart/buffered.rs b/src/lpuart/buffered.rs
index 0413fed8e..a617c10a5 100644
--- a/src/lpuart/buffered.rs
+++ b/src/lpuart/buffered.rs
@@ -24,6 +24,12 @@ pub struct State {
24 initialized: AtomicBool, 24 initialized: AtomicBool,
25} 25}
26 26
27impl Default for State {
28 fn default() -> Self {
29 Self::new()
30 }
31}
32
27impl State { 33impl State {
28 /// Create a new state instance 34 /// Create a new state instance
29 pub const fn new() -> Self { 35 pub const fn new() -> Self {
@@ -104,6 +110,7 @@ impl<'a> BufferedLpuart<'a> {
104 } 110 }
105 111
106 /// Create a new buffered LPUART with flexible pin configuration 112 /// Create a new buffered LPUART with flexible pin configuration
113 #[allow(clippy::too_many_arguments)]
107 pub fn new_with_pins<T: Instance>( 114 pub fn new_with_pins<T: Instance>(
108 _inner: Peri<'a, T>, 115 _inner: Peri<'a, T>,
109 tx_pin: Option<Peri<'a, impl TxPin<T>>>, 116 tx_pin: Option<Peri<'a, impl TxPin<T>>>,
@@ -612,16 +619,14 @@ impl<T: Instance> crate::interrupt::typelevel::Handler<T::Interrupt> for Buffere
612 } 619 }
613 620
614 // Handle transmission complete 621 // Handle transmission complete
615 if ctrl.tcie().is_enabled() { 622 if ctrl.tcie().is_enabled() && regs.stat().read().tc().is_complete() {
616 if regs.stat().read().tc().is_complete() { 623 state.tx_done.store(true, Ordering::Release);
617 state.tx_done.store(true, Ordering::Release); 624 state.tx_waker.wake();
618 state.tx_waker.wake();
619 625
620 // Disable TC interrupt 626 // Disable TC interrupt
621 cortex_m::interrupt::free(|_| { 627 cortex_m::interrupt::free(|_| {
622 regs.ctrl().modify(|_, w| w.tcie().disabled()); 628 regs.ctrl().modify(|_, w| w.tcie().disabled());
623 }); 629 });
624 }
625 } 630 }
626 } 631 }
627} 632}
diff --git a/src/lpuart/mod.rs b/src/lpuart/mod.rs
index bed10bdb0..35b531421 100644
--- a/src/lpuart/mod.rs
+++ b/src/lpuart/mod.rs
@@ -105,8 +105,9 @@ mod gpio {
105 105
106 impl GpioPin for super::lib::peripherals::$pin {} 106 impl GpioPin for super::lib::peripherals::$pin {}
107 107
108 impl Into<AnyPin> for super::lib::peripherals::$pin { 108 impl From<super::lib::peripherals::$pin> for AnyPin {
109 fn into(self) -> AnyPin { 109 // TODO: AJM: any reason we aren't using $pin?
110 fn from(_val: super::lib::peripherals::$pin) -> Self {
110 AnyPin 111 AnyPin
111 } 112 }
112 } 113 }
@@ -242,7 +243,7 @@ pub fn configure_baudrate(regs: Regs, baudrate_bps: u32, clock: Clock) -> Result
242 // Configure BAUD register 243 // Configure BAUD register
243 regs.baud().modify(|_, w| unsafe { 244 regs.baud().modify(|_, w| unsafe {
244 // Clear and set OSR 245 // Clear and set OSR
245 w.osr().bits((osr - 1) as u8); 246 w.osr().bits(osr - 1);
246 // Clear and set SBR 247 // Clear and set SBR
247 w.sbr().bits(sbr); 248 w.sbr().bits(sbr);
248 // Set BOTHEDGE if OSR is between 4 and 7 249 // Set BOTHEDGE if OSR is between 4 and 7
@@ -305,9 +306,9 @@ pub fn configure_fifo(regs: Regs, config: &Config) {
305 // Configure WATER register for FIFO watermarks 306 // Configure WATER register for FIFO watermarks
306 regs.water().write(|w| unsafe { 307 regs.water().write(|w| unsafe {
307 w.rxwater() 308 w.rxwater()
308 .bits(config.rx_fifo_watermark as u8) 309 .bits(config.rx_fifo_watermark)
309 .txwater() 310 .txwater()
310 .bits(config.tx_fifo_watermark as u8) 311 .bits(config.tx_fifo_watermark)
311 }); 312 });
312 313
313 // Enable TX/RX FIFOs 314 // Enable TX/RX FIFOs
@@ -377,7 +378,7 @@ pub fn calculate_baudrate(baudrate: u32, src_clock_hz: u32) -> Result<(u8, u16)>
377 // Try OSR values from 4 to 32 378 // Try OSR values from 4 to 32
378 for osr_temp in 4u8..=32u8 { 379 for osr_temp in 4u8..=32u8 {
379 // Calculate SBR: (srcClock_Hz * 2 / (baudRate * osr) + 1) / 2 380 // Calculate SBR: (srcClock_Hz * 2 / (baudRate * osr) + 1) / 2
380 let sbr_calc = ((src_clock_hz * 2) / (baudrate * osr_temp as u32) + 1) / 2; 381 let sbr_calc = ((src_clock_hz * 2) / (baudrate * osr_temp as u32)).div_ceil(2);
381 382
382 let sbr_temp = if sbr_calc == 0 { 383 let sbr_temp = if sbr_calc == 0 {
383 1 384 1
@@ -390,11 +391,7 @@ pub fn calculate_baudrate(baudrate: u32, src_clock_hz: u32) -> Result<(u8, u16)>
390 // Calculate actual baud rate 391 // Calculate actual baud rate
391 let calculated_baud = src_clock_hz / (osr_temp as u32 * sbr_temp as u32); 392 let calculated_baud = src_clock_hz / (osr_temp as u32 * sbr_temp as u32);
392 393
393 let temp_diff = if calculated_baud > baudrate { 394 let temp_diff = calculated_baud.abs_diff(baudrate);
394 calculated_baud - baudrate
395 } else {
396 baudrate - calculated_baud
397 };
398 395
399 if temp_diff <= baud_diff { 396 if temp_diff <= baud_diff {
400 baud_diff = temp_diff; 397 baud_diff = temp_diff;
diff --git a/src/ostimer.rs b/src/ostimer.rs
index a4cab6970..8bc68389a 100644
--- a/src/ostimer.rs
+++ b/src/ostimer.rs
@@ -151,6 +151,12 @@ pub struct Alarm<'d> {
151 _phantom: core::marker::PhantomData<&'d mut ()>, 151 _phantom: core::marker::PhantomData<&'d mut ()>,
152} 152}
153 153
154impl<'d> Default for Alarm<'d> {
155 fn default() -> Self {
156 Self::new()
157 }
158}
159
154impl<'d> Alarm<'d> { 160impl<'d> Alarm<'d> {
155 /// Create a new alarm instance 161 /// Create a new alarm instance
156 pub fn new() -> Self { 162 pub fn new() -> Self {
diff --git a/src/rtc.rs b/src/rtc.rs
index d62da1f0a..facb9cf8c 100644
--- a/src/rtc.rs
+++ b/src/rtc.rs
@@ -102,25 +102,36 @@ pub fn convert_seconds_to_datetime(seconds: u32) -> RtcDateTime {
102 days -= days_in_year; 102 days -= days_in_year;
103 year += 1; 103 year += 1;
104 104
105 days_in_year = if year % 4 == 0 { 105 days_in_year = if year.is_multiple_of(4) {
106 DAYS_IN_A_YEAR + 1 106 DAYS_IN_A_YEAR + 1
107 } else { 107 } else {
108 DAYS_IN_A_YEAR 108 DAYS_IN_A_YEAR
109 }; 109 };
110 } 110 }
111 111
112 let mut days_per_month = [0u8, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; 112 let days_per_month = [
113 if year % 4 == 0 { 113 31,
114 days_per_month[2] = 29; 114 if year.is_multiple_of(4) { 29 } else { 28 },
115 } 115 31,
116 30,
117 31,
118 30,
119 31,
120 31,
121 30,
122 31,
123 30,
124 31,
125 ];
116 126
117 let mut month = 1; 127 let mut month = 1;
118 for m in 1..=12 { 128 for (m, month_days) in days_per_month.iter().enumerate() {
119 if days <= days_per_month[m] as u32 { 129 let m = m + 1;
130 if days <= *month_days as u32 {
120 month = m; 131 month = m;
121 break; 132 break;
122 } else { 133 } else {
123 days -= days_per_month[m] as u32; 134 days -= *month_days as u32;
124 } 135 }
125 } 136 }
126 137
diff --git a/src/uart.rs b/src/uart.rs
index 3209a318d..3705959d3 100644
--- a/src/uart.rs
+++ b/src/uart.rs
@@ -1,6 +1,10 @@
1//! Minimal polling UART2 bring-up replicating MCUXpresso hello_world ordering. 1//! Minimal polling UART2 bring-up replicating MCUXpresso hello_world ordering.
2//! WARNING: This is a narrow implementation only for debug console (115200 8N1). 2//! WARNING: This is a narrow implementation only for debug console (115200 8N1).
3 3
4// TODO(AJM): As of 2025-11-13, we need to do a pass to ensure safety docs
5// are complete prior to release.
6#![allow(clippy::missing_safety_doc)]
7
4use core::cell::RefCell; 8use core::cell::RefCell;
5 9
6use cortex_m::interrupt::Mutex; 10use cortex_m::interrupt::Mutex;
@@ -118,7 +122,7 @@ impl<I: Instance> Uart<I> {
118 StopBits::Two => w.sbns().two(), 122 StopBits::Two => w.sbns().two(),
119 }; 123 };
120 // OSR field encodes (osr-1); use raw bits to avoid a long match on all variants 124 // OSR field encodes (osr-1); use raw bits to avoid a long match on all variants
121 let raw_osr = osr.saturating_sub(1) as u8; 125 let raw_osr = osr.saturating_sub(1);
122 unsafe { w.osr().bits(raw_osr).sbr().bits(sbr) } 126 unsafe { w.osr().bits(raw_osr).sbr().bits(sbr) }
123 }); 127 });
124 // 3) CTRL baseline and parity 128 // 3) CTRL baseline and parity
@@ -195,6 +199,12 @@ pub struct RingBuffer {
195 count: usize, 199 count: usize,
196} 200}
197 201
202impl Default for RingBuffer {
203 fn default() -> Self {
204 Self::new()
205 }
206}
207
198impl RingBuffer { 208impl RingBuffer {
199 pub const fn new() -> Self { 209 pub const fn new() -> Self {
200 Self { 210 Self {