atsam3s2b/rtc/
calr.rs

1#[doc = "Register `CALR` reader"]
2pub type R = crate::R<CalrSpec>;
3#[doc = "Register `CALR` writer"]
4pub type W = crate::W<CalrSpec>;
5#[doc = "Field `CENT` reader - Current Century"]
6pub type CentR = crate::FieldReader;
7#[doc = "Field `CENT` writer - Current Century"]
8pub type CentW<'a, REG> = crate::FieldWriter<'a, REG, 7>;
9#[doc = "Field `YEAR` reader - Current Year"]
10pub type YearR = crate::FieldReader;
11#[doc = "Field `YEAR` writer - Current Year"]
12pub type YearW<'a, REG> = crate::FieldWriter<'a, REG, 8>;
13#[doc = "Field `MONTH` reader - Current Month"]
14pub type MonthR = crate::FieldReader;
15#[doc = "Field `MONTH` writer - Current Month"]
16pub type MonthW<'a, REG> = crate::FieldWriter<'a, REG, 5>;
17#[doc = "Field `DAY` reader - Current Day in Current Week"]
18pub type DayR = crate::FieldReader;
19#[doc = "Field `DAY` writer - Current Day in Current Week"]
20pub type DayW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
21#[doc = "Field `DATE` reader - Current Day in Current Month"]
22pub type DateR = crate::FieldReader;
23#[doc = "Field `DATE` writer - Current Day in Current Month"]
24pub type DateW<'a, REG> = crate::FieldWriter<'a, REG, 6>;
25impl R {
26    #[doc = "Bits 0:6 - Current Century"]
27    #[inline(always)]
28    pub fn cent(&self) -> CentR {
29        CentR::new((self.bits & 0x7f) as u8)
30    }
31    #[doc = "Bits 8:15 - Current Year"]
32    #[inline(always)]
33    pub fn year(&self) -> YearR {
34        YearR::new(((self.bits >> 8) & 0xff) as u8)
35    }
36    #[doc = "Bits 16:20 - Current Month"]
37    #[inline(always)]
38    pub fn month(&self) -> MonthR {
39        MonthR::new(((self.bits >> 16) & 0x1f) as u8)
40    }
41    #[doc = "Bits 21:23 - Current Day in Current Week"]
42    #[inline(always)]
43    pub fn day(&self) -> DayR {
44        DayR::new(((self.bits >> 21) & 7) as u8)
45    }
46    #[doc = "Bits 24:29 - Current Day in Current Month"]
47    #[inline(always)]
48    pub fn date(&self) -> DateR {
49        DateR::new(((self.bits >> 24) & 0x3f) as u8)
50    }
51}
52impl W {
53    #[doc = "Bits 0:6 - Current Century"]
54    #[inline(always)]
55    #[must_use]
56    pub fn cent(&mut self) -> CentW<CalrSpec> {
57        CentW::new(self, 0)
58    }
59    #[doc = "Bits 8:15 - Current Year"]
60    #[inline(always)]
61    #[must_use]
62    pub fn year(&mut self) -> YearW<CalrSpec> {
63        YearW::new(self, 8)
64    }
65    #[doc = "Bits 16:20 - Current Month"]
66    #[inline(always)]
67    #[must_use]
68    pub fn month(&mut self) -> MonthW<CalrSpec> {
69        MonthW::new(self, 16)
70    }
71    #[doc = "Bits 21:23 - Current Day in Current Week"]
72    #[inline(always)]
73    #[must_use]
74    pub fn day(&mut self) -> DayW<CalrSpec> {
75        DayW::new(self, 21)
76    }
77    #[doc = "Bits 24:29 - Current Day in Current Month"]
78    #[inline(always)]
79    #[must_use]
80    pub fn date(&mut self) -> DateW<CalrSpec> {
81        DateW::new(self, 24)
82    }
83}
84#[doc = "Calendar Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`calr::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`calr::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
85pub struct CalrSpec;
86impl crate::RegisterSpec for CalrSpec {
87    type Ux = u32;
88}
89#[doc = "`read()` method returns [`calr::R`](R) reader structure"]
90impl crate::Readable for CalrSpec {}
91#[doc = "`write(|w| ..)` method takes [`calr::W`](W) writer structure"]
92impl crate::Writable for CalrSpec {
93    type Safety = crate::Unsafe;
94    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
95    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
96}
97#[doc = "`reset()` method sets CALR to value 0x0181_0720"]
98impl crate::Resettable for CalrSpec {
99    const RESET_VALUE: u32 = 0x0181_0720;
100}