Skip to content

Commit 7163f0b

Browse files
committed
Upgrade dependencies in public API
Bump bitflags to 2.0. I try to maintain as much backwards compatibility as I can with 1.0, for convenience. Upgrade defmt to 1.0. This should remain compatible with the 0.3 series, given the way 1.0 is implemented. However, it could be nice to adopt newer features as they arrive. Upgrade imxrt-dma to 0.2. See the imxrt-dma CHANGELOG for more info. No breaking Rust API changes, but we take on different dependencies. Upgrade imxrt-usbd to 0.4. It's a dev dependency of imxrt-hal. However, it's a public dependency of the logging package. Update imxrt-rt to 0.1.8. The new release lets us pull in newer versions of cortex-m-rt. That new implicit dependency is better suited for Rust 2024 patterns, particularly `static mut`. Remove all patch directives from workspace. At this point, all first-party packages should be on crates.io. We don't need these right now. It'll be OK with me to bring them back later.
1 parent 039dfea commit 7163f0b

11 files changed

Lines changed: 37 additions & 22 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ and other class packages.
3434

3535
- `imxrt-ral` 0.6
3636
- `iomxrt-iomuxc` 0.3
37+
- `imxrt-dma` 0.2
38+
39+
Additionally, update third-party dependencies in the public API:
40+
41+
- `bitflags` 2.11
3742

3843
**BREAKING** Remove deprecated APIs
3944

Cargo.toml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ version = "0.7"
2222
version = "1.0"
2323

2424
[dependencies.bitflags]
25-
version = "1.3"
25+
version = "2.0"
2626

2727
[dependencies.nb]
2828
version = "1"
@@ -100,7 +100,7 @@ eh02-unproven = []
100100
members = ["board", "logging"]
101101

