Skip to main content

ra2e2/i3c/
prsst.rs

1#[doc = "Register `PRSST` reader"]
2pub struct R(crate::R<PRSST_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PRSST_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PRSST_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PRSST_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PRSST` writer"]
17pub struct W(crate::W<PRSST_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PRSST_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<PRSST_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PRSST_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CRMS` reader - Current Master"]
38pub type CRMS_R = crate::BitReader<CRMS_A>;
39#[doc = "Current Master\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum CRMS_A {
42    #[doc = "0: The Master is not the Current Master, and must request and acquire bus ownership before initiating any transfer."]
43    _0 = 0,
44    #[doc = "1: The Master is the Current Master, and as a result can initiate transfers."]
45    _1 = 1,
46}
47impl From<CRMS_A> for bool {
48    #[inline(always)]
49    fn from(variant: CRMS_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl CRMS_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> CRMS_A {
57        match self.bits {
58            false => CRMS_A::_0,
59            true => CRMS_A::_1,
60        }
61    }
62    #[doc = "Checks if the value of the field is `_0`"]
63    #[inline(always)]
64    pub fn is_0(&self) -> bool {
65        *self == CRMS_A::_0
66    }
67    #[doc = "Checks if the value of the field is `_1`"]
68    #[inline(always)]
69    pub fn is_1(&self) -> bool {
70        *self == CRMS_A::_1
71    }
72}
73#[doc = "Field `CRMS` writer - Current Master"]
74pub type CRMS_W<'a, const O: u8> = crate::BitWriter<'a, u32, PRSST_SPEC, CRMS_A, O>;
75impl<'a, const O: u8> CRMS_W<'a, O> {
76    #[doc = "The Master is not the Current Master, and must request and acquire bus ownership before initiating any transfer."]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(CRMS_A::_0)
80    }
81    #[doc = "The Master is the Current Master, and as a result can initiate transfers."]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(CRMS_A::_1)
85    }
86}
87#[doc = "Field `TRMD` reader - Transmit/Receive Mode"]
88pub type TRMD_R = crate::BitReader<TRMD_A>;
89#[doc = "Transmit/Receive Mode\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum TRMD_A {
92    #[doc = "0: Receive mode"]
93    _0 = 0,
94    #[doc = "1: Transmit mode"]
95    _1 = 1,
96}
97impl From<TRMD_A> for bool {
98    #[inline(always)]
99    fn from(variant: TRMD_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl TRMD_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> TRMD_A {
107        match self.bits {
108            false => TRMD_A::_0,
109            true => TRMD_A::_1,
110        }
111    }
112    #[doc = "Checks if the value of the field is `_0`"]
113    #[inline(always)]
114    pub fn is_0(&self) -> bool {
115        *self == TRMD_A::_0
116    }
117    #[doc = "Checks if the value of the field is `_1`"]
118    #[inline(always)]
119    pub fn is_1(&self) -> bool {
120        *self == TRMD_A::_1
121    }
122}
123#[doc = "Present State Write Protect\n\nValue on reset: 0"]
124#[derive(Clone, Copy, Debug, PartialEq, Eq)]
125pub enum PRSSTWP_AW {
126    #[doc = "0: CRMS bit is protected."]
127    _0 = 0,
128    #[doc = "1: CRMS bit can be written when writing simultaneously with the value of the target bit."]
129    _1 = 1,
130}
131impl From<PRSSTWP_AW> for bool {
132    #[inline(always)]
133    fn from(variant: PRSSTWP_AW) -> Self {
134        variant as u8 != 0
135    }
136}
137#[doc = "Field `PRSSTWP` writer - Present State Write Protect"]
138pub type PRSSTWP_W<'a, const O: u8> = crate::BitWriter<'a, u32, PRSST_SPEC, PRSSTWP_AW, O>;
139impl<'a, const O: u8> PRSSTWP_W<'a, O> {
140    #[doc = "CRMS bit is protected."]
141    #[inline(always)]
142    pub fn _0(self) -> &'a mut W {
143        self.variant(PRSSTWP_AW::_0)
144    }
145    #[doc = "CRMS bit can be written when writing simultaneously with the value of the target bit."]
146    #[inline(always)]
147    pub fn _1(self) -> &'a mut W {
148        self.variant(PRSSTWP_AW::_1)
149    }
150}
151impl R {
152    #[doc = "Bit 2 - Current Master"]
153    #[inline(always)]
154    pub fn crms(&self) -> CRMS_R {
155        CRMS_R::new(((self.bits >> 2) & 1) != 0)
156    }
157    #[doc = "Bit 4 - Transmit/Receive Mode"]
158    #[inline(always)]
159    pub fn trmd(&self) -> TRMD_R {
160        TRMD_R::new(((self.bits >> 4) & 1) != 0)
161    }
162}
163impl W {
164    #[doc = "Bit 2 - Current Master"]
165    #[inline(always)]
166    #[must_use]
167    pub fn crms(&mut self) -> CRMS_W<2> {
168        CRMS_W::new(self)
169    }
170    #[doc = "Bit 7 - Present State Write Protect"]
171    #[inline(always)]
172    #[must_use]
173    pub fn prsstwp(&mut self) -> PRSSTWP_W<7> {
174        PRSSTWP_W::new(self)
175    }
176    #[doc = "Writes raw bits to the register."]
177    #[inline(always)]
178    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
179        self.0.bits(bits);
180        self
181    }
182}
183#[doc = "Present State Register\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 [prsst](index.html) module"]
184pub struct PRSST_SPEC;
185impl crate::RegisterSpec for PRSST_SPEC {
186    type Ux = u32;
187}
188#[doc = "`read()` method returns [prsst::R](R) reader structure"]
189impl crate::Readable for PRSST_SPEC {
190    type Reader = R;
191}
192#[doc = "`write(|w| ..)` method takes [prsst::W](W) writer structure"]
193impl crate::Writable for PRSST_SPEC {
194    type Writer = W;
195    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
196    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
197}
198#[doc = "`reset()` method sets PRSST to value 0"]
199impl crate::Resettable for PRSST_SPEC {
200    const RESET_VALUE: Self::Ux = 0;
201}