stm32f7_staging/stm32f779/lptim1/
cr.rs1pub type R = crate::R<CRrs>;
3pub type W = crate::W<CRrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum ENABLE {
11 Disabled = 0,
13 Enabled = 1,
15}
16impl From<ENABLE> for bool {
17 #[inline(always)]
18 fn from(variant: ENABLE) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type ENABLE_R = crate::BitReader<ENABLE>;
24impl ENABLE_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> ENABLE {
28 match self.bits {
29 false => ENABLE::Disabled,
30 true => ENABLE::Enabled,
31 }
32 }
33 #[inline(always)]
35 pub fn is_disabled(&self) -> bool {
36 *self == ENABLE::Disabled
37 }
38 #[inline(always)]
40 pub fn is_enabled(&self) -> bool {
41 *self == ENABLE::Enabled
42 }
43}
44pub type ENABLE_W<'a, REG> = crate::BitWriter<'a, REG, ENABLE>;
46impl<'a, REG> ENABLE_W<'a, REG>
47where
48 REG: crate::Writable + crate::RegisterSpec,
49{
50 #[inline(always)]
52 pub fn disabled(self) -> &'a mut crate::W<REG> {
53 self.variant(ENABLE::Disabled)
54 }
55 #[inline(always)]
57 pub fn enabled(self) -> &'a mut crate::W<REG> {
58 self.variant(ENABLE::Enabled)
59 }
60}
61#[cfg_attr(feature = "defmt", derive(defmt::Format))]
65#[derive(Clone, Copy, Debug, PartialEq, Eq)]
66pub enum SNGSTRTW {
67 Start = 1,
69}
70impl From<SNGSTRTW> for bool {
71 #[inline(always)]
72 fn from(variant: SNGSTRTW) -> Self {
73 variant as u8 != 0
74 }
75}
76pub type SNGSTRT_R = crate::BitReader<SNGSTRTW>;
78impl SNGSTRT_R {
79 #[inline(always)]
81 pub const fn variant(&self) -> Option<SNGSTRTW> {
82 match self.bits {
83 true => Some(SNGSTRTW::Start),
84 _ => None,
85 }
86 }
87 #[inline(always)]
89 pub fn is_start(&self) -> bool {
90 *self == SNGSTRTW::Start
91 }
92}
93pub type SNGSTRT_W<'a, REG> = crate::BitWriter<'a, REG, SNGSTRTW>;
95impl<'a, REG> SNGSTRT_W<'a, REG>
96where
97 REG: crate::Writable + crate::RegisterSpec,
98{
99 #[inline(always)]
101 pub fn start(self) -> &'a mut crate::W<REG> {
102 self.variant(SNGSTRTW::Start)
103 }
104}
105#[cfg_attr(feature = "defmt", derive(defmt::Format))]
109#[derive(Clone, Copy, Debug, PartialEq, Eq)]
110pub enum CNTSTRTW {
111 Start = 1,
113}
114impl From<CNTSTRTW> for bool {
115 #[inline(always)]
116 fn from(variant: CNTSTRTW) -> Self {
117 variant as u8 != 0
118 }
119}
120pub type CNTSTRT_R = crate::BitReader<CNTSTRTW>;
122impl CNTSTRT_R {
123 #[inline(always)]
125 pub const fn variant(&self) -> Option<CNTSTRTW> {
126 match self.bits {
127 true => Some(CNTSTRTW::Start),
128 _ => None,
129 }
130 }
131 #[inline(always)]
133 pub fn is_start(&self) -> bool {
134 *self == CNTSTRTW::Start
135 }
136}
137pub type CNTSTRT_W<'a, REG> = crate::BitWriter<'a, REG, CNTSTRTW>;
139impl<'a, REG> CNTSTRT_W<'a, REG>
140where
141 REG: crate::Writable + crate::RegisterSpec,
142{
143 #[inline(always)]
145 pub fn start(self) -> &'a mut crate::W<REG> {
146 self.variant(CNTSTRTW::Start)
147 }
148}
149impl R {
150 #[inline(always)]
152 pub fn enable(&self) -> ENABLE_R {
153 ENABLE_R::new((self.bits & 1) != 0)
154 }
155 #[inline(always)]
157 pub fn sngstrt(&self) -> SNGSTRT_R {
158 SNGSTRT_R::new(((self.bits >> 1) & 1) != 0)
159 }
160 #[inline(always)]
162 pub fn cntstrt(&self) -> CNTSTRT_R {
163 CNTSTRT_R::new(((self.bits >> 2) & 1) != 0)
164 }
165}
166impl core::fmt::Debug for R {
167 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
168 f.debug_struct("CR")
169 .field("cntstrt", &self.cntstrt())
170 .field("sngstrt", &self.sngstrt())
171 .field("enable", &self.enable())
172 .finish()
173 }
174}
175impl W {
176 #[inline(always)]
178 pub fn enable(&mut self) -> ENABLE_W<CRrs> {
179 ENABLE_W::new(self, 0)
180 }
181 #[inline(always)]
183 pub fn sngstrt(&mut self) -> SNGSTRT_W<CRrs> {
184 SNGSTRT_W::new(self, 1)
185 }
186 #[inline(always)]
188 pub fn cntstrt(&mut self) -> CNTSTRT_W<CRrs> {
189 CNTSTRT_W::new(self, 2)
190 }
191}
192pub struct CRrs;
198impl crate::RegisterSpec for CRrs {
199 type Ux = u32;
200}
201impl crate::Readable for CRrs {}
203impl crate::Writable for CRrs {
205 type Safety = crate::Unsafe;
206}
207impl crate::Resettable for CRrs {}