rp2040_pac/rtc/
setup_0.rs
1#[doc = "Register `SETUP_0` reader"]
2pub type R = crate::R<SETUP_0_SPEC>;
3#[doc = "Register `SETUP_0` writer"]
4pub type W = crate::W<SETUP_0_SPEC>;
5#[doc = "Field `DAY` reader - Day of the month (1..31)"]
6pub type DAY_R = crate::FieldReader;
7#[doc = "Field `DAY` writer - Day of the month (1..31)"]
8pub type DAY_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
9#[doc = "Field `MONTH` reader - Month (1..12)"]
10pub type MONTH_R = crate::FieldReader;
11#[doc = "Field `MONTH` writer - Month (1..12)"]
12pub type MONTH_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
13#[doc = "Field `YEAR` reader - Year"]
14pub type YEAR_R = crate::FieldReader<u16>;
15#[doc = "Field `YEAR` writer - Year"]
16pub type YEAR_W<'a, REG> = crate::FieldWriter<'a, REG, 12, u16>;
17impl R {
18 #[doc = "Bits 0:4 - Day of the month (1..31)"]
19 #[inline(always)]
20 pub fn day(&self) -> DAY_R {
21 DAY_R::new((self.bits & 0x1f) as u8)
22 }
23 #[doc = "Bits 8:11 - Month (1..12)"]
24 #[inline(always)]
25 pub fn month(&self) -> MONTH_R {
26 MONTH_R::new(((self.bits >> 8) & 0x0f) as u8)
27 }
28 #[doc = "Bits 12:23 - Year"]
29 #[inline(always)]
30 pub fn year(&self) -> YEAR_R {
31 YEAR_R::new(((self.bits >> 12) & 0x0fff) as u16)
32 }
33}
34impl W {
35 #[doc = "Bits 0:4 - Day of the month (1..31)"]
36 #[inline(always)]
37 #[must_use]
38 pub fn day(&mut self) -> DAY_W<SETUP_0_SPEC> {
39 DAY_W::new(self, 0)
40 }
41 #[doc = "Bits 8:11 - Month (1..12)"]
42 #[inline(always)]
43 #[must_use]
44 pub fn month(&mut self) -> MONTH_W<SETUP_0_SPEC> {
45 MONTH_W::new(self, 8)
46 }
47 #[doc = "Bits 12:23 - Year"]
48 #[inline(always)]
49 #[must_use]
50 pub fn year(&mut self) -> YEAR_W<SETUP_0_SPEC> {
51 YEAR_W::new(self, 12)
52 }
53 #[doc = r" Writes raw bits to the register."]
54 #[doc = r""]
55 #[doc = r" # Safety"]
56 #[doc = r""]
57 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
58 #[inline(always)]
59 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
60 self.bits = bits;
61 self
62 }
63}
64#[doc = "RTC setup register 0
65
66You can [`read`](crate::generic::Reg::read) this register and get [`setup_0::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 [`setup_0::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
67pub struct SETUP_0_SPEC;
68impl crate::RegisterSpec for SETUP_0_SPEC {
69 type Ux = u32;
70}
71#[doc = "`read()` method returns [`setup_0::R`](R) reader structure"]
72impl crate::Readable for SETUP_0_SPEC {}
73#[doc = "`write(|w| ..)` method takes [`setup_0::W`](W) writer structure"]
74impl crate::Writable for SETUP_0_SPEC {
75 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
76 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
77}
78#[doc = "`reset()` method sets SETUP_0 to value 0"]
79impl crate::Resettable for SETUP_0_SPEC {
80 const RESET_VALUE: u32 = 0;
81}