Skip to content

Commit

Permalink
Merge pull request #28 from embassy-rs/et04
Browse files Browse the repository at this point in the history
Update to embassy-time v0.4
  • Loading branch information
Dirbaio authored Jan 2, 2025
2 parents 815cb98 + 84ab0a9 commit b4c0d0c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 26 deletions.
16 changes: 4 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ log = { version = "0.4", optional = true }
embedded-io = "0.6.0"
embedded-io-async = "0.6.0"
embassy-sync = "0.6"
embassy-time = { version = "0.3", optional = true }
embassy-time = { version = "0.4", optional = true }
heapless = "0.8"
futures-intrusive = { version = "0.5.0", default-features = false }
uuid = { version = "1.11.0", default-features = false, optional = true }
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Before upgrading check that everything is available on all tier1 targets here:
# https://rust-lang.github.io/rustup-components-history
[toolchain]
channel = "1.77"
channel = "1.83"
components = [ "rust-src", "rustfmt", "llvm-tools-preview" ]
targets = [
"thumbv7em-none-eabi",
Expand Down
36 changes: 24 additions & 12 deletions src/fmt.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#![macro_use]
#![allow(unused_macros)]
#![allow(unused)]

use core::fmt::{Debug, Display, LowerHex};

#[cfg(all(feature = "defmt", feature = "log"))]
compile_error!("You may not enable both `defmt` and `log` features.");

#[collapse_debuginfo(yes)]
macro_rules! assert {
($($x:tt)*) => {
{
Expand All @@ -17,6 +18,7 @@ macro_rules! assert {
};
}

#[collapse_debuginfo(yes)]
macro_rules! assert_eq {
($($x:tt)*) => {
{
Expand All @@ -28,6 +30,7 @@ macro_rules! assert_eq {
};
}

#[collapse_debuginfo(yes)]
macro_rules! assert_ne {
($($x:tt)*) => {
{
Expand All @@ -39,6 +42,7 @@ macro_rules! assert_ne {
};
}

#[collapse_debuginfo(yes)]
macro_rules! debug_assert {
($($x:tt)*) => {
{
Expand All @@ -50,6 +54,7 @@ macro_rules! debug_assert {
};
}

#[collapse_debuginfo(yes)]
macro_rules! debug_assert_eq {
($($x:tt)*) => {
{
Expand All @@ -61,6 +66,7 @@ macro_rules! debug_assert_eq {
};
}

#[collapse_debuginfo(yes)]
macro_rules! debug_assert_ne {
($($x:tt)*) => {
{
Expand All @@ -72,6 +78,7 @@ macro_rules! debug_assert_ne {
};
}

#[collapse_debuginfo(yes)]
macro_rules! todo {
($($x:tt)*) => {
{
Expand All @@ -83,20 +90,19 @@ macro_rules! todo {
};
}

#[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}

#[cfg(feature = "defmt")]
macro_rules! unreachable {
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
{
#[cfg(not(feature = "defmt"))]
::core::unreachable!($($x)*);
#[cfg(feature = "defmt")]
::defmt::unreachable!($($x)*);
}
};
}

#[collapse_debuginfo(yes)]
macro_rules! panic {
($($x:tt)*) => {
{
Expand All @@ -108,6 +114,7 @@ macro_rules! panic {
};
}

#[collapse_debuginfo(yes)]
macro_rules! trace {
($s:literal $(, $x:expr)* $(,)?) => {
{
Expand All @@ -121,6 +128,7 @@ macro_rules! trace {
};
}

#[collapse_debuginfo(yes)]
macro_rules! debug {
($s:literal $(, $x:expr)* $(,)?) => {
{
Expand All @@ -134,6 +142,7 @@ macro_rules! debug {
};
}

#[collapse_debuginfo(yes)]
macro_rules! info {
($s:literal $(, $x:expr)* $(,)?) => {
{
Expand All @@ -147,6 +156,7 @@ macro_rules! info {
};
}

#[collapse_debuginfo(yes)]
macro_rules! warn {
($s:literal $(, $x:expr)* $(,)?) => {
{
Expand All @@ -160,6 +170,7 @@ macro_rules! warn {
};
}

#[collapse_debuginfo(yes)]
macro_rules! error {
($s:literal $(, $x:expr)* $(,)?) => {
{
Expand All @@ -174,13 +185,15 @@ macro_rules! error {
}

#[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)]
macro_rules! unwrap {
($($x:tt)*) => {
::defmt::unwrap!($($x)*)
};
}

#[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)]
macro_rules! unwrap {
($arg:expr) => {
match $crate::fmt::Try::into_result($arg) {
Expand Down Expand Up @@ -229,7 +242,6 @@ impl<T, E> Try for Result<T, E> {
}
}

#[allow(unused)]
pub(crate) struct Bytes<'a>(pub &'a [u8]);

impl Debug for Bytes<'_> {
Expand All @@ -251,7 +263,7 @@ impl LowerHex for Bytes<'_> {
}

#[cfg(feature = "defmt")]
impl<'a> defmt::Format for Bytes<'a> {
impl defmt::Format for Bytes<'_> {
fn format(&self, fmt: defmt::Formatter) {
defmt::write!(fmt, "{:02x}", self.0)
}
Expand Down

0 comments on commit b4c0d0c

Please sign in to comment.