Remove anyfmt

This commit is contained in:
Dario Nieuwenhuis
2020-11-27 18:42:59 +01:00
parent 49d5121094
commit 78135a81d9
24 changed files with 79 additions and 231 deletions

View File

@@ -13,12 +13,11 @@ defmt-warn = []
defmt-error = []
[dependencies]
anyfmt = { version = "0.1.0", path = "../anyfmt" }
defmt = { version = "0.1.0", optional = true }
defmt = { version = "0.1.0" }
cortex-m = "0.6.3"
cortex-m = "0.6.4"
futures = { version = "0.3.5", default-features = false }
pin-project = { version = "0.4.23", default-features = false }
pin-project = { version = "1.0.2", default-features = false }
futures-intrusive = { version = "0.3.1", default-features = false }
embassy-macros = { version = "0.1.0", path = "../embassy-macros"}

View File

@@ -63,8 +63,7 @@ pub struct Task<F: Future + 'static> {
future: UninitCell<F>, // Valid if STATE_RUNNING
}
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Copy, Clone, Debug, defmt::Format)]
pub enum SpawnError {
Busy,
}

View File

@@ -1,7 +1,6 @@
use core::future::Future;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Copy, Clone, Debug, Eq, PartialEq, defmt::Format)]
pub enum Error {
Failed,
AddressMisaligned,

View File

@@ -2,8 +2,7 @@
///
/// This list is intended to grow over time and it is not recommended to
/// exhaustively match against it.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Debug, Clone, Copy, PartialEq, Eq, defmt::Format)]
pub enum Error {
/// An entity was not found, often a file.
NotFound,

View File

@@ -1,4 +1,4 @@
use anyfmt::*;
use defmt::*;
pub trait Rand {
fn rand(&self, buf: &mut [u8]);
@@ -11,5 +11,5 @@ pub unsafe fn set_rand(rand: &'static dyn Rand) {
}
pub fn rand(buf: &mut [u8]) {
unsafe { expect!(RAND, "No rand set").rand(buf) }
unsafe { unwrap!(RAND, "No rand set").rand(buf) }
}

View File

@@ -3,8 +3,7 @@ use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
use super::TICKS_PER_SECOND;
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, defmt::Format)]
pub struct Duration {
pub(crate) ticks: u64,
}

View File

@@ -5,8 +5,7 @@ use core::ops::{Add, AddAssign, Sub, SubAssign};
use super::TICKS_PER_SECOND;
use super::{now, Duration};
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, defmt::Format)]
pub struct Instant {
ticks: u64,
}

View File

@@ -8,7 +8,7 @@ pub use instant::Instant;
pub use timer::Timer;
pub use traits::*;
use anyfmt::*;
use defmt::*;
// TODO allow customizing, probably via Cargo features `tick-hz-32768` or something.
pub const TICKS_PER_SECOND: u64 = 32768;
@@ -20,5 +20,5 @@ pub unsafe fn set_clock(clock: &'static dyn Clock) {
}
pub(crate) fn now() -> u64 {
unsafe { expect!(CLOCK, "No clock set").now() }
unsafe { unwrap!(CLOCK, "No clock set").now() }
}

View File

@@ -1,5 +1,5 @@
use anyfmt::panic;
use core::mem;
use defmt::panic;
pub struct DropBomb {
_private: (),

View File

@@ -1,8 +1,8 @@
use anyfmt::panic;
use core::cell::UnsafeCell;
use core::future::Future;
use core::mem;
use core::mem::MaybeUninit;
use defmt::panic;
use crate::util::*;

View File

@@ -1,8 +1,8 @@
use anyfmt::panic;
use core::cell::UnsafeCell;
use core::future::Future;
use core::mem;
use core::task::{Context, Poll, Waker};
use defmt::panic;
pub struct Signal<T> {
state: UnsafeCell<State<T>>,