102102
[workspace.dependencies]
103-
imxrt-dma = "0.1"
103+
imxrt-dma = "0.2.0"
104104
imxrt-iomuxc = "0.3.0"
105105
imxrt-hal = { version = "0.6", path = "." }
106106
imxrt-log = { path = "logging", default-features = false, features = [
@@ -109,9 +109,9 @@ imxrt-log = { path = "logging", default-features = false, features = [
109109
"usbd",
110110
] }
111111
imxrt-ral = "0.6"
112-
imxrt-rt = "0.1.5"
113-
imxrt-usbd = "0.3"
114-
defmt = "0.3"
112+
imxrt-rt = "0.1.8"
113+
imxrt-usbd = "0.4"
114+
defmt = "1.0"
115115

116116
[workspace.package]
117117
repository = "https://github.com/imxrt-rs/imxrt-hal"
@@ -212,12 +212,3 @@ required-features = ["board/imxrt-log","board/sai","board/teensy4"]
212212
[[example]]
213213
name = "rtic_sai_sgtl5000"
214214
required-features = ["board/imxrt-log","board/sai","board/teensy4"]
215-
216-
[patch.crates-io.imxrt-ral]
217-
git = "https://github.com/imxrt-rs/imxrt-ral"
218-
219-
[patch.crates-io.imxrt-iomuxc]
220-
git = "https://github.com/imxrt-rs/imxrt-iomuxc"
221-
222-
[patch.crates-io.imxrt-usbd]
223-
git = "https://github.com/imxrt-rs/imxrt-usbd"

board/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = { workspace = true }
66
publish = false
77

88
[dependencies.defmt]
9-
version = "0.3"
9+
workspace = true
1010

1111
[dependencies.imxrt-hal]
1212
workspace = true
@@ -31,7 +31,7 @@ default-features = false
3131

3232
[dependencies.imxrt-usbd]
3333
workspace = true
34-
features = ["defmt-03"]
34+
features = ["defmt"]
3535

3636
[dependencies.cortex-m]
3737
version = "0.7"

logging/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
**BREAKING** Integrate breaking dependencies for the USB back-end:
66

77
- `imxrt-ral` 0.6
8-
- `imxrt-usbd` 0.3
8+
- `imxrt-usbd` 0.4
99
- `imxrt-hal` 0.6
1010
- `usb-device` 0.3
1111
- `usbd-serial` 0.2

logging/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ static_cell = "2.1.0"
1616

1717
[dependencies.defmt]
1818
optional = true
19-
version = "0.3"
19+
workspace = true
2020

2121
[dependencies.log]
2222
optional = true

src/chip/drivers/sai.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ bitflags::bitflags! {
132132
/// Interrupt settings.
133133
///
134134
/// A set bit indicates that the interrupt is enabled.
135+
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
135136
pub struct Interrupts : u32 {
136137
/// Word Start Interrupt Enable.
137138
const WORD_START = 1 << 12;
@@ -148,6 +149,7 @@ bitflags::bitflags! {
148149

149150
bitflags::bitflags! {
150151
/// Status flags.
152+
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
151153
pub struct Status : u32 {
152154
/// Word Start Flag.
153155
///

src/chip/drivers/trng.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ impl rand_core::RngCore for RngCoreWrapper {
333333
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand_core::Error> {
334334
// defer to Read implementation, converting error to rand_core's Error
335335
self.0.read(dest).map_err(|e| {
336-
let code = e.0.bits | rand_core::Error::CUSTOM_START;
336+
let code = e.0.bits() | rand_core::Error::CUSTOM_START;
337337
// Safety: Two highest bits always set.
338338
unsafe { core::num::NonZeroU32::new_unchecked(code).into() }
339339
})
@@ -347,7 +347,7 @@ pub struct Error(pub ErrorFlags);
347347

348348
bitflags::bitflags! {
349349
/// Specific errors that may occur during entropy generation
350-
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
350+
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
351351
pub struct ErrorFlags : u32 {
352352
// STATUS register starts here (automatically set from bits)
353353
/// 1-bit run sampling 0s test failed
@@ -388,6 +388,13 @@ bitflags::bitflags! {
388388
}
389389
}
390390

391+
#[cfg(feature = "defmt")]
392+
impl defmt::Format for ErrorFlags {
393+
fn format(&self, f: defmt::Formatter) {
394+
defmt::write!(f, "ErrorFlags({=u32:#x})", self.bits());
395+
}
396+
}
397+
391398
impl fmt::Display for Error {
392399
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
393400
write!(f, "An error occurred in the TRNG module")

src/common/flexpwm.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ bitflags::bitflags! {
8989
/// bits depends on the function.
9090
///
9191
/// If you have an [`SM`], use [`SM::mask()`] to easily obtain its bitmask.
92+
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
9293
pub struct Mask : u8 {
9394
/// Submodule 0.
9495
const SM0 = 1 << 0;
@@ -676,6 +677,7 @@ impl LoadMode {
676677

677678
bitflags::bitflags! {
678679
/// Status register flags.
680+
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
679681
pub struct Status : u16 {
680682
/// Registers updated flag.
681683
///
@@ -718,6 +720,7 @@ impl Status {
718720

719721
bitflags::bitflags! {
720722
/// Interrupt flags.
723+
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
721724
pub struct Interrupts : u16 {
722725
/// Reload error interrupt enable.
723726
const RELOAD_ERROR = 1 << 13;

src/common/lpi2c.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ impl Drop for Disabled<'_> {
397397

398398
bitflags::bitflags! {
399399
/// Status flags for the LPI2C controller.
400+
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
400401
pub struct ControllerStatus : u32 {
401402
/// Bus busy flag.
402403
///
@@ -488,6 +489,7 @@ bitflags::bitflags! {
488489
/// LPI2C interrupt settings.
489490
///
490491
/// A set bit indicates that an interrupt is enabled.
492+
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
491493
pub struct Interrupts : u32 {
492494
/// Data match interrupt enable.
493495
const DATA_MATCH = 1 << 14;

src/common/lpspi.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,7 @@ impl Lpspi {
10511051

10521052
bitflags::bitflags! {
10531053
/// Status flags for the LPSPI interface.
1054+
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
10541055
pub struct Status : u32 {
10551056
/// Module busy flag.
10561057
///
@@ -1160,6 +1161,7 @@ bitflags::bitflags! {
11601161
///
11611162
/// A high bit indicates that the condition generates an interrupt.
11621163
/// See the status bits for more information.
1164+
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
11631165
pub struct Interrupts : u32 {
11641166
/// Data match interrupt enable.
11651167
const DATA_MATCH = 1 << 13;

0 commit comments

Comments
 (0)