bl808_pac/uart/
interrupt_state.rs

1#[doc = "Register `interrupt_state` reader"]
2pub struct R(crate::R<INTERRUPT_STATE_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<INTERRUPT_STATE_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<INTERRUPT_STATE_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<INTERRUPT_STATE_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `transmit_transfer` reader - Transmit transfer finish signal raised"]
17pub use AUTO_BAUDRATE_FIVE_FIVE_R as TRANSMIT_TRANSFER_R;
18#[doc = "Field `receive_transfer` reader - Receive transfer finish signal raised"]
19pub use AUTO_BAUDRATE_FIVE_FIVE_R as RECEIVE_TRANSFER_R;
20#[doc = "Field `transmit_fifo_ready` reader - Transmit FIFO ready signal raised"]
21pub use AUTO_BAUDRATE_FIVE_FIVE_R as TRANSMIT_FIFO_READY_R;
22#[doc = "Field `receive_fifo_ready` reader - Receive FIFO ready signal raised"]
23pub use AUTO_BAUDRATE_FIVE_FIVE_R as RECEIVE_FIFO_READY_R;
24#[doc = "Field `receive_timeout` reader - Receive timed-out interrupt occurred"]
25pub use AUTO_BAUDRATE_FIVE_FIVE_R as RECEIVE_TIMEOUT_R;
26#[doc = "Field `receive_parity` reader - Receive parity check failure occurred"]
27pub use AUTO_BAUDRATE_FIVE_FIVE_R as RECEIVE_PARITY_R;
28#[doc = "Field `transmit_fifo_error` reader - Transmit FIFO overflow or underflow occurred"]
29pub use AUTO_BAUDRATE_FIVE_FIVE_R as TRANSMIT_FIFO_ERROR_R;
30#[doc = "Field `receive_fifo_error` reader - Receive FIFO overflow or underflow occurred"]
31pub use AUTO_BAUDRATE_FIVE_FIVE_R as RECEIVE_FIFO_ERROR_R;
32#[doc = "Field `receive_sync_error` reader - Receive LIN mode synchronization field error occurred"]
33pub use AUTO_BAUDRATE_FIVE_FIVE_R as RECEIVE_SYNC_ERROR_R;
34#[doc = "Field `receive_byte_count` reader - Receive byte count reached occurred"]
35pub use AUTO_BAUDRATE_FIVE_FIVE_R as RECEIVE_BYTE_COUNT_R;
36#[doc = "Field `auto_baudrate_start_bit` reader - Receive auto baudrate detection finished using start bit occurred"]
37pub use AUTO_BAUDRATE_FIVE_FIVE_R as AUTO_BAUDRATE_START_BIT_R;
38#[doc = "Field `auto_baudrate_five_five` reader - Receive auto baudrate detection finished using 0x55 occurred"]
39pub type AUTO_BAUDRATE_FIVE_FIVE_R = crate::BitReader<INTERRUPT_STATE_A>;
40#[doc = "Receive auto baudrate detection finished using 0x55 occurred\n\nValue on reset: 0"]
41#[derive(Clone, Copy, Debug, PartialEq, Eq)]
42pub enum INTERRUPT_STATE_A {
43    #[doc = "1: Has interrupt"]
44    HAS_INTERRUPT = 1,
45    #[doc = "0: No interrupt occurred"]
46    NO_INTERRUPT = 0,
47}
48impl From<INTERRUPT_STATE_A> for bool {
49    #[inline(always)]
50    fn from(variant: INTERRUPT_STATE_A) -> Self {
51        variant as u8 != 0
52    }
53}
54impl AUTO_BAUDRATE_FIVE_FIVE_R {
55    #[doc = "Get enumerated values variant"]
56    #[inline(always)]
57    pub fn variant(&self) -> INTERRUPT_STATE_A {
58        match self.bits {
59            true => INTERRUPT_STATE_A::HAS_INTERRUPT,
60            false => INTERRUPT_STATE_A::NO_INTERRUPT,
61        }
62    }
63    #[doc = "Checks if the value of the field is `HAS_INTERRUPT`"]
64    #[inline(always)]
65    pub fn is_has_interrupt(&self) -> bool {
66        *self == INTERRUPT_STATE_A::HAS_INTERRUPT
67    }
68    #[doc = "Checks if the value of the field is `NO_INTERRUPT`"]
69    #[inline(always)]
70    pub fn is_no_interrupt(&self) -> bool {
71        *self == INTERRUPT_STATE_A::NO_INTERRUPT
72    }
73}
74impl R {
75    #[doc = "Bit 0 - Transmit transfer finish signal raised"]
76    #[inline(always)]
77    pub fn transmit_transfer(&self) -> TRANSMIT_TRANSFER_R {
78        TRANSMIT_TRANSFER_R::new((self.bits & 1) != 0)
79    }
80    #[doc = "Bit 1 - Receive transfer finish signal raised"]
81    #[inline(always)]
82    pub fn receive_transfer(&self) -> RECEIVE_TRANSFER_R {
83        RECEIVE_TRANSFER_R::new(((self.bits >> 1) & 1) != 0)
84    }
85    #[doc = "Bit 2 - Transmit FIFO ready signal raised"]
86    #[inline(always)]
87    pub fn transmit_fifo_ready(&self) -> TRANSMIT_FIFO_READY_R {
88        TRANSMIT_FIFO_READY_R::new(((self.bits >> 2) & 1) != 0)
89    }
90    #[doc = "Bit 3 - Receive FIFO ready signal raised"]
91    #[inline(always)]
92    pub fn receive_fifo_ready(&self) -> RECEIVE_FIFO_READY_R {
93        RECEIVE_FIFO_READY_R::new(((self.bits >> 3) & 1) != 0)
94    }
95    #[doc = "Bit 4 - Receive timed-out interrupt occurred"]
96    #[inline(always)]
97    pub fn receive_timeout(&self) -> RECEIVE_TIMEOUT_R {
98        RECEIVE_TIMEOUT_R::new(((self.bits >> 4) & 1) != 0)
99    }
100    #[doc = "Bit 5 - Receive parity check failure occurred"]
101    #[inline(always)]
102    pub fn receive_parity(&self) -> RECEIVE_PARITY_R {
103        RECEIVE_PARITY_R::new(((self.bits >> 5) & 1) != 0)
104    }
105    #[doc = "Bit 6 - Transmit FIFO overflow or underflow occurred"]
106    #[inline(always)]
107    pub fn transmit_fifo_error(&self) -> TRANSMIT_FIFO_ERROR_R {
108        TRANSMIT_FIFO_ERROR_R::new(((self.bits >> 6) & 1) != 0)
109    }
110    #[doc = "Bit 7 - Receive FIFO overflow or underflow occurred"]
111    #[inline(always)]
112    pub fn receive_fifo_error(&self) -> RECEIVE_FIFO_ERROR_R {
113        RECEIVE_FIFO_ERROR_R::new(((self.bits >> 7) & 1) != 0)
114    }
115    #[doc = "Bit 8 - Receive LIN mode synchronization field error occurred"]
116    #[inline(always)]
117    pub fn receive_sync_error(&self) -> RECEIVE_SYNC_ERROR_R {
118        RECEIVE_SYNC_ERROR_R::new(((self.bits >> 8) & 1) != 0)
119    }
120    #[doc = "Bit 9 - Receive byte count reached occurred"]
121    #[inline(always)]
122    pub fn receive_byte_count(&self) -> RECEIVE_BYTE_COUNT_R {
123        RECEIVE_BYTE_COUNT_R::new(((self.bits >> 9) & 1) != 0)
124    }
125    #[doc = "Bit 10 - Receive auto baudrate detection finished using start bit occurred"]
126    #[inline(always)]
127    pub fn auto_baudrate_start_bit(&self) -> AUTO_BAUDRATE_START_BIT_R {
128        AUTO_BAUDRATE_START_BIT_R::new(((self.bits >> 10) & 1) != 0)
129    }
130    #[doc = "Bit 11 - Receive auto baudrate detection finished using 0x55 occurred"]
131    #[inline(always)]
132    pub fn auto_baudrate_five_five(&self) -> AUTO_BAUDRATE_FIVE_FIVE_R {
133        AUTO_BAUDRATE_FIVE_FIVE_R::new(((self.bits >> 11) & 1) != 0)
134    }
135}
136#[doc = "Interrupt state register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [interrupt_state](index.html) module"]
137pub struct INTERRUPT_STATE_SPEC;
138impl crate::RegisterSpec for INTERRUPT_STATE_SPEC {
139    type Ux = u32;
140}
141#[doc = "`read()` method returns [interrupt_state::R](R) reader structure"]
142impl crate::Readable for INTERRUPT_STATE_SPEC {
143    type Reader = R;
144}
145#[doc = "`reset()` method sets interrupt_state to value 0x04"]
146impl crate::Resettable for INTERRUPT_STATE_SPEC {
147    #[inline(always)]
148    fn reset_value() -> Self::Ux {
149        0x04
150    }
151}