avr_device/devices/attiny85/fuse/
high.rs1#[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 `BODLEVEL` reader - Brown-out Detector trigger level"]
38pub type BODLEVEL_R = crate::FieldReader<u8, BODLEVEL_A>;
39#[doc = "Brown-out Detector trigger level\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum BODLEVEL_A {
43 #[doc = "4: Brown-out detection at VCC=4.3 V"]
44 _4V3 = 4,
45 #[doc = "5: Brown-out detection at VCC=2.7 V"]
46 _2V7 = 5,
47 #[doc = "6: Brown-out detection at VCC=1.8 V"]
48 _1V8 = 6,
49 #[doc = "7: Brown-out detection disabled"]
50 DISABLED = 7,
51}
52impl From<BODLEVEL_A> for u8 {
53 #[inline(always)]
54 fn from(variant: BODLEVEL_A) -> Self {
55 variant as _
56 }
57}
58impl BODLEVEL_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> Option<BODLEVEL_A> {
62 match self.bits {
63 4 => Some(BODLEVEL_A::_4V3),
64 5 => Some(BODLEVEL_A::_2V7),
65 6 => Some(BODLEVEL_A::_1V8),
66 7 => Some(BODLEVEL_A::DISABLED),
67 _ => None,
68 }
69 }
70 #[doc = "Checks if the value of the field is `_4V3`"]
71 #[inline(always)]
72 pub fn is_4v3(&self) -> bool {
73 *self == BODLEVEL_A::_4V3
74 }
75 #[doc = "Checks if the value of the field is `_2V7`"]
76 #[inline(always)]
77 pub fn is_2v7(&self) -> bool {
78 *self == BODLEVEL_A::_2V7
79 }
80 #[doc = "Checks if the value of the field is `_1V8`"]
81 #[inline(always)]
82 pub fn is_1v8(&self) -> bool {
83 *self == BODLEVEL_A::_1V8
84 }
85 #[doc = "Checks if the value of the field is `DISABLED`"]
86 #[inline(always)]
87 pub fn is_disabled(&self) -> bool {
88 *self == BODLEVEL_A::DISABLED
89 }
90}
91#[doc = "Field `BODLEVEL` writer - Brown-out Detector trigger level"]
92pub type BODLEVEL_W<'a, const O: u8> = crate::FieldWriter<'a, u8, HIGH_SPEC, u8, BODLEVEL_A, 3, O>;
93impl<'a, const O: u8> BODLEVEL_W<'a, O> {
94 #[doc = "Brown-out detection at VCC=4.3 V"]
95 #[inline(always)]
96 pub fn _4v3(self) -> &'a mut W {
97 self.variant(BODLEVEL_A::_4V3)
98 }
99 #[doc = "Brown-out detection at VCC=2.7 V"]
100 #[inline(always)]
101 pub fn _2v7(self) -> &'a mut W {
102 self.variant(BODLEVEL_A::_2V7)
103 }
104 #[doc = "Brown-out detection at VCC=1.8 V"]
105 #[inline(always)]
106 pub fn _1v8(self) -> &'a mut W {
107 self.variant(BODLEVEL_A::_1V8)
108 }
109 #[doc = "Brown-out detection disabled"]
110 #[inline(always)]
111 pub fn disabled(self) -> &'a mut W {
112 self.variant(BODLEVEL_A::DISABLED)
113 }
114}
115#[doc = "Field `EESAVE` reader - Preserve EEPROM through the Chip Erase cycle"]
116pub type EESAVE_R = crate::BitReader<bool>;
117#[doc = "Field `EESAVE` writer - Preserve EEPROM through the Chip Erase cycle"]
118pub type EESAVE_W<'a, const O: u8> = crate::BitWriter<'a, u8, HIGH_SPEC, bool, O>;
119#[doc = "Field `WDTON` reader - Watch-dog Timer always on"]
120pub type WDTON_R = crate::BitReader<bool>;
121#[doc = "Field `WDTON` writer - Watch-dog Timer always on"]
122pub type WDTON_W<'a, const O: u8> = crate::BitWriter<'a, u8, HIGH_SPEC, bool, O>;
123#[doc = "Field `SPIEN` reader - Serial program downloading (SPI) enabled"]
124pub type SPIEN_R = crate::BitReader<bool>;
125#[doc = "Field `SPIEN` writer - Serial program downloading (SPI) enabled"]
126pub type SPIEN_W<'a, const O: u8> = crate::BitWriter<'a, u8, HIGH_SPEC, bool, O>;
127#[doc = "Field `DWEN` reader - Debug Wire enable"]
128pub type DWEN_R = crate::BitReader<bool>;
129#[doc = "Field `DWEN` writer - Debug Wire enable"]
130pub type DWEN_W<'a, const O: u8> = crate::BitWriter<'a, u8, HIGH_SPEC, bool, O>;
131#[doc = "Field `RSTDISBL` reader - Reset Disabled (Enable PB5 as i/o pin)"]
132pub type RSTDISBL_R = crate::BitReader<bool>;
133#[doc = "Field `RSTDISBL` writer - Reset Disabled (Enable PB5 as i/o pin)"]
134pub type RSTDISBL_W<'a, const O: u8> = crate::BitWriter<'a, u8, HIGH_SPEC, bool, O>;
135impl R {
136 #[doc = "Bits 0:2 - Brown-out Detector trigger level"]
137 #[inline(always)]
138 pub fn bodlevel(&self) -> BODLEVEL_R {
139 BODLEVEL_R::new(self.bits & 7)
140 }
141 #[doc = "Bit 3 - Preserve EEPROM through the Chip Erase cycle"]
142 #[inline(always)]
143 pub fn eesave(&self) -> EESAVE_R {
144 EESAVE_R::new(((self.bits >> 3) & 1) != 0)
145 }
146 #[doc = "Bit 4 - Watch-dog Timer always on"]
147 #[inline(always)]
148 pub fn wdton(&self) -> WDTON_R {
149 WDTON_R::new(((self.bits >> 4) & 1) != 0)
150 }
151 #[doc = "Bit 5 - Serial program downloading (SPI) enabled"]
152 #[inline(always)]
153 pub fn spien(&self) -> SPIEN_R {
154 SPIEN_R::new(((self.bits >> 5) & 1) != 0)
155 }
156 #[doc = "Bit 6 - Debug Wire enable"]
157 #[inline(always)]
158 pub fn dwen(&self) -> DWEN_R {
159 DWEN_R::new(((self.bits >> 6) & 1) != 0)
160 }
161 #[doc = "Bit 7 - Reset Disabled (Enable PB5 as i/o pin)"]
162 #[inline(always)]
163 pub fn rstdisbl(&self) -> RSTDISBL_R {
164 RSTDISBL_R::new(((self.bits >> 7) & 1) != 0)
165 }
166}
167impl W {
168 #[doc = "Bits 0:2 - Brown-out Detector trigger level"]
169 #[inline(always)]
170 #[must_use]
171 pub fn bodlevel(&mut self) -> BODLEVEL_W<0> {
172 BODLEVEL_W::new(self)
173 }
174 #[doc = "Bit 3 - Preserve EEPROM through the Chip Erase cycle"]
175 #[inline(always)]
176 #[must_use]
177 pub fn eesave(&mut self) -> EESAVE_W<3> {
178 EESAVE_W::new(self)
179 }
180 #[doc = "Bit 4 - Watch-dog Timer always on"]
181 #[inline(always)]
182 #[must_use]
183 pub fn wdton(&mut self) -> WDTON_W<4> {
184 WDTON_W::new(self)
185 }
186 #[doc = "Bit 5 - Serial program downloading (SPI) enabled"]
187 #[inline(always)]
188 #[must_use]
189 pub fn spien(&mut self) -> SPIEN_W<5> {
190 SPIEN_W::new(self)
191 }
192 #[doc = "Bit 6 - Debug Wire enable"]
193 #[inline(always)]
194 #[must_use]
195 pub fn dwen(&mut self) -> DWEN_W<6> {
196 DWEN_W::new(self)
197 }
198 #[doc = "Bit 7 - Reset Disabled (Enable PB5 as i/o pin)"]
199 #[inline(always)]
200 #[must_use]
201 pub fn rstdisbl(&mut self) -> RSTDISBL_W<7> {
202 RSTDISBL_W::new(self)
203 }
204 #[doc = "Writes raw bits to the register."]
205 #[inline(always)]
206 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
207 self.0.bits(bits);
208 self
209 }
210}
211#[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"]
212pub struct HIGH_SPEC;
213impl crate::RegisterSpec for HIGH_SPEC {
214 type Ux = u8;
215}
216#[doc = "`read()` method returns [high::R](R) reader structure"]
217impl crate::Readable for HIGH_SPEC {
218 type Reader = R;
219}
220#[doc = "`write(|w| ..)` method takes [high::W](W) writer structure"]
221impl crate::Writable for HIGH_SPEC {
222 type Writer = W;
223 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
224 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
225}
226#[doc = "`reset()` method sets HIGH to value 0"]
227impl crate::Resettable for HIGH_SPEC {
228 const RESET_VALUE: Self::Ux = 0;
229}