mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-26 08:42:32 +00:00
Add feature defmt-timestamp-uptime
Enabling it adds a timestamp of the number of seconds since startup next to defmt log messages using `Instant::now`.
This commit is contained in:
parent
f2eb438905
commit
4c5f5f7169
@ -17,6 +17,10 @@ nightly = ["embedded-hal-async"]
|
||||
# Implement embedded-hal-async traits if `nightly` is set as well.
|
||||
unstable-traits = ["embedded-hal-1"]
|
||||
|
||||
# Display a timestamp of the number of seconds since startup next to defmt log messages
|
||||
# To use this you must have a time driver provided.
|
||||
defmt-timestamp-uptime = ["defmt"]
|
||||
|
||||
# Enable `embassy::time` module.
|
||||
# NOTE: This feature is only intended to be enabled by crates providing the time driver implementation.
|
||||
# Enabling it directly without supplying a time driver will fail to link.
|
||||
|
@ -195,6 +195,10 @@ macro_rules! unwrap {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "defmt-timestamp-uptime")]
|
||||
// defmt offers a disply hint for microseconds so we convert from millis
|
||||
defmt::timestamp! {"{=u64:us}", crate::time::Instant::now().as_millis() * 1_000 }
|
||||
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||
pub struct NoneError;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user