mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-10-02 06:40:47 +00:00
This reverts commit 9f7193fec49623a34583bae879099d43d2d495fc.
This commit is contained in:
parent
13d66de06d
commit
0ede07d697
@ -15,7 +15,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- `critical-section` now wraps the entirety of the `print!` macros (#4154)
|
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -40,10 +40,8 @@ log_format!("serial");
|
|||||||
macro_rules! println {
|
macro_rules! println {
|
||||||
($($arg:tt)*) => {{
|
($($arg:tt)*) => {{
|
||||||
{
|
{
|
||||||
$crate::with(|_| {
|
use core::fmt::Write;
|
||||||
use core::fmt::Write;
|
writeln!($crate::Printer, $($arg)*).ok();
|
||||||
writeln!($crate::Printer, $($arg)*).ok();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
@ -54,10 +52,8 @@ macro_rules! println {
|
|||||||
macro_rules! print {
|
macro_rules! print {
|
||||||
($($arg:tt)*) => {{
|
($($arg:tt)*) => {{
|
||||||
{
|
{
|
||||||
$crate::with(|_| {
|
use core::fmt::Write;
|
||||||
use core::fmt::Write;
|
write!($crate::Printer, $($arg)*).ok();
|
||||||
write!($crate::Printer, $($arg)*).ok();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
@ -490,8 +486,7 @@ mod noop {
|
|||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
#[doc(hidden)]
|
struct LockToken<'a>(PhantomData<&'a ()>);
|
||||||
pub struct LockToken<'a>(PhantomData<&'a ()>);
|
|
||||||
|
|
||||||
impl LockToken<'_> {
|
impl LockToken<'_> {
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
@ -504,9 +499,8 @@ impl LockToken<'_> {
|
|||||||
static LOCK: esp_sync::RawMutex = esp_sync::RawMutex::new();
|
static LOCK: esp_sync::RawMutex = esp_sync::RawMutex::new();
|
||||||
|
|
||||||
/// Runs the callback in a critical section, if enabled.
|
/// Runs the callback in a critical section, if enabled.
|
||||||
#[doc(hidden)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn with<R>(f: impl FnOnce(LockToken) -> R) -> R {
|
fn with<R>(f: impl FnOnce(LockToken) -> R) -> R {
|
||||||
#[cfg(feature = "critical-section")]
|
#[cfg(feature = "critical-section")]
|
||||||
return LOCK.lock(|| f(unsafe { LockToken::conjure() }));
|
return LOCK.lock(|| f(unsafe { LockToken::conjure() }));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user