rsl10_pac/uart/
uart_status.rs

1#[doc = "Reader of register UART_STATUS"]
2pub type R = crate::R<u32, super::UART_STATUS>;
3#[doc = "Writer for register UART_STATUS"]
4pub type W = crate::W<u32, super::UART_STATUS>;
5#[doc = "Register UART_STATUS `reset()`'s with value 0"]
6impl crate::ResetValue for super::UART_STATUS {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Indicate that an overrun has occurred when receiving data on the UART interface\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum UART_RX_OVERRUN_STATUS_A {
16    #[doc = "0: No UART RX overrun detected"]
17    UART_RX_OVERRUN_FALSE = 0,
18    #[doc = "1: UART RX overrun detected"]
19    UART_RX_OVERRUN_TRUE = 1,
20}
21impl From<UART_RX_OVERRUN_STATUS_A> for bool {
22    #[inline(always)]
23    fn from(variant: UART_RX_OVERRUN_STATUS_A) -> Self {
24        variant as u8 != 0
25    }
26}
27#[doc = "Reader of field `UART_RX_OVERRUN_STATUS`"]
28pub type UART_RX_OVERRUN_STATUS_R = crate::R<bool, UART_RX_OVERRUN_STATUS_A>;
29impl UART_RX_OVERRUN_STATUS_R {
30    #[doc = r"Get enumerated values variant"]
31    #[inline(always)]
32    pub fn variant(&self) -> UART_RX_OVERRUN_STATUS_A {
33        match self.bits {
34            false => UART_RX_OVERRUN_STATUS_A::UART_RX_OVERRUN_FALSE,
35            true => UART_RX_OVERRUN_STATUS_A::UART_RX_OVERRUN_TRUE,
36        }
37    }
38    #[doc = "Checks if the value of the field is `UART_RX_OVERRUN_FALSE`"]
39    #[inline(always)]
40    pub fn is_uart_rx_overrun_false(&self) -> bool {
41        *self == UART_RX_OVERRUN_STATUS_A::UART_RX_OVERRUN_FALSE
42    }
43    #[doc = "Checks if the value of the field is `UART_RX_OVERRUN_TRUE`"]
44    #[inline(always)]
45    pub fn is_uart_rx_overrun_true(&self) -> bool {
46        *self == UART_RX_OVERRUN_STATUS_A::UART_RX_OVERRUN_TRUE
47    }
48}
49#[doc = "Write proxy for field `UART_RX_OVERRUN_STATUS`"]
50pub struct UART_RX_OVERRUN_STATUS_W<'a> {
51    w: &'a mut W,
52}
53impl<'a> UART_RX_OVERRUN_STATUS_W<'a> {
54    #[doc = r"Writes `variant` to the field"]
55    #[inline(always)]
56    pub fn variant(self, variant: UART_RX_OVERRUN_STATUS_A) -> &'a mut W {
57        {
58            self.bit(variant.into())
59        }
60    }
61    #[doc = "No UART RX overrun detected"]
62    #[inline(always)]
63    pub fn uart_rx_overrun_false(self) -> &'a mut W {
64        self.variant(UART_RX_OVERRUN_STATUS_A::UART_RX_OVERRUN_FALSE)
65    }
66    #[doc = "UART RX overrun detected"]
67    #[inline(always)]
68    pub fn uart_rx_overrun_true(self) -> &'a mut W {
69        self.variant(UART_RX_OVERRUN_STATUS_A::UART_RX_OVERRUN_TRUE)
70    }
71    #[doc = r"Sets the field bit"]
72    #[inline(always)]
73    pub fn set_bit(self) -> &'a mut W {
74        self.bit(true)
75    }
76    #[doc = r"Clears the field bit"]
77    #[inline(always)]
78    pub fn clear_bit(self) -> &'a mut W {
79        self.bit(false)
80    }
81    #[doc = r"Writes raw bits to the field"]
82    #[inline(always)]
83    pub fn bit(self, value: bool) -> &'a mut W {
84        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
85        self.w
86    }
87}
88impl R {
89    #[doc = "Bit 0 - Indicate that an overrun has occurred when receiving data on the UART interface"]
90    #[inline(always)]
91    pub fn uart_rx_overrun_status(&self) -> UART_RX_OVERRUN_STATUS_R {
92        UART_RX_OVERRUN_STATUS_R::new((self.bits & 0x01) != 0)
93    }
94}
95impl W {
96    #[doc = "Bit 0 - Indicate that an overrun has occurred when receiving data on the UART interface"]
97    #[inline(always)]
98    pub fn uart_rx_overrun_status(&mut self) -> UART_RX_OVERRUN_STATUS_W {
99        UART_RX_OVERRUN_STATUS_W { w: self }
100    }
101}