avr_device/devices/atmega328p/fuse/
high.rs
1#[doc = "Register `HIGH` reader"]
2pub struct R(crate::R<HIGH_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<HIGH_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<HIGH_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<HIGH_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `HIGH` writer"]
17pub struct W(crate::W<HIGH_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<HIGH_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<HIGH_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<HIGH_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `BOOTRST` reader - Boot Reset vector Enabled"]
38pub type BOOTRST_R = crate::BitReader<bool>;
39#[doc = "Field `BOOTRST` writer - Boot Reset vector Enabled"]
40pub type BOOTRST_W<'a, const O: u8> = crate::BitWriter<'a, u8, HIGH_SPEC, bool, O>;
41#[doc = "Field `BOOTSZ` reader - Select boot size"]
42pub type BOOTSZ_R = crate::FieldReader<u8, BOOTSZ_A>;
43#[doc = "Select boot size\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45#[repr(u8)]
46pub enum BOOTSZ_A {
47 #[doc = "0: Boot Flash size=2048 words start address=$3800"]
48 _2048W_3800 = 0,
49 #[doc = "1: Boot Flash size=1024 words start address=$3C00"]
50 _1024W_3C00 = 1,
51 #[doc = "2: Boot Flash size=512 words start address=$3E00"]
52 _512W_3E00 = 2,
53 #[doc = "3: Boot Flash size=256 words start address=$3F00"]
54 _256W_3F00 = 3,
55}
56impl From<BOOTSZ_A> for u8 {
57 #[inline(always)]
58 fn from(variant: BOOTSZ_A) -> Self {
59 variant as _
60 }
61}
62impl BOOTSZ_R {
63 #[doc = "Get enumerated values variant"]
64 #[inline(always)]
65 pub fn variant(&self) -> BOOTSZ_A {
66 match self.bits {
67 0 => BOOTSZ_A::_2048W_3800,
68 1 => BOOTSZ_A::_1024W_3C00,
69 2 => BOOTSZ_A::_512W_3E00,
70 3 => BOOTSZ_A::_256W_3F00,
71 _ => unreachable!(),
72 }
73 }
74 #[doc = "Checks if the value of the field is `_2048W_3800`"]
75 #[inline(always)]
76 pub fn is_2048w_3800(&self) -> bool {
77 *self == BOOTSZ_A::_2048W_3800
78 }
79 #[doc = "Checks if the value of the field is `_1024W_3C00`"]
80 #[inline(always)]
81 pub fn is_1024w_3c00(&self) -> bool {
82 *self == BOOTSZ_A::_1024W_3C00
83 }
84 #[doc = "Checks if the value of the field is `_512W_3E00`"]
85 #[inline(always)]
86 pub fn is_512w_3e00(&self) -> bool {
87 *self == BOOTSZ_A::_512W_3E00
88 }
89 #[doc = "Checks if the value of the field is `_256W_3F00`"]
90 #[inline(always)]
91 pub fn is_256w_3f00(&self) -> bool {
92 *self == BOOTSZ_A::_256W_3F00
93 }
94}
95#[doc = "Field `BOOTSZ` writer - Select boot size"]
96pub type BOOTSZ_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, HIGH_SPEC, u8, BOOTSZ_A, 2, O>;
97impl<'a, const O: u8> BOOTSZ_W<'a, O> {
98 #[doc = "Boot Flash size=2048 words start address=$3800"]
99 #[inline(always)]
100 pub fn _2048w_3800(self) -> &'a mut W {
101 self.variant(BOOTSZ_A::_2048W_3800)
102 }
103 #[doc = "Boot Flash size=1024 words start address=$3C00"]
104 #[inline(always)]
105 pub fn _1024w_3c00(self) -> &'a mut W {
106 self.variant(BOOTSZ_A::_1024W_3C00)
107 }
108 #[doc = "Boot Flash size=512 words start address=$3E00"]
109 #[inline(always)]
110 pub fn _512w_3e00(self) -> &'a mut W {
111 self.variant(BOOTSZ_A::_512W_3E00)
112 }
113 #[doc = "Boot Flash size=256 words start address=$3F00"]
114 #[inline(always)]
115 pub fn _256w_3f00(self) -> &'a mut W {
116 self.variant(BOOTSZ_A::_256W_3F00)
117 }
118}
119#[doc = "Field `EESAVE` reader - Preserve EEPROM through the Chip Erase cycle"]
120pub type EESAVE_R = crate::BitReader<bool>;
121#[doc = "Field `EESAVE` writer - Preserve EEPROM through the Chip Erase cycle"]
122pub type EESAVE_W<'a, const O: u8> = crate::BitWriter<'a, u8, HIGH_SPEC, bool, O>;
123#[doc = "Field `WDTON` reader - Watch-dog Timer always on"]
124pub type WDTON_R = crate::BitReader<bool>;
125#[doc = "Field `WDTON` writer - Watch-dog Timer always on"]
126pub type WDTON_W<'a, const O: u8> = crate::BitWriter<'a, u8, HIGH_SPEC, bool, O>;
127#[doc = "Field `SPIEN` reader - Serial program downloading (SPI) enabled"]
128pub type SPIEN_R = crate::BitReader<bool>;
129#[doc = "Field `SPIEN` writer - Serial program downloading (SPI) enabled"]
130pub type SPIEN_W<'a, const O: u8> = crate::BitWriter<'a, u8, HIGH_SPEC, bool, O>;
131#[doc = "Field `DWEN` reader - Debug Wire enable"]
132pub type DWEN_R = crate::BitReader<bool>;
133#[doc = "Field `DWEN` writer - Debug Wire enable"]
134pub type DWEN_W<'a, const O: u8> = crate::BitWriter<'a, u8, HIGH_SPEC, bool, O>;
135#[doc = "Field `RSTDISBL` reader - Reset Disabled (Enable PC6 as i/o pin)"]
136pub type RSTDISBL_R = crate::BitReader<bool>;
137#[doc = "Field `RSTDISBL` writer - Reset Disabled (Enable PC6 as i/o pin)"]
138pub type RSTDISBL_W<'a, const O: u8> = crate::BitWriter<'a, u8, HIGH_SPEC, bool, O>;
139impl R {
140 #[doc = "Bit 0 - Boot Reset vector Enabled"]
141 #[inline(always)]
142 pub fn bootrst(&self) -> BOOTRST_R {
143 BOOTRST_R::new((self.bits & 1) != 0)
144 }
145 #[doc = "Bits 1:2 - Select boot size"]
146 #[inline(always)]
147 pub fn bootsz(&self) -> BOOTSZ_R {
148 BOOTSZ_R::new((self.bits >> 1) & 3)
149 }
150 #[doc = "Bit 3 - Preserve EEPROM through the Chip Erase cycle"]
151 #[inline(always)]
152 pub fn eesave(&self) -> EESAVE_R {
153 EESAVE_R::new(((self.bits >> 3) & 1) != 0)
154 }
155 #[doc = "Bit 4 - Watch-dog Timer always on"]
156 #[inline(always)]
157 pub fn wdton(&self) -> WDTON_R {
158 WDTON_R::new(((self.bits >> 4) & 1) != 0)
159 }
160 #[doc = "Bit 5 - Serial program downloading (SPI) enabled"]
161 #[inline(always)]
162 pub fn spien(&self) -> SPIEN_R {
163 SPIEN_R::new(((self.bits >> 5) & 1) != 0)
164 }
165 #[doc = "Bit 6 - Debug Wire enable"]
166 #[inline(always)]
167 pub fn dwen(&self) -> DWEN_R {
168 DWEN_R::new(((self.bits >> 6) & 1) != 0)
169 }
170 #[doc = "Bit 7 - Reset Disabled (Enable PC6 as i/o pin)"]
171 #[inline(always)]
172 pub fn rstdisbl(&self) -> RSTDISBL_R {
173 RSTDISBL_R::new(((self.bits >> 7) & 1) != 0)
174 }
175}
176impl W {
177 #[doc = "Bit 0 - Boot Reset vector Enabled"]
178 #[inline(always)]
179 #[must_use]
180 pub fn bootrst(&mut self) -> BOOTRST_W<0> {
181 BOOTRST_W::new(self)
182 }
183 #[doc = "Bits 1:2 - Select boot size"]
184 #[inline(always)]
185 #[must_use]
186 pub fn bootsz(&mut self) -> BOOTSZ_W<1> {
187 BOOTSZ_W::new(self)
188 }
189 #[doc = "Bit 3 - Preserve EEPROM through the Chip Erase cycle"]
190 #[inline(always)]
191 #[must_use]
192 pub fn eesave(&mut self) -> EESAVE_W<3> {
193 EESAVE_W::new(self)
194 }
195 #[doc = "Bit 4 - Watch-dog Timer always on"]
196 #[inline(always)]
197 #[must_use]
198 pub fn wdton(&mut self) -> WDTON_W<4> {
199 WDTON_W::new(self)
200 }
201 #[doc = "Bit 5 - Serial program downloading (SPI) enabled"]
202 #[inline(always)]
203 #[must_use]
204 pub fn spien(&mut self) -> SPIEN_W<5> {
205 SPIEN_W::new(self)
206 }
207 #[doc = "Bit 6 - Debug Wire enable"]
208 #[inline(always)]
209 #[must_use]
210 pub fn dwen(&mut self) -> DWEN_W<6> {
211 DWEN_W::new(self)
212 }
213 #[doc = "Bit 7 - Reset Disabled (Enable PC6 as i/o pin)"]
214 #[inline(always)]
215 #[must_use]
216 pub fn rstdisbl(&mut self) -> RSTDISBL_W<7> {
217 RSTDISBL_W::new(self)
218 }
219 #[doc = "Writes raw bits to the register."]
220 #[inline(always)]
221 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
222 self.0.bits(bits);
223 self
224 }
225}
226#[doc = "No Description.\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 [high](index.html) module"]
227pub struct HIGH_SPEC;
228impl crate::RegisterSpec for HIGH_SPEC {
229 type Ux = u8;
230}
231#[doc = "`read()` method returns [high::R](R) reader structure"]
232impl crate::Readable for HIGH_SPEC {
233 type Reader = R;
234}
235#[doc = "`write(|w| ..)` method takes [high::W](W) writer structure"]
236impl crate::Writable for HIGH_SPEC {
237 type Writer = W;
238 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
239 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
240}
241#[doc = "`reset()` method sets HIGH to value 0"]
242impl crate::Resettable for HIGH_SPEC {
243 const RESET_VALUE: Self::Ux = 0;
244}