bl61x_pac/mcu_misc/
mcu_e907_rtc.rs

1#[doc = "Register `mcu_e907_rtc` reader"]
2pub type R = crate::R<MCU_E907_RTC_SPEC>;
3#[doc = "Register `mcu_e907_rtc` writer"]
4pub type W = crate::W<MCU_E907_RTC_SPEC>;
5#[doc = "Field `reg_mcu_rtc_div` reader - MCU RTC divider. This field controls the divider for the RTC clock."]
6pub type REG_MCU_RTC_DIV_R = crate::FieldReader<u16>;
7#[doc = "Field `reg_mcu_rtc_div` writer - MCU RTC divider. This field controls the divider for the RTC clock."]
8pub type REG_MCU_RTC_DIV_W<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>;
9#[doc = "Field `reg_mcu_rtc_clk_sel` reader - MCU RTC clock select. This bit controls the clock source for the RTC."]
10pub type REG_MCU_RTC_CLK_SEL_R = crate::BitReader;
11#[doc = "Field `reg_mcu_rtc_clk_sel` writer - MCU RTC clock select. This bit controls the clock source for the RTC."]
12pub type REG_MCU_RTC_CLK_SEL_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `reg_mcu_rtc_rst` reader - MCU RTC reset. Writing 1 to this bit resets the RTC."]
14pub type REG_MCU_RTC_RST_R = crate::BitReader;
15#[doc = "Field `reg_mcu_rtc_rst` writer - MCU RTC reset. Writing 1 to this bit resets the RTC."]
16pub type REG_MCU_RTC_RST_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `reg_mcu_rtc_en` reader - MCU RTC enable. Writing 1 to this bit enables the RTC."]
18pub type REG_MCU_RTC_EN_R = crate::BitReader;
19#[doc = "Field `reg_mcu_rtc_en` writer - MCU RTC enable. Writing 1 to this bit enables the RTC."]
20pub type REG_MCU_RTC_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
21impl R {
22    #[doc = "Bits 0:9 - MCU RTC divider. This field controls the divider for the RTC clock."]
23    #[inline(always)]
24    pub fn reg_mcu_rtc_div(&self) -> REG_MCU_RTC_DIV_R {
25        REG_MCU_RTC_DIV_R::new((self.bits & 0x03ff) as u16)
26    }
27    #[doc = "Bit 29 - MCU RTC clock select. This bit controls the clock source for the RTC."]
28    #[inline(always)]
29    pub fn reg_mcu_rtc_clk_sel(&self) -> REG_MCU_RTC_CLK_SEL_R {
30        REG_MCU_RTC_CLK_SEL_R::new(((self.bits >> 29) & 1) != 0)
31    }
32    #[doc = "Bit 30 - MCU RTC reset. Writing 1 to this bit resets the RTC."]
33    #[inline(always)]
34    pub fn reg_mcu_rtc_rst(&self) -> REG_MCU_RTC_RST_R {
35        REG_MCU_RTC_RST_R::new(((self.bits >> 30) & 1) != 0)
36    }
37    #[doc = "Bit 31 - MCU RTC enable. Writing 1 to this bit enables the RTC."]
38    #[inline(always)]
39    pub fn reg_mcu_rtc_en(&self) -> REG_MCU_RTC_EN_R {
40        REG_MCU_RTC_EN_R::new(((self.bits >> 31) & 1) != 0)
41    }
42}
43impl W {
44    #[doc = "Bits 0:9 - MCU RTC divider. This field controls the divider for the RTC clock."]
45    #[inline(always)]
46    #[must_use]
47    pub fn reg_mcu_rtc_div(&mut self) -> REG_MCU_RTC_DIV_W<MCU_E907_RTC_SPEC> {
48        REG_MCU_RTC_DIV_W::new(self, 0)
49    }
50    #[doc = "Bit 29 - MCU RTC clock select. This bit controls the clock source for the RTC."]
51    #[inline(always)]
52    #[must_use]
53    pub fn reg_mcu_rtc_clk_sel(&mut self) -> REG_MCU_RTC_CLK_SEL_W<MCU_E907_RTC_SPEC> {
54        REG_MCU_RTC_CLK_SEL_W::new(self, 29)
55    }
56    #[doc = "Bit 30 - MCU RTC reset. Writing 1 to this bit resets the RTC."]
57    #[inline(always)]
58    #[must_use]
59    pub fn reg_mcu_rtc_rst(&mut self) -> REG_MCU_RTC_RST_W<MCU_E907_RTC_SPEC> {
60        REG_MCU_RTC_RST_W::new(self, 30)
61    }
62    #[doc = "Bit 31 - MCU RTC enable. Writing 1 to this bit enables the RTC."]
63    #[inline(always)]
64    #[must_use]
65    pub fn reg_mcu_rtc_en(&mut self) -> REG_MCU_RTC_EN_W<MCU_E907_RTC_SPEC> {
66        REG_MCU_RTC_EN_W::new(self, 31)
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 = "MCU E907 RTC Register. Controls the E907 RTC settings.\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`mcu_e907_rtc::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 [`mcu_e907_rtc::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
80pub struct MCU_E907_RTC_SPEC;
81impl crate::RegisterSpec for MCU_E907_RTC_SPEC {
82    type Ux = u32;
83}
84#[doc = "`read()` method returns [`mcu_e907_rtc::R`](R) reader structure"]
85impl crate::Readable for MCU_E907_RTC_SPEC {}
86#[doc = "`write(|w| ..)` method takes [`mcu_e907_rtc::W`](W) writer structure"]
87impl crate::Writable for MCU_E907_RTC_SPEC {
88    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
89    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
90}
91#[doc = "`reset()` method sets mcu_e907_rtc to value 0"]
92impl crate::Resettable for MCU_E907_RTC_SPEC {
93    const RESET_VALUE: Self::Ux = 0;
94}