ra4m2/rtc/
rdayar.rs

1#[doc = "Register `RDAYAR` reader"]
2pub struct R(crate::R<RDAYAR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<RDAYAR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<RDAYAR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<RDAYAR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `RDAYAR` writer"]
17pub struct W(crate::W<RDAYAR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<RDAYAR_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<RDAYAR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<RDAYAR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `DATE1` reader - 1 Day"]
38pub type DATE1_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `DATE1` writer - 1 Day"]
40pub type DATE1_W<'a, const O: u8> = crate::FieldWriter<'a, u8, RDAYAR_SPEC, u8, u8, 4, O>;
41#[doc = "Field `DATE10` reader - 10 Days"]
42pub type DATE10_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `DATE10` writer - 10 Days"]
44pub type DATE10_W<'a, const O: u8> = crate::FieldWriter<'a, u8, RDAYAR_SPEC, u8, u8, 2, O>;
45#[doc = "Field `ENB` reader - ENB"]
46pub type ENB_R = crate::BitReader<ENB_A>;
47#[doc = "ENB\n\nValue on reset: 0"]
48#[derive(Clone, Copy, Debug, PartialEq, Eq)]
49pub enum ENB_A {
50    #[doc = "0: Do not compare register value with RDAYCNT counter value"]
51    _0 = 0,
52    #[doc = "1: Compare register value with RDAYCNT counter value"]
53    _1 = 1,
54}
55impl From<ENB_A> for bool {
56    #[inline(always)]
57    fn from(variant: ENB_A) -> Self {
58        variant as u8 != 0
59    }
60}
61impl ENB_R {
62    #[doc = "Get enumerated values variant"]
63    #[inline(always)]
64    pub fn variant(&self) -> ENB_A {
65        match self.bits {
66            false => ENB_A::_0,
67            true => ENB_A::_1,
68        }
69    }
70    #[doc = "Checks if the value of the field is `_0`"]
71    #[inline(always)]
72    pub fn is_0(&self) -> bool {
73        *self == ENB_A::_0
74    }
75    #[doc = "Checks if the value of the field is `_1`"]
76    #[inline(always)]
77    pub fn is_1(&self) -> bool {
78        *self == ENB_A::_1
79    }
80}
81#[doc = "Field `ENB` writer - ENB"]
82pub type ENB_W<'a, const O: u8> = crate::BitWriter<'a, u8, RDAYAR_SPEC, ENB_A, O>;
83impl<'a, const O: u8> ENB_W<'a, O> {
84    #[doc = "Do not compare register value with RDAYCNT counter value"]
85    #[inline(always)]
86    pub fn _0(self) -> &'a mut W {
87        self.variant(ENB_A::_0)
88    }
89    #[doc = "Compare register value with RDAYCNT counter value"]
90    #[inline(always)]
91    pub fn _1(self) -> &'a mut W {
92        self.variant(ENB_A::_1)
93    }
94}
95impl R {
96    #[doc = "Bits 0:3 - 1 Day"]
97    #[inline(always)]
98    pub fn date1(&self) -> DATE1_R {
99        DATE1_R::new(self.bits & 0x0f)
100    }
101    #[doc = "Bits 4:5 - 10 Days"]
102    #[inline(always)]
103    pub fn date10(&self) -> DATE10_R {
104        DATE10_R::new((self.bits >> 4) & 3)
105    }
106    #[doc = "Bit 7 - ENB"]
107    #[inline(always)]
108    pub fn enb(&self) -> ENB_R {
109        ENB_R::new(((self.bits >> 7) & 1) != 0)
110    }
111}
112impl W {
113    #[doc = "Bits 0:3 - 1 Day"]
114    #[inline(always)]
115    #[must_use]
116    pub fn date1(&mut self) -> DATE1_W<0> {
117        DATE1_W::new(self)
118    }
119    #[doc = "Bits 4:5 - 10 Days"]
120    #[inline(always)]
121    #[must_use]
122    pub fn date10(&mut self) -> DATE10_W<4> {
123        DATE10_W::new(self)
124    }
125    #[doc = "Bit 7 - ENB"]
126    #[inline(always)]
127    #[must_use]
128    pub fn enb(&mut self) -> ENB_W<7> {
129        ENB_W::new(self)
130    }
131    #[doc = "Writes raw bits to the register."]
132    #[inline(always)]
133    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
134        self.0.bits(bits);
135        self
136    }
137}
138#[doc = "Date Alarm Register (in Calendar Count Mode)\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 [rdayar](index.html) module"]
139pub struct RDAYAR_SPEC;
140impl crate::RegisterSpec for RDAYAR_SPEC {
141    type Ux = u8;
142}
143#[doc = "`read()` method returns [rdayar::R](R) reader structure"]
144impl crate::Readable for RDAYAR_SPEC {
145    type Reader = R;
146}
147#[doc = "`write(|w| ..)` method takes [rdayar::W](W) writer structure"]
148impl crate::Writable for RDAYAR_SPEC {
149    type Writer = W;
150    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
151    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
152}
153#[doc = "`reset()` method sets RDAYAR to value 0"]
154impl crate::Resettable for RDAYAR_SPEC {
155    const RESET_VALUE: Self::Ux = 0;
156}