bl61x_pac/uart/
signal_override.rs

1#[doc = "Register `signal_override` reader"]
2pub type R = crate::R<SIGNAL_OVERRIDE_SPEC>;
3#[doc = "Register `signal_override` writer"]
4pub type W = crate::W<SIGNAL_OVERRIDE_SPEC>;
5#[doc = "Field `transmit_signal` reader - Enable manual override of transmit signal"]
6pub use RTS_SIGNAL_R as TRANSMIT_SIGNAL_R;
7#[doc = "Field `transmit_signal` writer - Enable manual override of transmit signal"]
8pub use RTS_SIGNAL_W as TRANSMIT_SIGNAL_W;
9#[doc = "Field `transmit_value` reader - Value to override transmit signal if override is enabled"]
10pub use RTS_VALUE_R as TRANSMIT_VALUE_R;
11#[doc = "Field `transmit_value` writer - Value to override transmit signal if override is enabled"]
12pub use RTS_VALUE_W as TRANSMIT_VALUE_W;
13#[doc = "Field `rts_signal` reader - Enable manual override of Request-to-Send flow control signal"]
14pub type RTS_SIGNAL_R = crate::BitReader<OVERRIDE_ENABLE_A>;
15#[doc = "Enable manual override of Request-to-Send flow control signal\n\nValue on reset: 0"]
16#[derive(Clone, Copy, Debug, PartialEq, Eq)]
17pub enum OVERRIDE_ENABLE_A {
18    #[doc = "1: Enable manual override of this signal"]
19    ENABLE = 1,
20    #[doc = "0: Disable manual override of this signal"]
21    DISABLE = 0,
22}
23impl From<OVERRIDE_ENABLE_A> for bool {
24    #[inline(always)]
25    fn from(variant: OVERRIDE_ENABLE_A) -> Self {
26        variant as u8 != 0
27    }
28}
29impl RTS_SIGNAL_R {
30    #[doc = "Get enumerated values variant"]
31    #[inline(always)]
32    pub const fn variant(&self) -> OVERRIDE_ENABLE_A {
33        match self.bits {
34            true => OVERRIDE_ENABLE_A::ENABLE,
35            false => OVERRIDE_ENABLE_A::DISABLE,
36        }
37    }
38    #[doc = "Enable manual override of this signal"]
39    #[inline(always)]
40    pub fn is_enable(&self) -> bool {
41        *self == OVERRIDE_ENABLE_A::ENABLE
42    }
43    #[doc = "Disable manual override of this signal"]
44    #[inline(always)]
45    pub fn is_disable(&self) -> bool {
46        *self == OVERRIDE_ENABLE_A::DISABLE
47    }
48}
49#[doc = "Field `rts_signal` writer - Enable manual override of Request-to-Send flow control signal"]
50pub type RTS_SIGNAL_W<'a, REG> = crate::BitWriter<'a, REG, OVERRIDE_ENABLE_A>;
51impl<'a, REG> RTS_SIGNAL_W<'a, REG>
52where
53    REG: crate::Writable + crate::RegisterSpec,
54{
55    #[doc = "Enable manual override of this signal"]
56    #[inline(always)]
57    pub fn enable(self) -> &'a mut crate::W<REG> {
58        self.variant(OVERRIDE_ENABLE_A::ENABLE)
59    }
60    #[doc = "Disable manual override of this signal"]
61    #[inline(always)]
62    pub fn disable(self) -> &'a mut crate::W<REG> {
63        self.variant(OVERRIDE_ENABLE_A::DISABLE)
64    }
65}
66#[doc = "Field `rts_value` reader - Value to override Request-to-Send signal if override is enabled"]
67pub type RTS_VALUE_R = crate::BitReader<SIGNAL_ASSERT_A>;
68#[doc = "Value to override Request-to-Send signal if override is enabled\n\nValue on reset: 0"]
69#[derive(Clone, Copy, Debug, PartialEq, Eq)]
70pub enum SIGNAL_ASSERT_A {
71    #[doc = "1: Assert this signal"]
72    HIGH = 1,
73    #[doc = "0: Deassert this signal"]
74    LOW = 0,
75}
76impl From<SIGNAL_ASSERT_A> for bool {
77    #[inline(always)]
78    fn from(variant: SIGNAL_ASSERT_A) -> Self {
79        variant as u8 != 0
80    }
81}
82impl RTS_VALUE_R {
83    #[doc = "Get enumerated values variant"]
84    #[inline(always)]
85    pub const fn variant(&self) -> SIGNAL_ASSERT_A {
86        match self.bits {
87            true => SIGNAL_ASSERT_A::HIGH,
88            false => SIGNAL_ASSERT_A::LOW,
89        }
90    }
91    #[doc = "Assert this signal"]
92    #[inline(always)]
93    pub fn is_high(&self) -> bool {
94        *self == SIGNAL_ASSERT_A::HIGH
95    }
96    #[doc = "Deassert this signal"]
97    #[inline(always)]
98    pub fn is_low(&self) -> bool {
99        *self == SIGNAL_ASSERT_A::LOW
100    }
101}
102#[doc = "Field `rts_value` writer - Value to override Request-to-Send signal if override is enabled"]
103pub type RTS_VALUE_W<'a, REG> = crate::BitWriter<'a, REG, SIGNAL_ASSERT_A>;
104impl<'a, REG> RTS_VALUE_W<'a, REG>
105where
106    REG: crate::Writable + crate::RegisterSpec,
107{
108    #[doc = "Assert this signal"]
109    #[inline(always)]
110    pub fn high(self) -> &'a mut crate::W<REG> {
111        self.variant(SIGNAL_ASSERT_A::HIGH)
112    }
113    #[doc = "Deassert this signal"]
114    #[inline(always)]
115    pub fn low(self) -> &'a mut crate::W<REG> {
116        self.variant(SIGNAL_ASSERT_A::LOW)
117    }
118}
119impl R {
120    #[doc = "Bit 0 - Enable manual override of transmit signal"]
121    #[inline(always)]
122    pub fn transmit_signal(&self) -> TRANSMIT_SIGNAL_R {
123        TRANSMIT_SIGNAL_R::new((self.bits & 1) != 0)
124    }
125    #[doc = "Bit 1 - Value to override transmit signal if override is enabled"]
126    #[inline(always)]
127    pub fn transmit_value(&self) -> TRANSMIT_VALUE_R {
128        TRANSMIT_VALUE_R::new(((self.bits >> 1) & 1) != 0)
129    }
130    #[doc = "Bit 2 - Enable manual override of Request-to-Send flow control signal"]
131    #[inline(always)]
132    pub fn rts_signal(&self) -> RTS_SIGNAL_R {
133        RTS_SIGNAL_R::new(((self.bits >> 2) & 1) != 0)
134    }
135    #[doc = "Bit 3 - Value to override Request-to-Send signal if override is enabled"]
136    #[inline(always)]
137    pub fn rts_value(&self) -> RTS_VALUE_R {
138        RTS_VALUE_R::new(((self.bits >> 3) & 1) != 0)
139    }
140}
141impl W {
142    #[doc = "Bit 0 - Enable manual override of transmit signal"]
143    #[inline(always)]
144    #[must_use]
145    pub fn transmit_signal(&mut self) -> TRANSMIT_SIGNAL_W<SIGNAL_OVERRIDE_SPEC> {
146        TRANSMIT_SIGNAL_W::new(self, 0)
147    }
148    #[doc = "Bit 1 - Value to override transmit signal if override is enabled"]
149    #[inline(always)]
150    #[must_use]
151    pub fn transmit_value(&mut self) -> TRANSMIT_VALUE_W<SIGNAL_OVERRIDE_SPEC> {
152        TRANSMIT_VALUE_W::new(self, 1)
153    }
154    #[doc = "Bit 2 - Enable manual override of Request-to-Send flow control signal"]
155    #[inline(always)]
156    #[must_use]
157    pub fn rts_signal(&mut self) -> RTS_SIGNAL_W<SIGNAL_OVERRIDE_SPEC> {
158        RTS_SIGNAL_W::new(self, 2)
159    }
160    #[doc = "Bit 3 - Value to override Request-to-Send signal if override is enabled"]
161    #[inline(always)]
162    #[must_use]
163    pub fn rts_value(&mut self) -> RTS_VALUE_W<SIGNAL_OVERRIDE_SPEC> {
164        RTS_VALUE_W::new(self, 3)
165    }
166    #[doc = r" Writes raw bits to the register."]
167    #[doc = r""]
168    #[doc = r" # Safety"]
169    #[doc = r""]
170    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
171    #[inline(always)]
172    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
173        self.bits = bits;
174        self
175    }
176}
177#[doc = "Manual override of flow control signal\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`signal_override::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`signal_override::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
178pub struct SIGNAL_OVERRIDE_SPEC;
179impl crate::RegisterSpec for SIGNAL_OVERRIDE_SPEC {
180    type Ux = u32;
181}
182#[doc = "`read()` method returns [`signal_override::R`](R) reader structure"]
183impl crate::Readable for SIGNAL_OVERRIDE_SPEC {}
184#[doc = "`write(|w| ..)` method takes [`signal_override::W`](W) writer structure"]
185impl crate::Writable for SIGNAL_OVERRIDE_SPEC {
186    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
187    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
188}
189#[doc = "`reset()` method sets signal_override to value 0"]
190impl crate::Resettable for SIGNAL_OVERRIDE_SPEC {
191    const RESET_VALUE: Self::Ux = 0;
192}