bl808_pac/uart/
signal_override.rs

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