efm32pg12_pac/rtcc/
cc2_time.rs

1#[doc = "Reader of register CC2_TIME"]
2pub type R = crate::R<u32, super::CC2_TIME>;
3#[doc = "Writer for register CC2_TIME"]
4pub type W = crate::W<u32, super::CC2_TIME>;
5#[doc = "Register CC2_TIME `reset()`'s with value 0"]
6impl crate::ResetValue for super::CC2_TIME {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `SECU`"]
14pub type SECU_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `SECU`"]
16pub struct SECU_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> SECU_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 & !0x0f) | ((value as u32) & 0x0f);
24        self.w
25    }
26}
27#[doc = "Reader of field `SECT`"]
28pub type SECT_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `SECT`"]
30pub struct SECT_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> SECT_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 & !(0x07 << 4)) | (((value as u32) & 0x07) << 4);
38        self.w
39    }
40}
41#[doc = "Reader of field `MINU`"]
42pub type MINU_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `MINU`"]
44pub struct MINU_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> MINU_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 & !(0x0f << 8)) | (((value as u32) & 0x0f) << 8);
52        self.w
53    }
54}
55#[doc = "Reader of field `MINT`"]
56pub type MINT_R = crate::R<u8, u8>;
57#[doc = "Write proxy for field `MINT`"]
58pub struct MINT_W<'a> {
59    w: &'a mut W,
60}
61impl<'a> MINT_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 & !(0x07 << 12)) | (((value as u32) & 0x07) << 12);
66        self.w
67    }
68}
69#[doc = "Reader of field `HOURU`"]
70pub type HOURU_R = crate::R<u8, u8>;
71#[doc = "Write proxy for field `HOURU`"]
72pub struct HOURU_W<'a> {
73    w: &'a mut W,
74}
75impl<'a> HOURU_W<'a> {
76    #[doc = r"Writes raw bits to the field"]
77    #[inline(always)]
78    pub unsafe fn bits(self, value: u8) -> &'a mut W {
79        self.w.bits = (self.w.bits & !(0x0f << 16)) | (((value as u32) & 0x0f) << 16);
80        self.w
81    }
82}
83#[doc = "Reader of field `HOURT`"]
84pub type HOURT_R = crate::R<u8, u8>;
85#[doc = "Write proxy for field `HOURT`"]
86pub struct HOURT_W<'a> {
87    w: &'a mut W,
88}
89impl<'a> HOURT_W<'a> {
90    #[doc = r"Writes raw bits to the field"]
91    #[inline(always)]
92    pub unsafe fn bits(self, value: u8) -> &'a mut W {
93        self.w.bits = (self.w.bits & !(0x03 << 20)) | (((value as u32) & 0x03) << 20);
94        self.w
95    }
96}
97impl R {
98    #[doc = "Bits 0:3 - Seconds, Units"]
99    #[inline(always)]
100    pub fn secu(&self) -> SECU_R {
101        SECU_R::new((self.bits & 0x0f) as u8)
102    }
103    #[doc = "Bits 4:6 - Seconds, Tens"]
104    #[inline(always)]
105    pub fn sect(&self) -> SECT_R {
106        SECT_R::new(((self.bits >> 4) & 0x07) as u8)
107    }
108    #[doc = "Bits 8:11 - Minutes, Units"]
109    #[inline(always)]
110    pub fn minu(&self) -> MINU_R {
111        MINU_R::new(((self.bits >> 8) & 0x0f) as u8)
112    }
113    #[doc = "Bits 12:14 - Minutes, Tens"]
114    #[inline(always)]
115    pub fn mint(&self) -> MINT_R {
116        MINT_R::new(((self.bits >> 12) & 0x07) as u8)
117    }
118    #[doc = "Bits 16:19 - Hours, Units"]
119    #[inline(always)]
120    pub fn houru(&self) -> HOURU_R {
121        HOURU_R::new(((self.bits >> 16) & 0x0f) as u8)
122    }
123    #[doc = "Bits 20:21 - Hours, Tens"]
124    #[inline(always)]
125    pub fn hourt(&self) -> HOURT_R {
126        HOURT_R::new(((self.bits >> 20) & 0x03) as u8)
127    }
128}
129impl W {
130    #[doc = "Bits 0:3 - Seconds, Units"]
131    #[inline(always)]
132    pub fn secu(&mut self) -> SECU_W {
133        SECU_W { w: self }
134    }
135    #[doc = "Bits 4:6 - Seconds, Tens"]
136    #[inline(always)]
137    pub fn sect(&mut self) -> SECT_W {
138        SECT_W { w: self }
139    }
140    #[doc = "Bits 8:11 - Minutes, Units"]
141    #[inline(always)]
142    pub fn minu(&mut self) -> MINU_W {
143        MINU_W { w: self }
144    }
145    #[doc = "Bits 12:14 - Minutes, Tens"]
146    #[inline(always)]
147    pub fn mint(&mut self) -> MINT_W {
148        MINT_W { w: self }
149    }
150    #[doc = "Bits 16:19 - Hours, Units"]
151    #[inline(always)]
152    pub fn houru(&mut self) -> HOURU_W {
153        HOURU_W { w: self }
154    }
155    #[doc = "Bits 20:21 - Hours, Tens"]
156    #[inline(always)]
157    pub fn hourt(&mut self) -> HOURT_W {
158        HOURT_W { w: self }
159    }
160}