Struct Uart0

Source
pub struct Uart0 { /* private fields */ }
Expand description

Universal Asynchronous Receiver/Transmitter (UART) interface

Implementations§

Source§

impl Uart0

Source

pub const PTR: *const RegisterBlock = {0x40001000 as *const uart0::RegisterBlock}

Pointer to the register block

Source

pub const fn ptr() -> *const RegisterBlock

Return the pointer to the register block

Source

pub unsafe fn steal() -> Self

Steal an instance of this peripheral

§Safety

Ensure that the new instance of the peripheral cannot be used in a way that may race with any existing instances, for example by only accessing read-only or write-only registers, or by consuming the original peripheral and using critical sections to coordinate access between multiple new instances.

Additionally, other software such as HALs may rely on only one peripheral instance existing to ensure memory safety; ensure no stolen instances are passed to such software.

Methods from Deref<Target = RegisterBlock>§

Source

pub fn dr(&self) -> &Dr

0x00 - Data For words to be transmitted: - if the FIFOs are enabled (LCRH.FEN = 1), data written to this location is pushed onto the transmit FIFO - if the FIFOs are not enabled (LCRH.FEN = 0), data is stored in the transmitter holding register (the bottom word of the transmit FIFO). The write operation initiates transmission from the UART. The data is prefixed with a start bit, appended with the appropriate parity bit (if parity is enabled), and a stop bit. The resultant word is then transmitted. For received words: - if the FIFOs are enabled (LCRH.FEN = 1), the data byte and the 4-bit status (break, frame, parity, and overrun) is pushed onto the 12-bit wide receive FIFO - if the FIFOs are not enabled (LCRH.FEN = 0), the data byte and status are stored in the receiving holding register (the bottom word of the receive FIFO). The received data byte is read by performing reads from this register along with the corresponding status information. The status information can also be read by a read of the RSR register.

Source

pub fn ecr(&self) -> &Ecr

0x04 - Error Clear This register is mapped to the same address as RSR register. Reads from this address are associated with RSR register and return the receive status. Writes to this address are associated with ECR register and clear the receive status flags (framing, parity, break, and overrun errors).

Source

pub fn rsr(&self) -> &Rsr

0x04 - Status This register is mapped to the same address as ECR register. Reads from this address are associated with RSR register and return the receive status. Writes to this address are associated with ECR register and clear the receive status flags (framing, parity, break, and overrun errors). If the status is read from this register, then the status information for break, framing and parity corresponds to the data character read from the Data Register, DR prior to reading the RSR. The status information for overrun is set immediately when an overrun condition occurs.

Source

pub fn reserved0(&self) -> &Reserved0

0x08 - Software should not rely on the value of a reserved. Writing any other value than the reset value may result in undefined behavior.

Source

pub fn fr(&self) -> &Fr

0x18 - Flag Reads from this register return the UART flags.

Source

pub fn reserved2(&self) -> &Reserved2

0x1c - Software should not rely on the value of a reserved. Writing any other value than the reset value may result in undefined behavior.

Source

pub fn ibrd(&self) -> &Ibrd

0x24 - Integer Baud-Rate Divisor If this register is modified while transmission or reception is on-going, the baud rate will not be updated until transmission or reception of the current character is complete.

Source

pub fn fbrd(&self) -> &Fbrd

0x28 - Fractional Baud-Rate Divisor If this register is modified while trasmission or reception is on-going, the baudrate will not be updated until transmission or reception of the current character is complete.

Source

pub fn lcrh(&self) -> &Lcrh

0x2c - Line Control

Source

pub fn ctl(&self) -> &Ctl

0x30 - Control

Source

pub fn ifls(&self) -> &Ifls

0x34 - Interrupt FIFO Level Select

Source

pub fn imsc(&self) -> &Imsc

0x38 - Interrupt Mask Set/Clear

Source

pub fn ris(&self) -> &Ris

0x3c - Raw Interrupt Status

Source

pub fn mis(&self) -> &Mis

0x40 - Masked Interrupt Status

Source

pub fn icr(&self) -> &Icr

0x44 - Interrupt Clear On a write of 1, the corresponding interrupt is cleared. A write of 0 has no effect.

Source

pub fn dmactl(&self) -> &Dmactl

0x48 - DMA Control

Source

pub fn reserved1(&self) -> &Reserved1

0x4c - Software should not rely on the value of a reserved. Writing any other value than the reset value may result in undefined behavior.

Source

pub fn reserved3(&self) -> &Reserved3

0x90 - Software should not rely on the value of a reserved. Writing any other value than the reset value may result in undefined behavior.

Source

pub fn reserved4(&self) -> &Reserved4

0xfd0 - Software should not rely on the value of a reserved. Writing any other value than the reset value may result in undefined behavior.

Trait Implementations§

Source§

impl Debug for Uart0

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for Uart0

Source§

type Target = RegisterBlock

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Send for Uart0

Auto Trait Implementations§

§

impl Freeze for Uart0

§

impl RefUnwindSafe for Uart0

§

impl !Sync for Uart0

§

impl Unpin for Uart0

§

impl UnwindSafe for Uart0

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.