avr_device/devices/atmega4809/fuse/
syscfg1.rs

1#[doc = "Register `SYSCFG1` reader"]
2pub struct R(crate::R<SYSCFG1_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SYSCFG1_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SYSCFG1_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SYSCFG1_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SYSCFG1` writer"]
17pub struct W(crate::W<SYSCFG1_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SYSCFG1_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<SYSCFG1_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SYSCFG1_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SUT` reader - Startup Time"]
38pub type SUT_R = crate::FieldReader<u8, SUT_A>;
39#[doc = "Startup Time\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum SUT_A {
43    #[doc = "0: 0 ms"]
44    _0MS = 0,
45    #[doc = "1: 1 ms"]
46    _1MS = 1,
47    #[doc = "2: 2 ms"]
48    _2MS = 2,
49    #[doc = "3: 4 ms"]
50    _4MS = 3,
51    #[doc = "4: 8 ms"]
52    _8MS = 4,
53    #[doc = "5: 16 ms"]
54    _16MS = 5,
55    #[doc = "6: 32 ms"]
56    _32MS = 6,
57    #[doc = "7: 64 ms"]
58    _64MS = 7,
59}
60impl From<SUT_A> for u8 {
61    #[inline(always)]
62    fn from(variant: SUT_A) -> Self {
63        variant as _
64    }
65}
66impl SUT_R {
67    #[doc = "Get enumerated values variant"]
68    #[inline(always)]
69    pub fn variant(&self) -> SUT_A {
70        match self.bits {
71            0 => SUT_A::_0MS,
72            1 => SUT_A::_1MS,
73            2 => SUT_A::_2MS,
74            3 => SUT_A::_4MS,
75            4 => SUT_A::_8MS,
76            5 => SUT_A::_16MS,
77            6 => SUT_A::_32MS,
78            7 => SUT_A::_64MS,
79            _ => unreachable!(),
80        }
81    }
82    #[doc = "Checks if the value of the field is `_0MS`"]
83    #[inline(always)]
84    pub fn is_0ms(&self) -> bool {
85        *self == SUT_A::_0MS
86    }
87    #[doc = "Checks if the value of the field is `_1MS`"]
88    #[inline(always)]
89    pub fn is_1ms(&self) -> bool {
90        *self == SUT_A::_1MS
91    }
92    #[doc = "Checks if the value of the field is `_2MS`"]
93    #[inline(always)]
94    pub fn is_2ms(&self) -> bool {
95        *self == SUT_A::_2MS
96    }
97    #[doc = "Checks if the value of the field is `_4MS`"]
98    #[inline(always)]
99    pub fn is_4ms(&self) -> bool {
100        *self == SUT_A::_4MS
101    }
102    #[doc = "Checks if the value of the field is `_8MS`"]
103    #[inline(always)]
104    pub fn is_8ms(&self) -> bool {
105        *self == SUT_A::_8MS
106    }
107    #[doc = "Checks if the value of the field is `_16MS`"]
108    #[inline(always)]
109    pub fn is_16ms(&self) -> bool {
110        *self == SUT_A::_16MS
111    }
112    #[doc = "Checks if the value of the field is `_32MS`"]
113    #[inline(always)]
114    pub fn is_32ms(&self) -> bool {
115        *self == SUT_A::_32MS
116    }
117    #[doc = "Checks if the value of the field is `_64MS`"]
118    #[inline(always)]
119    pub fn is_64ms(&self) -> bool {
120        *self == SUT_A::_64MS
121    }
122}
123#[doc = "Field `SUT` writer - Startup Time"]
124pub type SUT_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, SYSCFG1_SPEC, u8, SUT_A, 3, O>;
125impl<'a, const O: u8> SUT_W<'a, O> {
126    #[doc = "0 ms"]
127    #[inline(always)]
128    pub fn _0ms(self) -> &'a mut W {
129        self.variant(SUT_A::_0MS)
130    }
131    #[doc = "1 ms"]
132    #[inline(always)]
133    pub fn _1ms(self) -> &'a mut W {
134        self.variant(SUT_A::_1MS)
135    }
136    #[doc = "2 ms"]
137    #[inline(always)]
138    pub fn _2ms(self) -> &'a mut W {
139        self.variant(SUT_A::_2MS)
140    }
141    #[doc = "4 ms"]
142    #[inline(always)]
143    pub fn _4ms(self) -> &'a mut W {
144        self.variant(SUT_A::_4MS)
145    }
146    #[doc = "8 ms"]
147    #[inline(always)]
148    pub fn _8ms(self) -> &'a mut W {
149        self.variant(SUT_A::_8MS)
150    }
151    #[doc = "16 ms"]
152    #[inline(always)]
153    pub fn _16ms(self) -> &'a mut W {
154        self.variant(SUT_A::_16MS)
155    }
156    #[doc = "32 ms"]
157    #[inline(always)]
158    pub fn _32ms(self) -> &'a mut W {
159        self.variant(SUT_A::_32MS)
160    }
161    #[doc = "64 ms"]
162    #[inline(always)]
163    pub fn _64ms(self) -> &'a mut W {
164        self.variant(SUT_A::_64MS)
165    }
166}
167impl R {
168    #[doc = "Bits 0:2 - Startup Time"]
169    #[inline(always)]
170    pub fn sut(&self) -> SUT_R {
171        SUT_R::new(self.bits & 7)
172    }
173}
174impl W {
175    #[doc = "Bits 0:2 - Startup Time"]
176    #[inline(always)]
177    #[must_use]
178    pub fn sut(&mut self) -> SUT_W<0> {
179        SUT_W::new(self)
180    }
181    #[doc = "Writes raw bits to the register."]
182    #[inline(always)]
183    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
184        self.0.bits(bits);
185        self
186    }
187}
188#[doc = "System Configuration 1\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 [syscfg1](index.html) module"]
189pub struct SYSCFG1_SPEC;
190impl crate::RegisterSpec for SYSCFG1_SPEC {
191    type Ux = u8;
192}
193#[doc = "`read()` method returns [syscfg1::R](R) reader structure"]
194impl crate::Readable for SYSCFG1_SPEC {
195    type Reader = R;
196}
197#[doc = "`write(|w| ..)` method takes [syscfg1::W](W) writer structure"]
198impl crate::Writable for SYSCFG1_SPEC {
199    type Writer = W;
200    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
201    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
202}
203#[doc = "`reset()` method sets SYSCFG1 to value 0"]
204impl crate::Resettable for SYSCFG1_SPEC {
205    const RESET_VALUE: Self::Ux = 0;
206}