#[non_exhaustive]pub enum RunLevel {
ThreadMode,
Interrupt(ElevatedRunLevel),
}Expand description
Represents the priority level of running code.
Interrupts at or below this level are masked.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ThreadMode
Thread mode.
This is the lowest level. No interrupts are masked by the run level.
Interrupt(ElevatedRunLevel)
An elevated level, usually an interrupt handler’s.
Implementations§
Source§impl RunLevel
impl RunLevel
Sourcepub fn current() -> Self
pub fn current() -> Self
Returns the current run level.
§Examples
use esp_hal::interrupt::RunLevel;
let level = RunLevel::current();
println!("Current run level: {:?}", level);Sourcepub unsafe fn change(to: Self) -> Self
Available on crate feature unstable only.
pub unsafe fn change(to: Self) -> Self
unstable only.Changes the current run level to the specified level and returns the previous level.
§Safety
This function must only be used to raise the run level and to restore it to a previous value. It must not be used to arbitrarily lower the run level.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn is_thread(&self) -> bool
pub fn is_thread(&self) -> bool
Checks if the run level indicates thread mode.
This function can be used to determine if the CPU is executing an interrupt handler.
§Examples
use esp_hal::interrupt::RunLevel;
let level = RunLevel::current();
if level.is_thread() {
println!("Running in thread mode");
} else {
println!("Running in an interrupt handler");
}Trait Implementations§
Source§impl Ord for RunLevel
impl Ord for RunLevel
Source§impl PartialEq<ElevatedRunLevel> for RunLevel
impl PartialEq<ElevatedRunLevel> for RunLevel
Source§impl PartialOrd for RunLevel
impl PartialOrd for RunLevel
Source§impl TryFrom<u32> for RunLevel
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl TryFrom<u32> for RunLevel
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl Copy for RunLevel
impl Eq for RunLevel
impl StructuralPartialEq for RunLevel
Auto Trait Implementations§
impl Freeze for RunLevel
impl RefUnwindSafe for RunLevel
impl Send for RunLevel
impl Sync for RunLevel
impl Unpin for RunLevel
impl UnsafeUnpin for RunLevel
impl UnwindSafe for RunLevel
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)