pub struct Uart0 { /* private fields */ }
Expand description
Universal Asynchronous Receiver/Transmitter (UART) interface
Implementations§
Source§impl Uart0
impl Uart0
Sourcepub const PTR: *const RegisterBlock = {0x40001000 as *const uart0::RegisterBlock}
pub const PTR: *const RegisterBlock = {0x40001000 as *const uart0::RegisterBlock}
Pointer to the register block
Sourcepub const fn ptr() -> *const RegisterBlock
pub const fn ptr() -> *const RegisterBlock
Return the pointer to the register block
Sourcepub unsafe fn steal() -> Self
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>§
Sourcepub fn dr(&self) -> &Dr
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.
Sourcepub fn ecr(&self) -> &Ecr
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).
Sourcepub fn rsr(&self) -> &Rsr
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.
Sourcepub fn reserved0(&self) -> &Reserved0
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.
Sourcepub fn reserved2(&self) -> &Reserved2
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.
Sourcepub fn ibrd(&self) -> &Ibrd
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.
Sourcepub fn fbrd(&self) -> &Fbrd
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.
Sourcepub fn icr(&self) -> &Icr
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.
Sourcepub fn reserved1(&self) -> &Reserved1
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.