ra2l1/flcn/
fexcr.rs

1#[doc = "Register `FEXCR` reader"]
2pub struct R(crate::R<FEXCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<FEXCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<FEXCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<FEXCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `FEXCR` writer"]
17pub struct W(crate::W<FEXCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<FEXCR_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<FEXCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<FEXCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CMD` reader - Software Command Setting"]
38pub type CMD_R = crate::FieldReader<u8, CMD_A>;
39#[doc = "Software Command Setting\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum CMD_A {
43    #[doc = "2: Access window information program Startup area selection and security setting"]
44    _010 = 2,
45    #[doc = "3: OCDID1 program"]
46    _011 = 3,
47    #[doc = "4: OCDID2 program"]
48    _100 = 4,
49    #[doc = "5: OCDID3 program"]
50    _101 = 5,
51    #[doc = "6: OCDID4 program"]
52    _110 = 6,
53}
54impl From<CMD_A> for u8 {
55    #[inline(always)]
56    fn from(variant: CMD_A) -> Self {
57        variant as _
58    }
59}
60impl CMD_R {
61    #[doc = "Get enumerated values variant"]
62    #[inline(always)]
63    pub fn variant(&self) -> Option<CMD_A> {
64        match self.bits {
65            2 => Some(CMD_A::_010),
66            3 => Some(CMD_A::_011),
67            4 => Some(CMD_A::_100),
68            5 => Some(CMD_A::_101),
69            6 => Some(CMD_A::_110),
70            _ => None,
71        }
72    }
73    #[doc = "Checks if the value of the field is `_010`"]
74    #[inline(always)]
75    pub fn is_010(&self) -> bool {
76        *self == CMD_A::_010
77    }
78    #[doc = "Checks if the value of the field is `_011`"]
79    #[inline(always)]
80    pub fn is_011(&self) -> bool {
81        *self == CMD_A::_011
82    }
83    #[doc = "Checks if the value of the field is `_100`"]
84    #[inline(always)]
85    pub fn is_100(&self) -> bool {
86        *self == CMD_A::_100
87    }
88    #[doc = "Checks if the value of the field is `_101`"]
89    #[inline(always)]
90    pub fn is_101(&self) -> bool {
91        *self == CMD_A::_101
92    }
93    #[doc = "Checks if the value of the field is `_110`"]
94    #[inline(always)]
95    pub fn is_110(&self) -> bool {
96        *self == CMD_A::_110
97    }
98}
99#[doc = "Field `CMD` writer - Software Command Setting"]
100pub type CMD_W<'a, const O: u8> = crate::FieldWriter<'a, u8, FEXCR_SPEC, u8, CMD_A, 3, O>;
101impl<'a, const O: u8> CMD_W<'a, O> {
102    #[doc = "Access window information program Startup area selection and security setting"]
103    #[inline(always)]
104    pub fn _010(self) -> &'a mut W {
105        self.variant(CMD_A::_010)
106    }
107    #[doc = "OCDID1 program"]
108    #[inline(always)]
109    pub fn _011(self) -> &'a mut W {
110        self.variant(CMD_A::_011)
111    }
112    #[doc = "OCDID2 program"]
113    #[inline(always)]
114    pub fn _100(self) -> &'a mut W {
115        self.variant(CMD_A::_100)
116    }
117    #[doc = "OCDID3 program"]
118    #[inline(always)]
119    pub fn _101(self) -> &'a mut W {
120        self.variant(CMD_A::_101)
121    }
122    #[doc = "OCDID4 program"]
123    #[inline(always)]
124    pub fn _110(self) -> &'a mut W {
125        self.variant(CMD_A::_110)
126    }
127}
128#[doc = "Field `OPST` reader - Processing Start"]
129pub type OPST_R = crate::BitReader<OPST_A>;
130#[doc = "Processing Start\n\nValue on reset: 0"]
131#[derive(Clone, Copy, Debug, PartialEq, Eq)]
132pub enum OPST_A {
133    #[doc = "0: Processing stops"]
134    _0 = 0,
135    #[doc = "1: Processing starts."]
136    _1 = 1,
137}
138impl From<OPST_A> for bool {
139    #[inline(always)]
140    fn from(variant: OPST_A) -> Self {
141        variant as u8 != 0
142    }
143}
144impl OPST_R {
145    #[doc = "Get enumerated values variant"]
146    #[inline(always)]
147    pub fn variant(&self) -> OPST_A {
148        match self.bits {
149            false => OPST_A::_0,
150            true => OPST_A::_1,
151        }
152    }
153    #[doc = "Checks if the value of the field is `_0`"]
154    #[inline(always)]
155    pub fn is_0(&self) -> bool {
156        *self == OPST_A::_0
157    }
158    #[doc = "Checks if the value of the field is `_1`"]
159    #[inline(always)]
160    pub fn is_1(&self) -> bool {
161        *self == OPST_A::_1
162    }
163}
164#[doc = "Field `OPST` writer - Processing Start"]
165pub type OPST_W<'a, const O: u8> = crate::BitWriter<'a, u8, FEXCR_SPEC, OPST_A, O>;
166impl<'a, const O: u8> OPST_W<'a, O> {
167    #[doc = "Processing stops"]
168    #[inline(always)]
169    pub fn _0(self) -> &'a mut W {
170        self.variant(OPST_A::_0)
171    }
172    #[doc = "Processing starts."]
173    #[inline(always)]
174    pub fn _1(self) -> &'a mut W {
175        self.variant(OPST_A::_1)
176    }
177}
178impl R {
179    #[doc = "Bits 0:2 - Software Command Setting"]
180    #[inline(always)]
181    pub fn cmd(&self) -> CMD_R {
182        CMD_R::new(self.bits & 7)
183    }
184    #[doc = "Bit 7 - Processing Start"]
185    #[inline(always)]
186    pub fn opst(&self) -> OPST_R {
187        OPST_R::new(((self.bits >> 7) & 1) != 0)
188    }
189}
190impl W {
191    #[doc = "Bits 0:2 - Software Command Setting"]
192    #[inline(always)]
193    #[must_use]
194    pub fn cmd(&mut self) -> CMD_W<0> {
195        CMD_W::new(self)
196    }
197    #[doc = "Bit 7 - Processing Start"]
198    #[inline(always)]
199    #[must_use]
200    pub fn opst(&mut self) -> OPST_W<7> {
201        OPST_W::new(self)
202    }
203    #[doc = "Writes raw bits to the register."]
204    #[inline(always)]
205    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
206        self.0.bits(bits);
207        self
208    }
209}
210#[doc = "Flash Extra Area Control 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 [fexcr](index.html) module"]
211pub struct FEXCR_SPEC;
212impl crate::RegisterSpec for FEXCR_SPEC {
213    type Ux = u8;
214}
215#[doc = "`read()` method returns [fexcr::R](R) reader structure"]
216impl crate::Readable for FEXCR_SPEC {
217    type Reader = R;
218}
219#[doc = "`write(|w| ..)` method takes [fexcr::W](W) writer structure"]
220impl crate::Writable for FEXCR_SPEC {
221    type Writer = W;
222    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
223    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
224}
225#[doc = "`reset()` method sets FEXCR to value 0"]
226impl crate::Resettable for FEXCR_SPEC {
227    const RESET_VALUE: Self::Ux = 0;
228}