ra6t2/wdt/
wdtsr.rs

1#[doc = "Register `WDTSR` reader"]
2pub struct R(crate::R<WDTSR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<WDTSR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<WDTSR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<WDTSR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `WDTSR` writer"]
17pub struct W(crate::W<WDTSR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<WDTSR_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<WDTSR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<WDTSR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CNTVAL` reader - Down-Counter Value"]
38pub type CNTVAL_R = crate::FieldReader<u16, u16>;
39#[doc = "Field `UNDFF` reader - Underflow Flag"]
40pub type UNDFF_R = crate::BitReader<UNDFF_A>;
41#[doc = "Underflow Flag\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum UNDFF_A {
44    #[doc = "0: No underflow occurred"]
45    _0 = 0,
46    #[doc = "1: Underflow occurred"]
47    _1 = 1,
48}
49impl From<UNDFF_A> for bool {
50    #[inline(always)]
51    fn from(variant: UNDFF_A) -> Self {
52        variant as u8 != 0
53    }
54}
55impl UNDFF_R {
56    #[doc = "Get enumerated values variant"]
57    #[inline(always)]
58    pub fn variant(&self) -> UNDFF_A {
59        match self.bits {
60            false => UNDFF_A::_0,
61            true => UNDFF_A::_1,
62        }
63    }
64    #[doc = "Checks if the value of the field is `_0`"]
65    #[inline(always)]
66    pub fn is_0(&self) -> bool {
67        *self == UNDFF_A::_0
68    }
69    #[doc = "Checks if the value of the field is `_1`"]
70    #[inline(always)]
71    pub fn is_1(&self) -> bool {
72        *self == UNDFF_A::_1
73    }
74}
75#[doc = "Field `UNDFF` writer - Underflow Flag"]
76pub type UNDFF_W<'a, const O: u8> = crate::BitWriter<'a, u16, WDTSR_SPEC, UNDFF_A, O>;
77impl<'a, const O: u8> UNDFF_W<'a, O> {
78    #[doc = "No underflow occurred"]
79    #[inline(always)]
80    pub fn _0(self) -> &'a mut W {
81        self.variant(UNDFF_A::_0)
82    }
83    #[doc = "Underflow occurred"]
84    #[inline(always)]
85    pub fn _1(self) -> &'a mut W {
86        self.variant(UNDFF_A::_1)
87    }
88}
89#[doc = "Field `REFEF` reader - Refresh Error Flag"]
90pub type REFEF_R = crate::BitReader<REFEF_A>;
91#[doc = "Refresh Error Flag\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq, Eq)]
93pub enum REFEF_A {
94    #[doc = "0: No refresh error occurred"]
95    _0 = 0,
96    #[doc = "1: Refresh error occurred"]
97    _1 = 1,
98}
99impl From<REFEF_A> for bool {
100    #[inline(always)]
101    fn from(variant: REFEF_A) -> Self {
102        variant as u8 != 0
103    }
104}
105impl REFEF_R {
106    #[doc = "Get enumerated values variant"]
107    #[inline(always)]
108    pub fn variant(&self) -> REFEF_A {
109        match self.bits {
110            false => REFEF_A::_0,
111            true => REFEF_A::_1,
112        }
113    }
114    #[doc = "Checks if the value of the field is `_0`"]
115    #[inline(always)]
116    pub fn is_0(&self) -> bool {
117        *self == REFEF_A::_0
118    }
119    #[doc = "Checks if the value of the field is `_1`"]
120    #[inline(always)]
121    pub fn is_1(&self) -> bool {
122        *self == REFEF_A::_1
123    }
124}
125#[doc = "Field `REFEF` writer - Refresh Error Flag"]
126pub type REFEF_W<'a, const O: u8> = crate::BitWriter<'a, u16, WDTSR_SPEC, REFEF_A, O>;
127impl<'a, const O: u8> REFEF_W<'a, O> {
128    #[doc = "No refresh error occurred"]
129    #[inline(always)]
130    pub fn _0(self) -> &'a mut W {
131        self.variant(REFEF_A::_0)
132    }
133    #[doc = "Refresh error occurred"]
134    #[inline(always)]
135    pub fn _1(self) -> &'a mut W {
136        self.variant(REFEF_A::_1)
137    }
138}
139impl R {
140    #[doc = "Bits 0:13 - Down-Counter Value"]
141    #[inline(always)]
142    pub fn cntval(&self) -> CNTVAL_R {
143        CNTVAL_R::new(self.bits & 0x3fff)
144    }
145    #[doc = "Bit 14 - Underflow Flag"]
146    #[inline(always)]
147    pub fn undff(&self) -> UNDFF_R {
148        UNDFF_R::new(((self.bits >> 14) & 1) != 0)
149    }
150    #[doc = "Bit 15 - Refresh Error Flag"]
151    #[inline(always)]
152    pub fn refef(&self) -> REFEF_R {
153        REFEF_R::new(((self.bits >> 15) & 1) != 0)
154    }
155}
156impl W {
157    #[doc = "Bit 14 - Underflow Flag"]
158    #[inline(always)]
159    #[must_use]
160    pub fn undff(&mut self) -> UNDFF_W<14> {
161        UNDFF_W::new(self)
162    }
163    #[doc = "Bit 15 - Refresh Error Flag"]
164    #[inline(always)]
165    #[must_use]
166    pub fn refef(&mut self) -> REFEF_W<15> {
167        REFEF_W::new(self)
168    }
169    #[doc = "Writes raw bits to the register."]
170    #[inline(always)]
171    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
172        self.0.bits(bits);
173        self
174    }
175}
176#[doc = "WDT Status Register\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 [wdtsr](index.html) module"]
177pub struct WDTSR_SPEC;
178impl crate::RegisterSpec for WDTSR_SPEC {
179    type Ux = u16;
180}
181#[doc = "`read()` method returns [wdtsr::R](R) reader structure"]
182impl crate::Readable for WDTSR_SPEC {
183    type Reader = R;
184}
185#[doc = "`write(|w| ..)` method takes [wdtsr::W](W) writer structure"]
186impl crate::Writable for WDTSR_SPEC {
187    type Writer = W;
188    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
189    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
190}
191#[doc = "`reset()` method sets WDTSR to value 0"]
192impl crate::Resettable for WDTSR_SPEC {
193    const RESET_VALUE: Self::Ux = 0;
194}