ambiq_apollo2_pac/rtc/
ctrlow.rs

1#[doc = "Reader of register CTRLOW"]
2pub type R = crate::R<u32, super::CTRLOW>;
3#[doc = "Writer for register CTRLOW"]
4pub type W = crate::W<u32, super::CTRLOW>;
5#[doc = "Register CTRLOW `reset()`'s with value 0x0100_0000"]
6impl crate::ResetValue for super::CTRLOW {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x0100_0000
11    }
12}
13#[doc = "Reader of field `CTRHR`"]
14pub type CTRHR_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `CTRHR`"]
16pub struct CTRHR_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> CTRHR_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u8) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0x3f << 24)) | (((value as u32) & 0x3f) << 24);
24        self.w
25    }
26}
27#[doc = "Reader of field `CTRMIN`"]
28pub type CTRMIN_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `CTRMIN`"]
30pub struct CTRMIN_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> CTRMIN_W<'a> {
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub unsafe fn bits(self, value: u8) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0x7f << 16)) | (((value as u32) & 0x7f) << 16);
38        self.w
39    }
40}
41#[doc = "Reader of field `CTRSEC`"]
42pub type CTRSEC_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `CTRSEC`"]
44pub struct CTRSEC_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> CTRSEC_W<'a> {
48    #[doc = r"Writes raw bits to the field"]
49    #[inline(always)]
50    pub unsafe fn bits(self, value: u8) -> &'a mut W {
51        self.w.bits = (self.w.bits & !(0x7f << 8)) | (((value as u32) & 0x7f) << 8);
52        self.w
53    }
54}
55#[doc = "Reader of field `CTR100`"]
56pub type CTR100_R = crate::R<u8, u8>;
57#[doc = "Write proxy for field `CTR100`"]
58pub struct CTR100_W<'a> {
59    w: &'a mut W,
60}
61impl<'a> CTR100_W<'a> {
62    #[doc = r"Writes raw bits to the field"]
63    #[inline(always)]
64    pub unsafe fn bits(self, value: u8) -> &'a mut W {
65        self.w.bits = (self.w.bits & !0xff) | ((value as u32) & 0xff);
66        self.w
67    }
68}
69impl R {
70    #[doc = "Bits 24:29 - Hours Counter"]
71    #[inline(always)]
72    pub fn ctrhr(&self) -> CTRHR_R {
73        CTRHR_R::new(((self.bits >> 24) & 0x3f) as u8)
74    }
75    #[doc = "Bits 16:22 - Minutes Counter"]
76    #[inline(always)]
77    pub fn ctrmin(&self) -> CTRMIN_R {
78        CTRMIN_R::new(((self.bits >> 16) & 0x7f) as u8)
79    }
80    #[doc = "Bits 8:14 - Seconds Counter"]
81    #[inline(always)]
82    pub fn ctrsec(&self) -> CTRSEC_R {
83        CTRSEC_R::new(((self.bits >> 8) & 0x7f) as u8)
84    }
85    #[doc = "Bits 0:7 - 100ths of a second Counter"]
86    #[inline(always)]
87    pub fn ctr100(&self) -> CTR100_R {
88        CTR100_R::new((self.bits & 0xff) as u8)
89    }
90}
91impl W {
92    #[doc = "Bits 24:29 - Hours Counter"]
93    #[inline(always)]
94    pub fn ctrhr(&mut self) -> CTRHR_W {
95        CTRHR_W { w: self }
96    }
97    #[doc = "Bits 16:22 - Minutes Counter"]
98    #[inline(always)]
99    pub fn ctrmin(&mut self) -> CTRMIN_W {
100        CTRMIN_W { w: self }
101    }
102    #[doc = "Bits 8:14 - Seconds Counter"]
103    #[inline(always)]
104    pub fn ctrsec(&mut self) -> CTRSEC_W {
105        CTRSEC_W { w: self }
106    }
107    #[doc = "Bits 0:7 - 100ths of a second Counter"]
108    #[inline(always)]
109    pub fn ctr100(&mut self) -> CTR100_W {
110        CTR100_W { w: self }
111    }
112}