efm32tg11b_pac/efm32tg11b120/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, const O: u8> = crate::FieldWriter<'a, u32, DATE_SPEC, u8, u8, 4, O>;
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, const O: u8> = crate::FieldWriter<'a, u32, DATE_SPEC, u8, u8, 2, O>;
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, const O: u8> = crate::FieldWriter<'a, u32, DATE_SPEC, u8, u8, 4, O>;
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, const O: u8> = crate::BitWriter<'a, u32, DATE_SPEC, bool, O>;
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, const O: u8> = crate::FieldWriter<'a, u32, DATE_SPEC, u8, u8, 4, O>;
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, const O: u8> = crate::FieldWriter<'a, u32, DATE_SPEC, u8, u8, 4, O>;
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, const O: u8> = crate::FieldWriter<'a, u32, DATE_SPEC, u8, u8, 3, O>;
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    #[must_use]
106    pub fn dayomu(&mut self) -> DAYOMU_W<0> {
107        DAYOMU_W::new(self)
108    }
109    #[doc = "Bits 4:5 - Day of Month, Tens"]
110    #[inline(always)]
111    #[must_use]
112    pub fn dayomt(&mut self) -> DAYOMT_W<4> {
113        DAYOMT_W::new(self)
114    }
115    #[doc = "Bits 8:11 - Month, Units"]
116    #[inline(always)]
117    #[must_use]
118    pub fn monthu(&mut self) -> MONTHU_W<8> {
119        MONTHU_W::new(self)
120    }
121    #[doc = "Bit 12 - Month, Tens"]
122    #[inline(always)]
123    #[must_use]
124    pub fn montht(&mut self) -> MONTHT_W<12> {
125        MONTHT_W::new(self)
126    }
127    #[doc = "Bits 16:19 - Year, Units"]
128    #[inline(always)]
129    #[must_use]
130    pub fn yearu(&mut self) -> YEARU_W<16> {
131        YEARU_W::new(self)
132    }
133    #[doc = "Bits 20:23 - Year, Tens"]
134    #[inline(always)]
135    #[must_use]
136    pub fn yeart(&mut self) -> YEART_W<20> {
137        YEART_W::new(self)
138    }
139    #[doc = "Bits 24:26 - Day of Week"]
140    #[inline(always)]
141    #[must_use]
142    pub fn dayow(&mut self) -> DAYOW_W<24> {
143        DAYOW_W::new(self)
144    }
145    #[doc = "Writes raw bits to the register."]
146    #[inline(always)]
147    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
148        self.0.bits(bits);
149        self
150    }
151}
152#[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"]
153pub struct DATE_SPEC;
154impl crate::RegisterSpec for DATE_SPEC {
155    type Ux = u32;
156}
157#[doc = "`read()` method returns [date::R](R) reader structure"]
158impl crate::Readable for DATE_SPEC {
159    type Reader = R;
160}
161#[doc = "`write(|w| ..)` method takes [date::W](W) writer structure"]
162impl crate::Writable for DATE_SPEC {
163    type Writer = W;
164    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
165    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
166}
167#[doc = "`reset()` method sets DATE to value 0"]
168impl crate::Resettable for DATE_SPEC {
169    const RESET_VALUE: Self::Ux = 0;
170}