Merge pull request #53 from fnafnio/defmt-update

update defmt and defmt-rtt to 0.2.0
This commit is contained in:
Dario Nieuwenhuis 2021-02-26 00:30:00 +01:00 committed by GitHub
commit de796d3e80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 30 additions and 33 deletions

View File

@ -1,5 +1,5 @@
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "probe-run --chip nRF52840_xxAA --defmt"
runner = "probe-run --chip nRF52840_xxAA"
rustflags = [
# LLD (shipped with the Rust toolchain) is used as the default linker

View File

@ -20,8 +20,8 @@ defmt-error = []
embassy = { version = "0.1.0", path = "../embassy", features = ["defmt", "defmt-trace"] }
embassy-nrf = { version = "0.1.0", path = "../embassy-nrf", features = ["defmt", "defmt-trace", "52840"] }
defmt = "0.1.3"
defmt-rtt = "0.1.0"
defmt = "0.2.0"
defmt-rtt = "0.2.0"
cortex-m = "0.7.1"
cortex-m-rt = "0.6.13"

View File

@ -64,7 +64,7 @@ async fn run() {
info!("reading...");
let mut buf = [0u8; 8];
unwrap!(u.read_exact(&mut buf).await);
info!("read done, got {:[u8]}", buf);
info!("read done, got {}", buf);
// Reverse buf
for i in 0..4 {

View File

@ -90,7 +90,7 @@ async fn run_med() {
let end = Instant::now();
let ms = end.duration_since(start).as_ticks() / 33;
info!(" [med] done in {:u64} ms", ms);
info!(" [med] done in {} ms", ms);
Timer::after(Duration::from_ticks(23421)).await;
}
@ -107,7 +107,7 @@ async fn run_low() {
let end = Instant::now();
let ms = end.duration_since(start).as_ticks() / 33;
info!("[low] done in {:u64} ms", ms);
info!("[low] done in {} ms", ms);
Timer::after(Duration::from_ticks(32983)).await;
}

View File

@ -73,7 +73,7 @@ async fn run() {
let mut id = [1; 3];
q.custom_instruction(0x9F, &[], &mut id).await.unwrap();
info!("id: {:[u8]}", id);
info!("id: {}", id);
// Read status register
let mut status = [0; 1];

View File

@ -48,15 +48,12 @@ fn main() -> ! {
loop {
let val2 = rtc.now();
if val2 < val {
info!(
"timer ran backwards! {:u32} -> {:u32}",
val as u32, val2 as u32
);
info!("timer ran backwards! {} -> {}", val as u32, val2 as u32);
}
val = val2;
if val > printval + 32768 {
info!("tick {:u32}", val as u32);
info!("tick {}", val as u32);
printval = val;
}
}

View File

@ -76,7 +76,7 @@ async fn run(uart: pac::UARTE0, port: pac::P0) {
let received = &mut buf[..received_len];
if !received.is_empty() {
info!("read done, got {:[u8]}", received);
info!("read done, got {}", received);
// Echo back received data
unwrap!(uart.send(received).await);

View File

@ -8,11 +8,11 @@ pub use defmt::*;
use core::sync::atomic::{AtomicUsize, Ordering};
#[defmt::timestamp]
fn timestamp() -> u64 {
static COUNT: AtomicUsize = AtomicUsize::new(0);
// NOTE(no-CAS) `timestamps` runs with interrupts disabled
let n = COUNT.load(Ordering::Relaxed);
COUNT.store(n + 1, Ordering::Relaxed);
n as u64
defmt::timestamp! {"{=u64}", {
static COUNT: AtomicUsize = AtomicUsize::new(0);
// NOTE(no-CAS) `timestamps` runs with interrupts disabled
let n = COUNT.load(Ordering::Relaxed);
COUNT.store(n + 1, Ordering::Relaxed);
n as u64
}
}

View File

@ -21,7 +21,7 @@ defmt-error = [ ]
[dependencies]
embassy = { version = "0.1.0", path = "../embassy" }
defmt = { version = "0.1.3", optional = true }
defmt = { version = "0.2.0", optional = true }
log = { version = "0.4.11", optional = true }
cortex-m-rt = "0.6.13"
cortex-m = "0.7.1"

View File

@ -1,5 +1,5 @@
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "probe-run --chip STM32F401CCUx --defmt"
runner = "probe-run --chip STM32F401CCUx"
rustflags = [
# LLD (shipped with the Rust toolchain) is used as the default linker

View File

@ -20,8 +20,8 @@ defmt-error = []
embassy = { version = "0.1.0", path = "../embassy", features = ["defmt", "defmt-trace"] }
embassy-stm32f4 = { version = "*", path = "../embassy-stm32f4", features = ["stm32f401"] }
defmt = "0.1.3"
defmt-rtt = "0.1.0"
defmt = "0.2.0"
defmt-rtt = "0.2.0"
cortex-m = "0.7.1"
cortex-m-rt = "0.6.13"

View File

@ -7,11 +7,11 @@ pub use defmt::*;
use core::sync::atomic::{AtomicUsize, Ordering};
#[defmt::timestamp]
fn timestamp() -> u64 {
static COUNT: AtomicUsize = AtomicUsize::new(0);
// NOTE(no-CAS) `timestamps` runs with interrupts disabled
let n = COUNT.load(Ordering::Relaxed);
COUNT.store(n + 1, Ordering::Relaxed);
n as u64
defmt::timestamp! {"{=u64}", {
static COUNT: AtomicUsize = AtomicUsize::new(0);
// NOTE(no-CAS) `timestamps` runs with interrupts disabled
let n = COUNT.load(Ordering::Relaxed);
COUNT.store(n + 1, Ordering::Relaxed);
n as u64
}
}

View File

@ -32,7 +32,7 @@ stm32f479 = ["stm32f4xx-hal/stm32f469"]
[dependencies]
embassy = { version = "0.1.0", path = "../embassy" }
defmt = { version = "0.1.3", optional = true }
defmt = { version = "0.2.0", optional = true }
log = { version = "0.4.11", optional = true }
cortex-m-rt = "0.6.13"
cortex-m = "0.7.1"

View File

@ -13,7 +13,7 @@ defmt-warn = []
defmt-error = []
[dependencies]
defmt = { version = "0.1.3", optional = true }
defmt = { version = "0.2.0", optional = true }
log = { version = "0.4.11", optional = true }
cortex-m = "0.7.1"