avr_device/devices/atmega328p/fuse/
extended.rs1#[doc = "Register `EXTENDED` reader"]
2pub struct R(crate::R<EXTENDED_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<EXTENDED_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<EXTENDED_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<EXTENDED_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `EXTENDED` writer"]
17pub struct W(crate::W<EXTENDED_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<EXTENDED_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<EXTENDED_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<EXTENDED_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> =
93 crate::FieldWriter<'a, u8, EXTENDED_SPEC, u8, BODLEVEL_A, 3, O>;
94impl<'a, const O: u8> BODLEVEL_W<'a, O> {
95 #[doc = "Brown-out detection at VCC=4.3 V"]
96 #[inline(always)]
97 pub fn _4v3(self) -> &'a mut W {
98 self.variant(BODLEVEL_A::_4V3)
99 }
100 #[doc = "Brown-out detection at VCC=2.7 V"]
101 #[inline(always)]
102 pub fn _2v7(self) -> &'a mut W {
103 self.variant(BODLEVEL_A::_2V7)
104 }
105 #[doc = "Brown-out detection at VCC=1.8 V"]
106 #[inline(always)]
107 pub fn _1v8(self) -> &'a mut W {
108 self.variant(BODLEVEL_A::_1V8)
109 }
110 #[doc = "Brown-out detection disabled"]
111 #[inline(always)]
112 pub fn disabled(self) -> &'a mut W {
113 self.variant(BODLEVEL_A::DISABLED)
114 }
115}
116impl R {
117 #[doc = "Bits 0:2 - Brown-out Detector trigger level"]
118 #[inline(always)]
119 pub fn bodlevel(&self) -> BODLEVEL_R {
120 BODLEVEL_R::new(self.bits & 7)
121 }
122}
123impl W {
124 #[doc = "Bits 0:2 - Brown-out Detector trigger level"]
125 #[inline(always)]
126 #[must_use]
127 pub fn bodlevel(&mut self) -> BODLEVEL_W<0> {
128 BODLEVEL_W::new(self)
129 }
130 #[doc = "Writes raw bits to the register."]
131 #[inline(always)]
132 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
133 self.0.bits(bits);
134 self
135 }
136}
137#[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 [extended](index.html) module"]
138pub struct EXTENDED_SPEC;
139impl crate::RegisterSpec for EXTENDED_SPEC {
140 type Ux = u8;
141}
142#[doc = "`read()` method returns [extended::R](R) reader structure"]
143impl crate::Readable for EXTENDED_SPEC {
144 type Reader = R;
145}
146#[doc = "`write(|w| ..)` method takes [extended::W](W) writer structure"]
147impl crate::Writable for EXTENDED_SPEC {
148 type Writer = W;
149 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
150 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
151}
152#[doc = "`reset()` method sets EXTENDED to value 0"]
153impl crate::Resettable for EXTENDED_SPEC {
154 const RESET_VALUE: Self::Ux = 0;
155}