lpc55_pac/flash_key_store/
sbkey_header1.rs

1#[doc = "Register `SBKEY_HEADER1` reader"]
2pub struct R(crate::R<SBKEY_HEADER1_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SBKEY_HEADER1_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SBKEY_HEADER1_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SBKEY_HEADER1_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SBKEY_HEADER1` writer"]
17pub struct W(crate::W<SBKEY_HEADER1_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SBKEY_HEADER1_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<SBKEY_HEADER1_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SBKEY_HEADER1_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TYPE` reader - ."]
38pub struct TYPE_R(crate::FieldReader<u8, u8>);
39impl TYPE_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: u8) -> Self {
42        TYPE_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for TYPE_R {
46    type Target = crate::FieldReader<u8, u8>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `TYPE` writer - ."]
53pub struct TYPE_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> TYPE_W<'a> {
57    #[doc = r"Writes raw bits to the field"]
58    #[inline(always)]
59    pub unsafe fn bits(self, value: u8) -> &'a mut W {
60        self.w.bits = (self.w.bits & !0x03) | (value as u32 & 0x03);
61        self.w
62    }
63}
64#[doc = "Field `INDEX` reader - ."]
65pub struct INDEX_R(crate::FieldReader<u8, u8>);
66impl INDEX_R {
67    #[inline(always)]
68    pub(crate) fn new(bits: u8) -> Self {
69        INDEX_R(crate::FieldReader::new(bits))
70    }
71}
72impl core::ops::Deref for INDEX_R {
73    type Target = crate::FieldReader<u8, u8>;
74    #[inline(always)]
75    fn deref(&self) -> &Self::Target {
76        &self.0
77    }
78}
79#[doc = "Field `INDEX` writer - ."]
80pub struct INDEX_W<'a> {
81    w: &'a mut W,
82}
83impl<'a> INDEX_W<'a> {
84    #[doc = r"Writes raw bits to the field"]
85    #[inline(always)]
86    pub unsafe fn bits(self, value: u8) -> &'a mut W {
87        self.w.bits = (self.w.bits & !(0x0f << 8)) | ((value as u32 & 0x0f) << 8);
88        self.w
89    }
90}
91#[doc = "Field `SIZE` reader - ."]
92pub struct SIZE_R(crate::FieldReader<u8, u8>);
93impl SIZE_R {
94    #[inline(always)]
95    pub(crate) fn new(bits: u8) -> Self {
96        SIZE_R(crate::FieldReader::new(bits))
97    }
98}
99impl core::ops::Deref for SIZE_R {
100    type Target = crate::FieldReader<u8, u8>;
101    #[inline(always)]
102    fn deref(&self) -> &Self::Target {
103        &self.0
104    }
105}
106#[doc = "Field `SIZE` writer - ."]
107pub struct SIZE_W<'a> {
108    w: &'a mut W,
109}
110impl<'a> SIZE_W<'a> {
111    #[doc = r"Writes raw bits to the field"]
112    #[inline(always)]
113    pub unsafe fn bits(self, value: u8) -> &'a mut W {
114        self.w.bits = (self.w.bits & !(0x3f << 24)) | ((value as u32 & 0x3f) << 24);
115        self.w
116    }
117}
118impl R {
119    #[doc = "Bits 0:1 - ."]
120    #[inline(always)]
121    pub fn type_(&self) -> TYPE_R {
122        TYPE_R::new((self.bits & 0x03) as u8)
123    }
124    #[doc = "Bits 8:11 - ."]
125    #[inline(always)]
126    pub fn index(&self) -> INDEX_R {
127        INDEX_R::new(((self.bits >> 8) & 0x0f) as u8)
128    }
129    #[doc = "Bits 24:29 - ."]
130    #[inline(always)]
131    pub fn size(&self) -> SIZE_R {
132        SIZE_R::new(((self.bits >> 24) & 0x3f) as u8)
133    }
134}
135impl W {
136    #[doc = "Bits 0:1 - ."]
137    #[inline(always)]
138    pub fn type_(&mut self) -> TYPE_W {
139        TYPE_W { w: self }
140    }
141    #[doc = "Bits 8:11 - ."]
142    #[inline(always)]
143    pub fn index(&mut self) -> INDEX_W {
144        INDEX_W { w: self }
145    }
146    #[doc = "Bits 24:29 - ."]
147    #[inline(always)]
148    pub fn size(&mut self) -> SIZE_W {
149        SIZE_W { w: self }
150    }
151    #[doc = "Writes raw bits to the register."]
152    #[inline(always)]
153    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
154        self.0.bits(bits);
155        self
156    }
157}
158#[doc = ".\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 [sbkey_header1](index.html) module"]
159pub struct SBKEY_HEADER1_SPEC;
160impl crate::RegisterSpec for SBKEY_HEADER1_SPEC {
161    type Ux = u32;
162}
163#[doc = "`read()` method returns [sbkey_header1::R](R) reader structure"]
164impl crate::Readable for SBKEY_HEADER1_SPEC {
165    type Reader = R;
166}
167#[doc = "`write(|w| ..)` method takes [sbkey_header1::W](W) writer structure"]
168impl crate::Writable for SBKEY_HEADER1_SPEC {
169    type Writer = W;
170}
171#[doc = "`reset()` method sets SBKEY_HEADER1 to value 0"]
172impl crate::Resettable for SBKEY_HEADER1_SPEC {
173    #[inline(always)]
174    fn reset_value() -> Self::Ux {
175        0
176    }
177}