rp2040_pac/rtc/
setup_1.rs

1#[doc = "Register `SETUP_1` reader"]
2pub type R = crate::R<SETUP_1_SPEC>;
3#[doc = "Register `SETUP_1` writer"]
4pub type W = crate::W<SETUP_1_SPEC>;
5#[doc = "Field `SEC` reader - Seconds"]
6pub type SEC_R = crate::FieldReader;
7#[doc = "Field `SEC` writer - Seconds"]
8pub type SEC_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
9#[doc = "Field `MIN` reader - Minutes"]
10pub type MIN_R = crate::FieldReader;
11#[doc = "Field `MIN` writer - Minutes"]
12pub type MIN_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
13#[doc = "Field `HOUR` reader - Hours"]
14pub type HOUR_R = crate::FieldReader;
15#[doc = "Field `HOUR` writer - Hours"]
16pub type HOUR_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
17#[doc = "Field `DOTW` reader - Day of the week: 1-Monday...0-Sunday ISO 8601 mod 7"]
18pub type DOTW_R = crate::FieldReader;
19#[doc = "Field `DOTW` writer - Day of the week: 1-Monday...0-Sunday ISO 8601 mod 7"]
20pub type DOTW_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
21impl R {
22    #[doc = "Bits 0:5 - Seconds"]
23    #[inline(always)]
24    pub fn sec(&self) -> SEC_R {
25        SEC_R::new((self.bits & 0x3f) as u8)
26    }
27    #[doc = "Bits 8:13 - Minutes"]
28    #[inline(always)]
29    pub fn min(&self) -> MIN_R {
30        MIN_R::new(((self.bits >> 8) & 0x3f) as u8)
31    }
32    #[doc = "Bits 16:20 - Hours"]
33    #[inline(always)]
34    pub fn hour(&self) -> HOUR_R {
35        HOUR_R::new(((self.bits >> 16) & 0x1f) as u8)
36    }
37    #[doc = "Bits 24:26 - Day of the week: 1-Monday...0-Sunday ISO 8601 mod 7"]
38    #[inline(always)]
39    pub fn dotw(&self) -> DOTW_R {
40        DOTW_R::new(((self.bits >> 24) & 7) as u8)
41    }
42}
43impl W {
44    #[doc = "Bits 0:5 - Seconds"]
45    #[inline(always)]
46    #[must_use]
47    pub fn sec(&mut self) -> SEC_W<SETUP_1_SPEC> {
48        SEC_W::new(self, 0)
49    }
50    #[doc = "Bits 8:13 - Minutes"]
51    #[inline(always)]
52    #[must_use]
53    pub fn min(&mut self) -> MIN_W<SETUP_1_SPEC> {
54        MIN_W::new(self, 8)
55    }
56    #[doc = "Bits 16:20 - Hours"]
57    #[inline(always)]
58    #[must_use]
59    pub fn hour(&mut self) -> HOUR_W<SETUP_1_SPEC> {
60        HOUR_W::new(self, 16)
61    }
62    #[doc = "Bits 24:26 - Day of the week: 1-Monday...0-Sunday ISO 8601 mod 7"]
63    #[inline(always)]
64    #[must_use]
65    pub fn dotw(&mut self) -> DOTW_W<SETUP_1_SPEC> {
66        DOTW_W::new(self, 24)
67    }
68    #[doc = r" Writes raw bits to the register."]
69    #[doc = r""]
70    #[doc = r" # Safety"]
71    #[doc = r""]
72    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
73    #[inline(always)]
74    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
75        self.bits = bits;
76        self
77    }
78}
79#[doc = "RTC setup register 1  
80
81You can [`read`](crate::generic::Reg::read) this register and get [`setup_1::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_1::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
82pub struct SETUP_1_SPEC;
83impl crate::RegisterSpec for SETUP_1_SPEC {
84    type Ux = u32;
85}
86#[doc = "`read()` method returns [`setup_1::R`](R) reader structure"]
87impl crate::Readable for SETUP_1_SPEC {}
88#[doc = "`write(|w| ..)` method takes [`setup_1::W`](W) writer structure"]
89impl crate::Writable for SETUP_1_SPEC {
90    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
91    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
92}
93#[doc = "`reset()` method sets SETUP_1 to value 0"]
94impl crate::Resettable for SETUP_1_SPEC {
95    const RESET_VALUE: u32 = 0;
96}