Struct UART1
#[non_exhaustive]pub struct UART1<'a> { /* private fields */ }Expand description
UART1 peripheral singleton
Implementations§
§impl UART1<'_>
impl UART1<'_>
pub unsafe fn steal() -> UART1<'_>
pub unsafe fn steal() -> UART1<'_>
Unsafely create an instance of this peripheral out of thin air.
§Safety
You must ensure that you’re only using one instance of this type at a time.
pub unsafe fn clone_unchecked(&self) -> UART1<'_>
pub unsafe fn clone_unchecked(&self) -> UART1<'_>
Unsafely clone this peripheral reference.
§Safety
You must ensure that you’re only using one instance of this type at a time.
pub fn reborrow(&mut self) -> UART1<'_>
pub fn reborrow(&mut self) -> UART1<'_>
Creates a new peripheral reference with a shorter lifetime.
Use this method if you would like to keep working with the peripheral after you dropped the driver that consumes this.
pub fn bind_peri_interrupt(&self, handler: InterruptHandler)
Available on crate features unstable only.
pub fn bind_peri_interrupt(&self, handler: InterruptHandler)
unstable only.Binds an interrupt handler to the corresponding interrupt for this peripheral, and enables the interrupt.
§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.
pub fn enable_peri_interrupt(&self, priority: Priority)
pub fn enable_peri_interrupt(&self, priority: Priority)
Enables the UART1 peripheral interrupt on the given priority level.
Note that a suitable interrupt handler needs to be set up before the first interrupt
is triggered, otherwise the default handler will panic.
To set up an interrupt handler, use Self::bind_peri_interrupt or create a function that has the same (non-mangled) name as the interrupt you want to handle.
§Examples
use esp_hal::interrupt::Priority;
#[unsafe(no_mangle)]
unsafe extern "C" fn UART1() {
// do something
}
peripherals.UART1.enable_peri_interrupt(Priority::Priority1);
peripherals.UART1.disable_peri_interrupt_on_all_cores();pub fn disable_peri_interrupt(&self)
Available on crate features unstable only.
pub fn disable_peri_interrupt(&self)
unstable only.Disables the UART1 peripheral interrupt handler on the current CPU core.
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.
pub fn disable_peri_interrupt_on_all_cores(&self)
pub fn disable_peri_interrupt_on_all_cores(&self)
Disables the UART1 peripheral interrupt handler on all cores.
§impl UART1<'_>
impl UART1<'_>
pub const PTR: *const <Periph<RegisterBlock, 1610616832> as Deref>::Target = pac::UART1::PTR
Available on crate features unstable only.
pub const PTR: *const <Periph<RegisterBlock, 1610616832> as Deref>::Target = pac::UART1::PTR
unstable only.Pointer to the register block
§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.
pub const fn ptr() -> *const <Periph<RegisterBlock, 1610616832> as Deref>::Target
Available on crate features unstable only.
pub const fn ptr() -> *const <Periph<RegisterBlock, 1610616832> as Deref>::Target
unstable only.Return the pointer to the register block
§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.
pub const fn regs<'a>() -> &'a <Periph<RegisterBlock, 1610616832> as Deref>::Target
Available on crate features unstable only.
pub const fn regs<'a>() -> &'a <Periph<RegisterBlock, 1610616832> as Deref>::Target
unstable only.Return a reference to the register block
§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.
pub fn register_block(
&self,
) -> &<Periph<RegisterBlock, 1610616832> as Deref>::Target
Available on crate features unstable only.
pub fn register_block( &self, ) -> &<Periph<RegisterBlock, 1610616832> as Deref>::Target
unstable only.Return a reference to the register block
§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.