stm32l4x2_pac/rtc/
tstr.rs

1#[doc = r" Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5impl super::TSTR {
6    #[doc = r" Reads the contents of the register"]
7    #[inline]
8    pub fn read(&self) -> R {
9        R {
10            bits: self.register.get(),
11        }
12    }
13}
14#[doc = r" Value of the field"]
15pub struct SUR {
16    bits: u8,
17}
18impl SUR {
19    #[doc = r" Value of the field as raw bits"]
20    #[inline]
21    pub fn bits(&self) -> u8 {
22        self.bits
23    }
24}
25#[doc = r" Value of the field"]
26pub struct STR {
27    bits: u8,
28}
29impl STR {
30    #[doc = r" Value of the field as raw bits"]
31    #[inline]
32    pub fn bits(&self) -> u8 {
33        self.bits
34    }
35}
36#[doc = r" Value of the field"]
37pub struct MNUR {
38    bits: u8,
39}
40impl MNUR {
41    #[doc = r" Value of the field as raw bits"]
42    #[inline]
43    pub fn bits(&self) -> u8 {
44        self.bits
45    }
46}
47#[doc = r" Value of the field"]
48pub struct MNTR {
49    bits: u8,
50}
51impl MNTR {
52    #[doc = r" Value of the field as raw bits"]
53    #[inline]
54    pub fn bits(&self) -> u8 {
55        self.bits
56    }
57}
58#[doc = r" Value of the field"]
59pub struct HUR {
60    bits: u8,
61}
62impl HUR {
63    #[doc = r" Value of the field as raw bits"]
64    #[inline]
65    pub fn bits(&self) -> u8 {
66        self.bits
67    }
68}
69#[doc = r" Value of the field"]
70pub struct HTR {
71    bits: u8,
72}
73impl HTR {
74    #[doc = r" Value of the field as raw bits"]
75    #[inline]
76    pub fn bits(&self) -> u8 {
77        self.bits
78    }
79}
80#[doc = r" Value of the field"]
81pub struct PMR {
82    bits: bool,
83}
84impl PMR {
85    #[doc = r" Value of the field as raw bits"]
86    #[inline]
87    pub fn bit(&self) -> bool {
88        self.bits
89    }
90    #[doc = r" Returns `true` if the bit is clear (0)"]
91    #[inline]
92    pub fn bit_is_clear(&self) -> bool {
93        !self.bit()
94    }
95    #[doc = r" Returns `true` if the bit is set (1)"]
96    #[inline]
97    pub fn bit_is_set(&self) -> bool {
98        self.bit()
99    }
100}
101impl R {
102    #[doc = r" Value of the register as raw bits"]
103    #[inline]
104    pub fn bits(&self) -> u32 {
105        self.bits
106    }
107    #[doc = "Bits 0:3 - Second units in BCD format"]
108    #[inline]
109    pub fn su(&self) -> SUR {
110        let bits = {
111            const MASK: u8 = 15;
112            const OFFSET: u8 = 0;
113            ((self.bits >> OFFSET) & MASK as u32) as u8
114        };
115        SUR { bits }
116    }
117    #[doc = "Bits 4:6 - Second tens in BCD format"]
118    #[inline]
119    pub fn st(&self) -> STR {
120        let bits = {
121            const MASK: u8 = 7;
122            const OFFSET: u8 = 4;
123            ((self.bits >> OFFSET) & MASK as u32) as u8
124        };
125        STR { bits }
126    }
127    #[doc = "Bits 8:11 - Minute units in BCD format"]
128    #[inline]
129    pub fn mnu(&self) -> MNUR {
130        let bits = {
131            const MASK: u8 = 15;
132            const OFFSET: u8 = 8;
133            ((self.bits >> OFFSET) & MASK as u32) as u8
134        };
135        MNUR { bits }
136    }
137    #[doc = "Bits 12:14 - Minute tens in BCD format"]
138    #[inline]
139    pub fn mnt(&self) -> MNTR {
140        let bits = {
141            const MASK: u8 = 7;
142            const OFFSET: u8 = 12;
143            ((self.bits >> OFFSET) & MASK as u32) as u8
144        };
145        MNTR { bits }
146    }
147    #[doc = "Bits 16:19 - Hour units in BCD format"]
148    #[inline]
149    pub fn hu(&self) -> HUR {
150        let bits = {
151            const MASK: u8 = 15;
152            const OFFSET: u8 = 16;
153            ((self.bits >> OFFSET) & MASK as u32) as u8
154        };
155        HUR { bits }
156    }
157    #[doc = "Bits 20:21 - Hour tens in BCD format"]
158    #[inline]
159    pub fn ht(&self) -> HTR {
160        let bits = {
161            const MASK: u8 = 3;
162            const OFFSET: u8 = 20;
163            ((self.bits >> OFFSET) & MASK as u32) as u8
164        };
165        HTR { bits }
166    }
167    #[doc = "Bit 22 - AM/PM notation"]
168    #[inline]
169    pub fn pm(&self) -> PMR {
170        let bits = {
171            const MASK: bool = true;
172            const OFFSET: u8 = 22;
173            ((self.bits >> OFFSET) & MASK as u32) != 0
174        };
175        PMR { bits }
176    }
177}