efm32tg11b540_pac/rtcc/
date.rs

1#[doc = "Register `DATE` reader"]
2pub struct R(crate::R<DATE_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<DATE_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<DATE_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<DATE_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `DATE` writer"]
17pub struct W(crate::W<DATE_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<DATE_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<DATE_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<DATE_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `DAYOMU` reader - Day of Month, Units"]
38pub type DAYOMU_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `DAYOMU` writer - Day of Month, Units"]
40pub type DAYOMU_W<'a> = crate::FieldWriter<'a, u32, DATE_SPEC, u8, u8, 4, 0>;
41#[doc = "Field `DAYOMT` reader - Day of Month, Tens"]
42pub type DAYOMT_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `DAYOMT` writer - Day of Month, Tens"]
44pub type DAYOMT_W<'a> = crate::FieldWriter<'a, u32, DATE_SPEC, u8, u8, 2, 4>;
45#[doc = "Field `MONTHU` reader - Month, Units"]
46pub type MONTHU_R = crate::FieldReader<u8, u8>;
47#[doc = "Field `MONTHU` writer - Month, Units"]
48pub type MONTHU_W<'a> = crate::FieldWriter<'a, u32, DATE_SPEC, u8, u8, 4, 8>;
49#[doc = "Field `MONTHT` reader - Month, Tens"]
50pub type MONTHT_R = crate::BitReader<bool>;
51#[doc = "Field `MONTHT` writer - Month, Tens"]
52pub type MONTHT_W<'a> = crate::BitWriter<'a, u32, DATE_SPEC, bool, 12>;
53#[doc = "Field `YEARU` reader - Year, Units"]
54pub type YEARU_R = crate::FieldReader<u8, u8>;
55#[doc = "Field `YEARU` writer - Year, Units"]
56pub type YEARU_W<'a> = crate::FieldWriter<'a, u32, DATE_SPEC, u8, u8, 4, 16>;
57#[doc = "Field `YEART` reader - Year, Tens"]
58pub type YEART_R = crate::FieldReader<u8, u8>;
59#[doc = "Field `YEART` writer - Year, Tens"]
60pub type YEART_W<'a> = crate::FieldWriter<'a, u32, DATE_SPEC, u8, u8, 4, 20>;
61#[doc = "Field `DAYOW` reader - Day of Week"]
62pub type DAYOW_R = crate::FieldReader<u8, u8>;
63#[doc = "Field `DAYOW` writer - Day of Week"]
64pub type DAYOW_W<'a> = crate::FieldWriter<'a, u32, DATE_SPEC, u8, u8, 3, 24>;
65impl R {
66    #[doc = "Bits 0:3 - Day of Month, Units"]
67    #[inline(always)]
68    pub fn dayomu(&self) -> DAYOMU_R {
69        DAYOMU_R::new((self.bits & 0x0f) as u8)
70    }
71    #[doc = "Bits 4:5 - Day of Month, Tens"]
72    #[inline(always)]
73    pub fn dayomt(&self) -> DAYOMT_R {
74        DAYOMT_R::new(((self.bits >> 4) & 3) as u8)
75    }
76    #[doc = "Bits 8:11 - Month, Units"]
77    #[inline(always)]
78    pub fn monthu(&self) -> MONTHU_R {
79        MONTHU_R::new(((self.bits >> 8) & 0x0f) as u8)
80    }
81    #[doc = "Bit 12 - Month, Tens"]
82    #[inline(always)]
83    pub fn montht(&self) -> MONTHT_R {
84        MONTHT_R::new(((self.bits >> 12) & 1) != 0)
85    }
86    #[doc = "Bits 16:19 - Year, Units"]
87    #[inline(always)]
88    pub fn yearu(&self) -> YEARU_R {
89        YEARU_R::new(((self.bits >> 16) & 0x0f) as u8)
90    }
91    #[doc = "Bits 20:23 - Year, Tens"]
92    #[inline(always)]
93    pub fn yeart(&self) -> YEART_R {
94        YEART_R::new(((self.bits >> 20) & 0x0f) as u8)
95    }
96    #[doc = "Bits 24:26 - Day of Week"]
97    #[inline(always)]
98    pub fn dayow(&self) -> DAYOW_R {
99        DAYOW_R::new(((self.bits >> 24) & 7) as u8)
100    }
101}
102impl W {
103    #[doc = "Bits 0:3 - Day of Month, Units"]
104    #[inline(always)]
105    pub fn dayomu(&mut self) -> DAYOMU_W {
106        DAYOMU_W::new(self)
107    }
108    #[doc = "Bits 4:5 - Day of Month, Tens"]
109    #[inline(always)]
110    pub fn dayomt(&mut self) -> DAYOMT_W {
111        DAYOMT_W::new(self)
112    }
113    #[doc = "Bits 8:11 - Month, Units"]
114    #[inline(always)]
115    pub fn monthu(&mut self) -> MONTHU_W {
116        MONTHU_W::new(self)
117    }
118    #[doc = "Bit 12 - Month, Tens"]
119    #[inline(always)]
120    pub fn montht(&mut self) -> MONTHT_W {
121        MONTHT_W::new(self)
122    }
123    #[doc = "Bits 16:19 - Year, Units"]
124    #[inline(always)]
125    pub fn yearu(&mut self) -> YEARU_W {
126        YEARU_W::new(self)
127    }
128    #[doc = "Bits 20:23 - Year, Tens"]
129    #[inline(always)]
130    pub fn yeart(&mut self) -> YEART_W {
131        YEART_W::new(self)
132    }
133    #[doc = "Bits 24:26 - Day of Week"]
134    #[inline(always)]
135    pub fn dayow(&mut self) -> DAYOW_W {
136        DAYOW_W::new(self)
137    }
138    #[doc = "Writes raw bits to the register."]
139    #[inline(always)]
140    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
141        self.0.bits(bits);
142        self
143    }
144}
145#[doc = "Date 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 [date](index.html) module"]
146pub struct DATE_SPEC;
147impl crate::RegisterSpec for DATE_SPEC {
148    type Ux = u32;
149}
150#[doc = "`read()` method returns [date::R](R) reader structure"]
151impl crate::Readable for DATE_SPEC {
152    type Reader = R;
153}
154#[doc = "`write(|w| ..)` method takes [date::W](W) writer structure"]
155impl crate::Writable for DATE_SPEC {
156    type Writer = W;
157}
158#[doc = "`reset()` method sets DATE to value 0"]
159impl crate::Resettable for DATE_SPEC {
160    #[inline(always)]
161    fn reset_value() -> Self::Ux {
162        0
163    }
164}