#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
impl super::LSR {
#[doc = r" Reads the contents of the register"]
#[inline]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
}
#[doc = "Possible values of the field `RDR`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RDRR {
#[doc = "Empty. The UART1 receiver FIFO is empty."]
EMPTY,
#[doc = "Data. The UART1 receiver FIFO is not empty."]
DATA,
}
impl RDRR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
RDRR::EMPTY => false,
RDRR::DATA => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> RDRR {
match value {
false => RDRR::EMPTY,
true => RDRR::DATA,
}
}
#[doc = "Checks if the value of the field is `EMPTY`"]
#[inline]
pub fn is_empty(&self) -> bool {
*self == RDRR::EMPTY
}
#[doc = "Checks if the value of the field is `DATA`"]
#[inline]
pub fn is_data(&self) -> bool {
*self == RDRR::DATA
}
}
#[doc = "Possible values of the field `OE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OER {
#[doc = "Inactive. Overrun error status is inactive."]
INACTIVE,
#[doc = "Active. Overrun error status is active."]
ACTIVE,
}
impl OER {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
OER::INACTIVE => false,
OER::ACTIVE => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> OER {
match value {
false => OER::INACTIVE,
true => OER::ACTIVE,
}
}
#[doc = "Checks if the value of the field is `INACTIVE`"]
#[inline]
pub fn is_inactive(&self) -> bool {
*self == OER::INACTIVE
}
#[doc = "Checks if the value of the field is `ACTIVE`"]
#[inline]
pub fn is_active(&self) -> bool {
*self == OER::ACTIVE
}
}
#[doc = "Possible values of the field `PE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PER {
#[doc = "Inactive. Parity error status is inactive."]
INACTIVE,
#[doc = "Active. Parity error status is active."]
ACTIVE,
}
impl PER {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
PER::INACTIVE => false,
PER::ACTIVE => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> PER {
match value {
false => PER::INACTIVE,
true => PER::ACTIVE,
}
}
#[doc = "Checks if the value of the field is `INACTIVE`"]
#[inline]
pub fn is_inactive(&self) -> bool {
*self == PER::INACTIVE
}
#[doc = "Checks if the value of the field is `ACTIVE`"]
#[inline]
pub fn is_active(&self) -> bool {
*self == PER::ACTIVE
}
}
#[doc = "Possible values of the field `FE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FER {
#[doc = "Inactive. Framing error status is inactive."]
INACTIVE,
#[doc = "Active. Framing error status is active."]
ACTIVE,
}
impl FER {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
FER::INACTIVE => false,
FER::ACTIVE => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> FER {
match value {
false => FER::INACTIVE,
true => FER::ACTIVE,
}
}
#[doc = "Checks if the value of the field is `INACTIVE`"]
#[inline]
pub fn is_inactive(&self) -> bool {
*self == FER::INACTIVE
}
#[doc = "Checks if the value of the field is `ACTIVE`"]
#[inline]
pub fn is_active(&self) -> bool {
*self == FER::ACTIVE
}
}
#[doc = "Possible values of the field `BI`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BIR {
#[doc = "Break interrupt status is inactive."]
BREAK_INTERRUPT_STAT_1,
#[doc = "Break interrupt status is active."]
BREAK_INTERRUPT_STAT_2,
}
impl BIR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
BIR::BREAK_INTERRUPT_STAT_1 => false,
BIR::BREAK_INTERRUPT_STAT_2 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> BIR {
match value {
false => BIR::BREAK_INTERRUPT_STAT_1,
true => BIR::BREAK_INTERRUPT_STAT_2,
}
}
#[doc = "Checks if the value of the field is `BREAK_INTERRUPT_STAT_1`"]
#[inline]
pub fn is_break_interrupt_stat_1(&self) -> bool {
*self == BIR::BREAK_INTERRUPT_STAT_1
}
#[doc = "Checks if the value of the field is `BREAK_INTERRUPT_STAT_2`"]
#[inline]
pub fn is_break_interrupt_stat_2(&self) -> bool {
*self == BIR::BREAK_INTERRUPT_STAT_2
}
}
#[doc = "Possible values of the field `THRE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum THRER {
#[doc = "Not empty. THR contains valid data."]
NOT_EMPTY,
#[doc = "Empty. THR is empty."]
EMPTY,
}
impl THRER {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
THRER::NOT_EMPTY => false,
THRER::EMPTY => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> THRER {
match value {
false => THRER::NOT_EMPTY,
true => THRER::EMPTY,
}
}
#[doc = "Checks if the value of the field is `NOT_EMPTY`"]
#[inline]
pub fn is_not_empty(&self) -> bool {
*self == THRER::NOT_EMPTY
}
#[doc = "Checks if the value of the field is `EMPTY`"]
#[inline]
pub fn is_empty(&self) -> bool {
*self == THRER::EMPTY
}
}
#[doc = "Possible values of the field `TEMT`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TEMTR {
#[doc = "Not empty. THR and/or the TSR contains valid data."]
NOT_EMPTY,
#[doc = "Empty. THR and the TSR are empty."]
EMPTY,
}
impl TEMTR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
TEMTR::NOT_EMPTY => false,
TEMTR::EMPTY => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> TEMTR {
match value {
false => TEMTR::NOT_EMPTY,
true => TEMTR::EMPTY,
}
}
#[doc = "Checks if the value of the field is `NOT_EMPTY`"]
#[inline]
pub fn is_not_empty(&self) -> bool {
*self == TEMTR::NOT_EMPTY
}
#[doc = "Checks if the value of the field is `EMPTY`"]
#[inline]
pub fn is_empty(&self) -> bool {
*self == TEMTR::EMPTY
}
}
#[doc = "Possible values of the field `RXFE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RXFER {
#[doc = "No error. RBR contains no UART1 RX errors or FCR[0]=0."]
NO_ERROR,
#[doc = "Error. UART1 RBR contains at least one UART1 RX error."]
ERROR,
}
impl RXFER {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
RXFER::NO_ERROR => false,
RXFER::ERROR => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> RXFER {
match value {
false => RXFER::NO_ERROR,
true => RXFER::ERROR,
}
}
#[doc = "Checks if the value of the field is `NO_ERROR`"]
#[inline]
pub fn is_no_error(&self) -> bool {
*self == RXFER::NO_ERROR
}
#[doc = "Checks if the value of the field is `ERROR`"]
#[inline]
pub fn is_error(&self) -> bool {
*self == RXFER::ERROR
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bit 0 - Receiver Data Ready. LSR[0] is set when the RBR holds an unread character and is cleared when the UART1 RBR FIFO is empty."]
#[inline]
pub fn rdr(&self) -> RDRR {
RDRR::_from({
const MASK: bool = true;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 1 - Overrun Error. The overrun error condition is set as soon as it occurs. An LSR read clears LSR[1]. LSR[1] is set when UART1 RSR has a new character assembled and the UART1 RBR FIFO is full. In this case, the UART1 RBR FIFO will not be overwritten and the character in the UART1 RSR will be lost."]
#[inline]
pub fn oe(&self) -> OER {
OER::_from({
const MASK: bool = true;
const OFFSET: u8 = 1;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 2 - Parity Error. When the parity bit of a received character is in the wrong state, a parity error occurs. An LSR read clears LSR[2]. Time of parity error detection is dependent on FCR[0]. Note: A parity error is associated with the character at the top of the UART1 RBR FIFO."]
#[inline]
pub fn pe(&self) -> PER {
PER::_from({
const MASK: bool = true;
const OFFSET: u8 = 2;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 3 - Framing Error. When the stop bit of a received character is a logic 0, a framing error occurs. An LSR read clears LSR[3]. The time of the framing error detection is dependent on FCR0. Upon detection of a framing error, the RX will attempt to resynchronize to the data and assume that the bad stop bit is actually an early start bit. However, it cannot be assumed that the next received byte will be correct even if there is no Framing Error. Note: A framing error is associated with the character at the top of the UART1 RBR FIFO."]
#[inline]
pub fn fe(&self) -> FER {
FER::_from({
const MASK: bool = true;
const OFFSET: u8 = 3;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 4 - Break Interrupt. When RXD1 is held in the spacing state (all zeroes) for one full character transmission (start, data, parity, stop), a break interrupt occurs. Once the break condition has been detected, the receiver goes idle until RXD1 goes to marking state (all ones). An LSR read clears this status bit. The time of break detection is dependent on FCR[0]. Note: The break interrupt is associated with the character at the top of the UART1 RBR FIFO."]
#[inline]
pub fn bi(&self) -> BIR {
BIR::_from({
const MASK: bool = true;
const OFFSET: u8 = 4;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 5 - Transmitter Holding Register Empty. THRE is set immediately upon detection of an empty UART1 THR and is cleared on a THR write."]
#[inline]
pub fn thre(&self) -> THRER {
THRER::_from({
const MASK: bool = true;
const OFFSET: u8 = 5;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 6 - Transmitter Empty. TEMT is set when both THR and TSR are empty; TEMT is cleared when either the TSR or the THR contain valid data."]
#[inline]
pub fn temt(&self) -> TEMTR {
TEMTR::_from({
const MASK: bool = true;
const OFFSET: u8 = 6;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 7 - Error in RX FIFO. LSR[7] is set when a character with a RX error such as framing error, parity error or break interrupt, is loaded into the RBR. This bit is cleared when the LSR register is read and there are no subsequent errors in the UART1 FIFO."]
#[inline]
pub fn rxfe(&self) -> RXFER {
RXFER::_from({
const MASK: bool = true;
const OFFSET: u8 = 7;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
}