rp2040_pac/rtc/
ctrl.rs

1#[doc = "Register `CTRL` reader"]
2pub type R = crate::R<CTRL_SPEC>;
3#[doc = "Register `CTRL` writer"]
4pub type W = crate::W<CTRL_SPEC>;
5#[doc = "Field `RTC_ENABLE` reader - Enable RTC"]
6pub type RTC_ENABLE_R = crate::BitReader;
7#[doc = "Field `RTC_ENABLE` writer - Enable RTC"]
8pub type RTC_ENABLE_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `RTC_ACTIVE` reader - RTC enabled (running)"]
10pub type RTC_ACTIVE_R = crate::BitReader;
11#[doc = "Field `LOAD` reader - Load RTC"]
12pub type LOAD_R = crate::BitReader;
13#[doc = "Field `LOAD` writer - Load RTC"]
14pub type LOAD_W<'a, REG> = crate::BitWriter<'a, REG>;
15#[doc = "Field `FORCE_NOTLEAPYEAR` reader - If set, leapyear is forced off.  
16 Useful for years divisible by 100 but not by 400"]
17pub type FORCE_NOTLEAPYEAR_R = crate::BitReader;
18#[doc = "Field `FORCE_NOTLEAPYEAR` writer - If set, leapyear is forced off.  
19 Useful for years divisible by 100 but not by 400"]
20pub type FORCE_NOTLEAPYEAR_W<'a, REG> = crate::BitWriter<'a, REG>;
21impl R {
22    #[doc = "Bit 0 - Enable RTC"]
23    #[inline(always)]
24    pub fn rtc_enable(&self) -> RTC_ENABLE_R {
25        RTC_ENABLE_R::new((self.bits & 1) != 0)
26    }
27    #[doc = "Bit 1 - RTC enabled (running)"]
28    #[inline(always)]
29    pub fn rtc_active(&self) -> RTC_ACTIVE_R {
30        RTC_ACTIVE_R::new(((self.bits >> 1) & 1) != 0)
31    }
32    #[doc = "Bit 4 - Load RTC"]
33    #[inline(always)]
34    pub fn load(&self) -> LOAD_R {
35        LOAD_R::new(((self.bits >> 4) & 1) != 0)
36    }
37    #[doc = "Bit 8 - If set, leapyear is forced off.  
38 Useful for years divisible by 100 but not by 400"]
39    #[inline(always)]
40    pub fn force_notleapyear(&self) -> FORCE_NOTLEAPYEAR_R {
41        FORCE_NOTLEAPYEAR_R::new(((self.bits >> 8) & 1) != 0)
42    }
43}
44impl W {
45    #[doc = "Bit 0 - Enable RTC"]
46    #[inline(always)]
47    #[must_use]
48    pub fn rtc_enable(&mut self) -> RTC_ENABLE_W<CTRL_SPEC> {
49        RTC_ENABLE_W::new(self, 0)
50    }
51    #[doc = "Bit 4 - Load RTC"]
52    #[inline(always)]
53    #[must_use]
54    pub fn load(&mut self) -> LOAD_W<CTRL_SPEC> {
55        LOAD_W::new(self, 4)
56    }
57    #[doc = "Bit 8 - If set, leapyear is forced off.  
58 Useful for years divisible by 100 but not by 400"]
59    #[inline(always)]
60    #[must_use]
61    pub fn force_notleapyear(&mut self) -> FORCE_NOTLEAPYEAR_W<CTRL_SPEC> {
62        FORCE_NOTLEAPYEAR_W::new(self, 8)
63    }
64    #[doc = r" Writes raw bits to the register."]
65    #[doc = r""]
66    #[doc = r" # Safety"]
67    #[doc = r""]
68    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
69    #[inline(always)]
70    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
71        self.bits = bits;
72        self
73    }
74}
75#[doc = "RTC Control and status  
76
77You can [`read`](crate::generic::Reg::read) this register and get [`ctrl::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 [`ctrl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
78pub struct CTRL_SPEC;
79impl crate::RegisterSpec for CTRL_SPEC {
80    type Ux = u32;
81}
82#[doc = "`read()` method returns [`ctrl::R`](R) reader structure"]
83impl crate::Readable for CTRL_SPEC {}
84#[doc = "`write(|w| ..)` method takes [`ctrl::W`](W) writer structure"]
85impl crate::Writable for CTRL_SPEC {
86    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
87    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
88}
89#[doc = "`reset()` method sets CTRL to value 0"]
90impl crate::Resettable for CTRL_SPEC {
91    const RESET_VALUE: u32 = 0;
92}