mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-29 02:02:28 +00:00
Remove anyfmt
This commit is contained in:
parent
49d5121094
commit
78135a81d9
@ -3,7 +3,7 @@
|
|||||||
members = [
|
members = [
|
||||||
"embassy",
|
"embassy",
|
||||||
"embassy-nrf",
|
"embassy-nrf",
|
||||||
"anyfmt",
|
"embassy-macros",
|
||||||
"examples",
|
"examples",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -11,11 +11,6 @@ exclude = [
|
|||||||
"third_party"
|
"third_party"
|
||||||
]
|
]
|
||||||
|
|
||||||
[patch.crates-io]
|
|
||||||
panic-probe = { git = "https://github.com/knurling-rs/probe-run", branch="main" }
|
|
||||||
defmt-rtt = { git = "https://github.com/knurling-rs/defmt", branch="main" }
|
|
||||||
defmt = { git = "https://github.com/knurling-rs/defmt", branch="main" }
|
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
debug = 2
|
debug = 2
|
||||||
|
@ -52,14 +52,6 @@ cargo install --git https://github.com/knurling-rs/probe-run --branch main --fea
|
|||||||
cargo run --bin rtc_async
|
cargo run --bin rtc_async
|
||||||
```
|
```
|
||||||
|
|
||||||
## Using on your project
|
|
||||||
|
|
||||||
`embassy` requires git version of a few dependencies.
|
|
||||||
|
|
||||||
When using `embassy` in your own project, make sure you copy over the `[patch.crates-io]` section from root `Cargo.toml`.
|
|
||||||
|
|
||||||
This will no longer needed after the first crates.io release.
|
|
||||||
|
|
||||||
## Minimum supported Rust version (MSRV)
|
## Minimum supported Rust version (MSRV)
|
||||||
|
|
||||||
`rustc 1.48.0-nightly (1fd5b9d51 2020-09-20)`
|
`rustc 1.48.0-nightly (1fd5b9d51 2020-09-20)`
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "anyfmt"
|
|
||||||
version = "0.1.0"
|
|
||||||
authors = ["Dario Nieuwenhuis <dirbaio@dirbaio.net>"]
|
|
||||||
edition = "2018"
|
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
defmt = { version = "0.1.0", optional = true }
|
|
||||||
log = { version = "0.4.11", optional = true }
|
|
@ -1,149 +0,0 @@
|
|||||||
#![no_std]
|
|
||||||
|
|
||||||
pub mod export {
|
|
||||||
#[cfg(feature = "defmt")]
|
|
||||||
pub use defmt;
|
|
||||||
#[cfg(feature = "log")]
|
|
||||||
pub use log;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "log")]
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! log {
|
|
||||||
(trace, $($arg:expr),*) => { $crate::export::log::trace!($($arg),*); };
|
|
||||||
(debug, $($arg:expr),*) => { $crate::export::log::debug!($($arg),*); };
|
|
||||||
(info, $($arg:expr),*) => { $crate::export::log::info!($($arg),*); };
|
|
||||||
(warn, $($arg:expr),*) => { $crate::export::log::warn!($($arg),*); };
|
|
||||||
(error, $($arg:expr),*) => { $crate::export::log::error!($($arg),*); };
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "defmt")]
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! log {
|
|
||||||
(trace, $($arg:expr),*) => { $crate::export::defmt::trace!($($arg),*); };
|
|
||||||
(debug, $($arg:expr),*) => { $crate::export::defmt::debug!($($arg),*); };
|
|
||||||
(info, $($arg:expr),*) => { $crate::export::defmt::info!($($arg),*); };
|
|
||||||
(warn, $($arg:expr),*) => { $crate::export::defmt::warn!($($arg),*); };
|
|
||||||
(error, $($arg:expr),*) => { $crate::export::defmt::error!($($arg),*); };
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(any(feature = "log", feature = "defmt")))]
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! log {
|
|
||||||
($level:ident, $($arg:expr),*) => {{}};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! trace {
|
|
||||||
($($arg:expr),*) => (log!(trace, $($arg),*));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! debug {
|
|
||||||
($($arg:expr),*) => ($crate::log!(debug, $($arg),*));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! info {
|
|
||||||
($($arg:expr),*) => ($crate::log!(info, $($arg),*));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! warn {
|
|
||||||
($($arg:expr),*) => ($crate::log!(warn, $($arg),*));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! error {
|
|
||||||
($($arg:expr),*) => ($crate::log!(error, $($arg),*));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! expect {
|
|
||||||
($arg:expr, $msg:expr) => {
|
|
||||||
match $crate::Try::into_result($arg) {
|
|
||||||
::core::result::Result::Ok(t) => t,
|
|
||||||
::core::result::Result::Err(e) => {
|
|
||||||
$crate::panic!("{:?}: {:?}", $crate::intern!($msg), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "defmt")]
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! intern {
|
|
||||||
($arg:expr) => {
|
|
||||||
$crate::export::defmt::intern!($arg)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(feature = "defmt"))]
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! intern {
|
|
||||||
($arg:expr) => {
|
|
||||||
$arg
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! unwrap {
|
|
||||||
($arg:expr) => {
|
|
||||||
expect!($arg, "Unwrap failed")
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! panic {
|
|
||||||
() => {
|
|
||||||
$crate::panic!("panic")
|
|
||||||
};
|
|
||||||
($($arg:expr),*) => {{
|
|
||||||
$crate::log!(error, $($arg),*);
|
|
||||||
::core::panic!()
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! assert {
|
|
||||||
($cond:expr) => {
|
|
||||||
$crate::assert!($cond, "assertion failed");
|
|
||||||
};
|
|
||||||
($cond:expr, $($arg:expr),*) => {
|
|
||||||
{
|
|
||||||
if !$cond {
|
|
||||||
$crate::panic!($($arg),*);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
|
||||||
pub struct NoneError;
|
|
||||||
|
|
||||||
pub trait Try {
|
|
||||||
type Ok;
|
|
||||||
type Error;
|
|
||||||
fn into_result(self) -> Result<Self::Ok, Self::Error>;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> Try for Option<T> {
|
|
||||||
type Ok = T;
|
|
||||||
type Error = NoneError;
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn into_result(self) -> Result<T, NoneError> {
|
|
||||||
self.ok_or(NoneError)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T, E> Try for Result<T, E> {
|
|
||||||
type Ok = T;
|
|
||||||
type Error = E;
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn into_result(self) -> Self {
|
|
||||||
self
|
|
||||||
}
|
|
||||||
}
|
|
@ -21,13 +21,10 @@ defmt-error = [ ]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
embassy = { version = "0.1.0", path = "../embassy" }
|
embassy = { version = "0.1.0", path = "../embassy" }
|
||||||
|
|
||||||
anyfmt = { version = "0.1.0", path = "../anyfmt" }
|
defmt = { version = "0.1.2" }
|
||||||
defmt = { version = "0.1.0", optional = true }
|
cortex-m-rt = "0.6.13"
|
||||||
|
cortex-m = { version = "0.6.4" }
|
||||||
cortex-m-rt = "0.6.12"
|
|
||||||
cortex-m = { version = "0.6.3" }
|
|
||||||
embedded-hal = { version = "0.2.4" }
|
embedded-hal = { version = "0.2.4" }
|
||||||
bare-metal = { version = "0.2.0", features = ["const-fn"] }
|
|
||||||
|
|
||||||
nrf52810-pac = { version = "0.9.0", optional = true }
|
nrf52810-pac = { version = "0.9.0", optional = true }
|
||||||
nrf52811-pac = { version = "0.9.1", optional = true }
|
nrf52811-pac = { version = "0.9.1", optional = true }
|
||||||
@ -35,8 +32,8 @@ nrf52832-pac = { version = "0.9.0", optional = true }
|
|||||||
nrf52833-pac = { version = "0.9.0", optional = true }
|
nrf52833-pac = { version = "0.9.0", optional = true }
|
||||||
nrf52840-pac = { version = "0.9.0", optional = true }
|
nrf52840-pac = { version = "0.9.0", optional = true }
|
||||||
|
|
||||||
nrf52810-hal = { version = "0.11.0", optional = true }
|
nrf52810-hal = { version = "0.12.0", optional = true }
|
||||||
#nrf52811-hal = { version = "0.11.0", optional = true } # doesn't exist yet
|
#nrf52811-hal = { version = "0.12.0", optional = true } # doesn't exist yet
|
||||||
nrf52832-hal = { version = "0.11.0", optional = true }
|
nrf52832-hal = { version = "0.12.0", optional = true }
|
||||||
nrf52833-hal = { version = "0.11.0", optional = true }
|
nrf52833-hal = { version = "0.12.0", optional = true }
|
||||||
nrf52840-hal = { version = "0.11.0", optional = true }
|
nrf52840-hal = { version = "0.12.0", optional = true }
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use anyfmt::{panic, *};
|
|
||||||
use core::cell::Cell;
|
use core::cell::Cell;
|
||||||
use core::future::Future;
|
use core::future::Future;
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
use core::task::{Context, Poll};
|
use core::task::{Context, Poll};
|
||||||
|
use defmt::{panic, *};
|
||||||
use embassy::util::Signal;
|
use embassy::util::Signal;
|
||||||
|
|
||||||
use crate::hal::gpio::{Input, Level, Output, Pin, Port};
|
use crate::hal::gpio::{Input, Level, Output, Pin, Port};
|
||||||
@ -51,8 +51,7 @@ pub enum OutputChannelPolarity {
|
|||||||
Toggle,
|
Toggle,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
#[derive(Debug, Copy, Clone, Eq, PartialEq, defmt::Format)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
|
||||||
pub enum NewChannelError {
|
pub enum NewChannelError {
|
||||||
NoFreeChannels,
|
NoFreeChannels,
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,9 @@ use crate::pac::{NVIC, NVIC_PRIO_BITS};
|
|||||||
// Re-exports
|
// Re-exports
|
||||||
pub use crate::pac::Interrupt;
|
pub use crate::pac::Interrupt;
|
||||||
pub use crate::pac::Interrupt::*; // needed for cortex-m-rt #[interrupt]
|
pub use crate::pac::Interrupt::*; // needed for cortex-m-rt #[interrupt]
|
||||||
pub use bare_metal::{CriticalSection, Mutex};
|
pub use cortex_m::interrupt::{CriticalSection, Mutex};
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
|
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, defmt::Format)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum Priority {
|
pub enum Priority {
|
||||||
Level0 = 0,
|
Level0 = 0,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use core::future::Future;
|
use core::future::Future;
|
||||||
|
use defmt::{assert, assert_eq, panic, *};
|
||||||
|
|
||||||
use crate::hal::gpio::{Output, Pin as GpioPin, Port as GpioPort, PushPull};
|
use crate::hal::gpio::{Output, Pin as GpioPin, Port as GpioPort, PushPull};
|
||||||
use crate::pac::{Interrupt, QSPI};
|
use crate::pac::{Interrupt, QSPI};
|
||||||
@ -32,12 +33,18 @@ pub struct Pins {
|
|||||||
pub io3: Option<GpioPin<Output<PushPull>>>,
|
pub io3: Option<GpioPin<Output<PushPull>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct DeepPowerDownConfig {
|
||||||
|
pub enter_time: u16,
|
||||||
|
pub exit_time: u16,
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub pins: Pins,
|
pub pins: Pins,
|
||||||
pub xip_offset: u32,
|
pub xip_offset: u32,
|
||||||
pub read_opcode: ReadOpcode,
|
pub read_opcode: ReadOpcode,
|
||||||
pub write_opcode: WriteOpcode,
|
pub write_opcode: WriteOpcode,
|
||||||
pub write_page_size: WritePageSize,
|
pub write_page_size: WritePageSize,
|
||||||
|
pub deep_power_down: Option<DeepPowerDownConfig>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Qspi {
|
pub struct Qspi {
|
||||||
@ -96,15 +103,27 @@ impl Qspi {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
qspi.ifconfig0.write(|w| {
|
qspi.ifconfig0.write(|mut w| {
|
||||||
let w = w.addrmode().variant(AddressMode::_24BIT);
|
w = w.addrmode().variant(AddressMode::_24BIT);
|
||||||
let w = w.dpmenable().disable();
|
if config.deep_power_down.is_some() {
|
||||||
let w = w.ppsize().variant(config.write_page_size);
|
w = w.dpmenable().enable();
|
||||||
let w = w.readoc().variant(config.read_opcode);
|
} else {
|
||||||
let w = w.writeoc().variant(config.write_opcode);
|
w = w.dpmenable().disable();
|
||||||
|
}
|
||||||
|
w = w.ppsize().variant(config.write_page_size);
|
||||||
|
w = w.readoc().variant(config.read_opcode);
|
||||||
|
w = w.writeoc().variant(config.write_opcode);
|
||||||
w
|
w
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if let Some(dpd) = &config.deep_power_down {
|
||||||
|
qspi.dpmdur.write(|mut w| unsafe {
|
||||||
|
w = w.enter().bits(dpd.enter_time);
|
||||||
|
w = w.exit().bits(dpd.exit_time);
|
||||||
|
w
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
qspi.ifconfig1.write(|w| {
|
qspi.ifconfig1.write(|w| {
|
||||||
let w = unsafe { w.sckdelay().bits(80) };
|
let w = unsafe { w.sckdelay().bits(80) };
|
||||||
let w = w.dpmen().exit();
|
let w = w.dpmen().exit();
|
||||||
@ -125,13 +144,28 @@ impl Qspi {
|
|||||||
qspi.events_ready.reset();
|
qspi.events_ready.reset();
|
||||||
|
|
||||||
// Enable READY interrupt
|
// Enable READY interrupt
|
||||||
|
SIGNAL.reset();
|
||||||
qspi.intenset.write(|w| w.ready().set());
|
qspi.intenset.write(|w| w.ready().set());
|
||||||
interrupt::set_priority(Interrupt::QSPI, interrupt::Priority::Level7);
|
interrupt::set_priority(Interrupt::QSPI, interrupt::Priority::Level7);
|
||||||
|
interrupt::unpend(Interrupt::QSPI);
|
||||||
interrupt::enable(Interrupt::QSPI);
|
interrupt::enable(Interrupt::QSPI);
|
||||||
|
|
||||||
Self { inner: qspi }
|
Self { inner: qspi }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn sleep(&mut self) {
|
||||||
|
info!("flash: sleeping");
|
||||||
|
info!("flash: state = {:?}", self.inner.status.read().bits());
|
||||||
|
self.inner.ifconfig1.modify(|r, w| w.dpmen().enter());
|
||||||
|
info!("flash: state = {:?}", self.inner.status.read().bits());
|
||||||
|
cortex_m::asm::delay(1000000);
|
||||||
|
info!("flash: state = {:?}", self.inner.status.read().bits());
|
||||||
|
|
||||||
|
self.inner
|
||||||
|
.tasks_deactivate
|
||||||
|
.write(|w| w.tasks_deactivate().set_bit());
|
||||||
|
}
|
||||||
|
|
||||||
pub fn custom_instruction<'a>(
|
pub fn custom_instruction<'a>(
|
||||||
&'a mut self,
|
&'a mut self,
|
||||||
opcode: u8,
|
opcode: u8,
|
||||||
@ -318,6 +352,7 @@ unsafe fn QSPI() {
|
|||||||
let p = crate::pac::Peripherals::steal().QSPI;
|
let p = crate::pac::Peripherals::steal().QSPI;
|
||||||
if p.events_ready.read().events_ready().bit_is_set() {
|
if p.events_ready.read().events_ready().bit_is_set() {
|
||||||
p.events_ready.reset();
|
p.events_ready.reset();
|
||||||
|
info!("qspi ready");
|
||||||
SIGNAL.signal(());
|
SIGNAL.signal(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ pub use uarte0::{baudrate::BAUDRATE_A as Baudrate, config::PARITY_A as Parity};
|
|||||||
use embassy::io::{AsyncBufRead, AsyncWrite, Result};
|
use embassy::io::{AsyncBufRead, AsyncWrite, Result};
|
||||||
use embassy::util::WakerStore;
|
use embassy::util::WakerStore;
|
||||||
|
|
||||||
use anyfmt::{assert, panic, *};
|
use defmt::{assert, panic, todo, *};
|
||||||
|
|
||||||
//use crate::trace;
|
//use crate::trace;
|
||||||
|
|
||||||
|
@ -13,12 +13,11 @@ defmt-warn = []
|
|||||||
defmt-error = []
|
defmt-error = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyfmt = { version = "0.1.0", path = "../anyfmt" }
|
defmt = { version = "0.1.0" }
|
||||||
defmt = { version = "0.1.0", optional = true }
|
|
||||||
|
|
||||||
cortex-m = "0.6.3"
|
cortex-m = "0.6.4"
|
||||||
futures = { version = "0.3.5", default-features = false }
|
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 }
|
futures-intrusive = { version = "0.3.1", default-features = false }
|
||||||
embassy-macros = { version = "0.1.0", path = "../embassy-macros"}
|
embassy-macros = { version = "0.1.0", path = "../embassy-macros"}
|
||||||
|
|
||||||
|
@ -63,8 +63,7 @@ pub struct Task<F: Future + 'static> {
|
|||||||
future: UninitCell<F>, // Valid if STATE_RUNNING
|
future: UninitCell<F>, // Valid if STATE_RUNNING
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug, defmt::Format)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
|
||||||
pub enum SpawnError {
|
pub enum SpawnError {
|
||||||
Busy,
|
Busy,
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use core::future::Future;
|
use core::future::Future;
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
#[derive(Copy, Clone, Debug, Eq, PartialEq, defmt::Format)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
Failed,
|
Failed,
|
||||||
AddressMisaligned,
|
AddressMisaligned,
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
///
|
///
|
||||||
/// This list is intended to grow over time and it is not recommended to
|
/// This list is intended to grow over time and it is not recommended to
|
||||||
/// exhaustively match against it.
|
/// exhaustively match against it.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, defmt::Format)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// An entity was not found, often a file.
|
/// An entity was not found, often a file.
|
||||||
NotFound,
|
NotFound,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use anyfmt::*;
|
use defmt::*;
|
||||||
|
|
||||||
pub trait Rand {
|
pub trait Rand {
|
||||||
fn rand(&self, buf: &mut [u8]);
|
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]) {
|
pub fn rand(buf: &mut [u8]) {
|
||||||
unsafe { expect!(RAND, "No rand set").rand(buf) }
|
unsafe { unwrap!(RAND, "No rand set").rand(buf) }
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,7 @@ use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
|
|||||||
|
|
||||||
use super::TICKS_PER_SECOND;
|
use super::TICKS_PER_SECOND;
|
||||||
|
|
||||||
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, defmt::Format)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
|
||||||
pub struct Duration {
|
pub struct Duration {
|
||||||
pub(crate) ticks: u64,
|
pub(crate) ticks: u64,
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,7 @@ use core::ops::{Add, AddAssign, Sub, SubAssign};
|
|||||||
use super::TICKS_PER_SECOND;
|
use super::TICKS_PER_SECOND;
|
||||||
use super::{now, Duration};
|
use super::{now, Duration};
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, defmt::Format)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
|
||||||
pub struct Instant {
|
pub struct Instant {
|
||||||
ticks: u64,
|
ticks: u64,
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ pub use instant::Instant;
|
|||||||
pub use timer::Timer;
|
pub use timer::Timer;
|
||||||
pub use traits::*;
|
pub use traits::*;
|
||||||
|
|
||||||
use anyfmt::*;
|
use defmt::*;
|
||||||
|
|
||||||
// TODO allow customizing, probably via Cargo features `tick-hz-32768` or something.
|
// TODO allow customizing, probably via Cargo features `tick-hz-32768` or something.
|
||||||
pub const TICKS_PER_SECOND: u64 = 32768;
|
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 {
|
pub(crate) fn now() -> u64 {
|
||||||
unsafe { expect!(CLOCK, "No clock set").now() }
|
unsafe { unwrap!(CLOCK, "No clock set").now() }
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use anyfmt::panic;
|
|
||||||
use core::mem;
|
use core::mem;
|
||||||
|
use defmt::panic;
|
||||||
|
|
||||||
pub struct DropBomb {
|
pub struct DropBomb {
|
||||||
_private: (),
|
_private: (),
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use anyfmt::panic;
|
|
||||||
use core::cell::UnsafeCell;
|
use core::cell::UnsafeCell;
|
||||||
use core::future::Future;
|
use core::future::Future;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
use core::mem::MaybeUninit;
|
use core::mem::MaybeUninit;
|
||||||
|
use defmt::panic;
|
||||||
|
|
||||||
use crate::util::*;
|
use crate::util::*;
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use anyfmt::panic;
|
|
||||||
use core::cell::UnsafeCell;
|
use core::cell::UnsafeCell;
|
||||||
use core::future::Future;
|
use core::future::Future;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
use core::task::{Context, Poll, Waker};
|
use core::task::{Context, Poll, Waker};
|
||||||
|
use defmt::panic;
|
||||||
|
|
||||||
pub struct Signal<T> {
|
pub struct Signal<T> {
|
||||||
state: UnsafeCell<State<T>>,
|
state: UnsafeCell<State<T>>,
|
||||||
|
@ -17,17 +17,16 @@ defmt-error = []
|
|||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy = { version = "0.1.0", path = "../embassy", features = ["defmt"] }
|
embassy = { version = "0.1.0", path = "../embassy", features = ["defmt-trace"] }
|
||||||
embassy-nrf = { version = "0.1.0", path = "../embassy-nrf", features = ["defmt", "defmt-trace", "52840"] }
|
embassy-nrf = { version = "0.1.0", path = "../embassy-nrf", features = ["defmt-trace", "52840"] }
|
||||||
anyfmt = { version = "0.1.0", path = "../anyfmt", features = ["defmt"] }
|
|
||||||
|
|
||||||
defmt = "0.1.0"
|
defmt = "0.1.2"
|
||||||
defmt-rtt = "0.1.0"
|
defmt-rtt = "0.1.0"
|
||||||
|
|
||||||
cortex-m = { version = "0.6.3" }
|
cortex-m = { version = "0.6.3" }
|
||||||
cortex-m-rt = "0.6.12"
|
cortex-m-rt = "0.6.12"
|
||||||
embedded-hal = { version = "0.2.4" }
|
embedded-hal = { version = "0.2.4" }
|
||||||
panic-probe = "0.1.0"
|
panic-probe = "0.1.0"
|
||||||
nrf52840-hal = { version = "0.11.0" }
|
nrf52840-hal = { version = "0.12.0" }
|
||||||
futures = { version = "0.3.7", default-features = false, features = ["async-await"] }
|
futures = { version = "0.3.8", default-features = false, features = ["async-await"] }
|
||||||
cortex-m-rtic = { git = "https://github.com/rtic-rs/cortex-m-rtic", branch = "master"}
|
cortex-m-rtic = { git = "https://github.com/rtic-rs/cortex-m-rtic", branch = "master"}
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
mod example_common;
|
mod example_common;
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
|
|
||||||
use anyfmt::panic;
|
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
|
use defmt::{assert_eq, panic, *};
|
||||||
use nrf52840_hal::gpio;
|
use nrf52840_hal::gpio;
|
||||||
|
|
||||||
use embassy::executor::{task, Executor};
|
use embassy::executor::{task, Executor};
|
||||||
@ -65,6 +65,7 @@ async fn run() {
|
|||||||
write_opcode: qspi::WriteOpcode::PP4IO,
|
write_opcode: qspi::WriteOpcode::PP4IO,
|
||||||
xip_offset: 0,
|
xip_offset: 0,
|
||||||
write_page_size: qspi::WritePageSize::_256BYTES,
|
write_page_size: qspi::WritePageSize::_256BYTES,
|
||||||
|
deep_power_down: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut q = qspi::Qspi::new(p.QSPI, config);
|
let mut q = qspi::Qspi::new(p.QSPI, config);
|
||||||
|
@ -4,7 +4,7 @@ use defmt_rtt as _; // global logger
|
|||||||
use nrf52840_hal as _;
|
use nrf52840_hal as _;
|
||||||
use panic_probe as _;
|
use panic_probe as _;
|
||||||
|
|
||||||
pub use anyfmt::*;
|
pub use defmt::*;
|
||||||
|
|
||||||
use core::sync::atomic::{AtomicUsize, Ordering};
|
use core::sync::atomic::{AtomicUsize, Ordering};
|
||||||
|
|
||||||
|
@ -7,15 +7,11 @@ set -euxo pipefail
|
|||||||
|
|
||||||
# embassy
|
# embassy
|
||||||
(cd embassy; cargo build --target thumbv7em-none-eabihf)
|
(cd embassy; cargo build --target thumbv7em-none-eabihf)
|
||||||
(cd embassy; cargo build --target thumbv7em-none-eabihf --features defmt,anyfmt/defmt)
|
|
||||||
(cd embassy; cargo build --target thumbv7em-none-eabihf --features anyfmt/log)
|
|
||||||
|
|
||||||
# embassy-nrf
|
# embassy-nrf
|
||||||
(cd embassy-nrf; cargo build --target thumbv7em-none-eabihf --features 52810)
|
(cd embassy-nrf; cargo build --target thumbv7em-none-eabi --features 52810)
|
||||||
#(cd embassy-nrf; cargo build --target thumbv7em-none-eabihf --features 52811) # nrf52811-hal doesn't exist yet
|
#(cd embassy-nrf; cargo build --target thumbv7em-none-eabihf --features 52811) # nrf52811-hal doesn't exist yet
|
||||||
(cd embassy-nrf; cargo build --target thumbv7em-none-eabihf --features 52832)
|
(cd embassy-nrf; cargo build --target thumbv7em-none-eabihf --features 52832)
|
||||||
(cd embassy-nrf; cargo build --target thumbv7em-none-eabihf --features 52833)
|
(cd embassy-nrf; cargo build --target thumbv7em-none-eabihf --features 52833)
|
||||||
(cd embassy-nrf; cargo build --target thumbv7em-none-eabihf --features 52840)
|
(cd embassy-nrf; cargo build --target thumbv7em-none-eabihf --features 52840)
|
||||||
|
|
||||||
(cd embassy-nrf; cargo build --target thumbv7em-none-eabihf --features 52840,anyfmt/log)
|
|
||||||
(cd embassy-nrf; cargo build --target thumbv7em-none-eabihf --features 52840,defmt,embassy/defmt,anyfmt/defmt)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user