stm32l4x2_pac/rtc/
tsdr.rs

1#[doc = r" Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5impl super::TSDR {
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 WDUR {
16    bits: u8,
17}
18impl WDUR {
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 MTR {
27    bits: bool,
28}
29impl MTR {
30    #[doc = r" Value of the field as raw bits"]
31    #[inline]
32    pub fn bit(&self) -> bool {
33        self.bits
34    }
35    #[doc = r" Returns `true` if the bit is clear (0)"]
36    #[inline]
37    pub fn bit_is_clear(&self) -> bool {
38        !self.bit()
39    }
40    #[doc = r" Returns `true` if the bit is set (1)"]
41    #[inline]
42    pub fn bit_is_set(&self) -> bool {
43        self.bit()
44    }
45}
46#[doc = r" Value of the field"]
47pub struct MUR {
48    bits: u8,
49}
50impl MUR {
51    #[doc = r" Value of the field as raw bits"]
52    #[inline]
53    pub fn bits(&self) -> u8 {
54        self.bits
55    }
56}
57#[doc = r" Value of the field"]
58pub struct DTR {
59    bits: u8,
60}
61impl DTR {
62    #[doc = r" Value of the field as raw bits"]
63    #[inline]
64    pub fn bits(&self) -> u8 {
65        self.bits
66    }
67}
68#[doc = r" Value of the field"]
69pub struct DUR {
70    bits: u8,
71}
72impl DUR {
73    #[doc = r" Value of the field as raw bits"]
74    #[inline]
75    pub fn bits(&self) -> u8 {
76        self.bits
77    }
78}
79impl R {
80    #[doc = r" Value of the register as raw bits"]
81    #[inline]
82    pub fn bits(&self) -> u32 {
83        self.bits
84    }
85    #[doc = "Bits 13:15 - Week day units"]
86    #[inline]
87    pub fn wdu(&self) -> WDUR {
88        let bits = {
89            const MASK: u8 = 7;
90            const OFFSET: u8 = 13;
91            ((self.bits >> OFFSET) & MASK as u32) as u8
92        };
93        WDUR { bits }
94    }
95    #[doc = "Bit 12 - Month tens in BCD format"]
96    #[inline]
97    pub fn mt(&self) -> MTR {
98        let bits = {
99            const MASK: bool = true;
100            const OFFSET: u8 = 12;
101            ((self.bits >> OFFSET) & MASK as u32) != 0
102        };
103        MTR { bits }
104    }
105    #[doc = "Bits 8:11 - Month units in BCD format"]
106    #[inline]
107    pub fn mu(&self) -> MUR {
108        let bits = {
109            const MASK: u8 = 15;
110            const OFFSET: u8 = 8;
111            ((self.bits >> OFFSET) & MASK as u32) as u8
112        };
113        MUR { bits }
114    }
115    #[doc = "Bits 4:5 - Date tens in BCD format"]
116    #[inline]
117    pub fn dt(&self) -> DTR {
118        let bits = {
119            const MASK: u8 = 3;
120            const OFFSET: u8 = 4;
121            ((self.bits >> OFFSET) & MASK as u32) as u8
122        };
123        DTR { bits }
124    }
125    #[doc = "Bits 0:3 - Date units in BCD format"]
126    #[inline]
127    pub fn du(&self) -> DUR {
128        let bits = {
129            const MASK: u8 = 15;
130            const OFFSET: u8 = 0;
131            ((self.bits >> OFFSET) & MASK as u32) as u8
132        };
133        DUR { bits }
134    }
135}