stm32f1_staging/stm32f103/bkp/
csr.rs1pub type R = crate::R<CSRrs>;
3pub type W = crate::W<CSRrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum CTEW {
11 Reset = 1,
13}
14impl From<CTEW> for bool {
15 #[inline(always)]
16 fn from(variant: CTEW) -> Self {
17 variant as u8 != 0
18 }
19}
20pub type CTE_W<'a, REG> = crate::BitWriter<'a, REG, CTEW>;
22impl<'a, REG> CTE_W<'a, REG>
23where
24 REG: crate::Writable + crate::RegisterSpec,
25{
26 #[inline(always)]
28 pub fn reset(self) -> &'a mut crate::W<REG> {
29 self.variant(CTEW::Reset)
30 }
31}
32#[cfg_attr(feature = "defmt", derive(defmt::Format))]
36#[derive(Clone, Copy, Debug, PartialEq, Eq)]
37pub enum CTIW {
38 Clear = 1,
40}
41impl From<CTIW> for bool {
42 #[inline(always)]
43 fn from(variant: CTIW) -> Self {
44 variant as u8 != 0
45 }
46}
47pub type CTI_W<'a, REG> = crate::BitWriter<'a, REG, CTIW>;
49impl<'a, REG> CTI_W<'a, REG>
50where
51 REG: crate::Writable + crate::RegisterSpec,
52{
53 #[inline(always)]
55 pub fn clear(self) -> &'a mut crate::W<REG> {
56 self.variant(CTIW::Clear)
57 }
58}
59#[cfg_attr(feature = "defmt", derive(defmt::Format))]
63#[derive(Clone, Copy, Debug, PartialEq, Eq)]
64pub enum TPIE {
65 Disabled = 0,
67 Enabled = 1,
69}
70impl From<TPIE> for bool {
71 #[inline(always)]
72 fn from(variant: TPIE) -> Self {
73 variant as u8 != 0
74 }
75}
76pub type TPIE_R = crate::BitReader<TPIE>;
78impl TPIE_R {
79 #[inline(always)]
81 pub const fn variant(&self) -> TPIE {
82 match self.bits {
83 false => TPIE::Disabled,
84 true => TPIE::Enabled,
85 }
86 }
87 #[inline(always)]
89 pub fn is_disabled(&self) -> bool {
90 *self == TPIE::Disabled
91 }
92 #[inline(always)]
94 pub fn is_enabled(&self) -> bool {
95 *self == TPIE::Enabled
96 }
97}
98pub type TPIE_W<'a, REG> = crate::BitWriter<'a, REG, TPIE>;
100impl<'a, REG> TPIE_W<'a, REG>
101where
102 REG: crate::Writable + crate::RegisterSpec,
103{
104 #[inline(always)]
106 pub fn disabled(self) -> &'a mut crate::W<REG> {
107 self.variant(TPIE::Disabled)
108 }
109 #[inline(always)]
111 pub fn enabled(self) -> &'a mut crate::W<REG> {
112 self.variant(TPIE::Enabled)
113 }
114}
115pub type TEF_R = crate::BitReader;
117pub type TIF_R = crate::BitReader;
119impl R {
120 #[inline(always)]
122 pub fn tpie(&self) -> TPIE_R {
123 TPIE_R::new(((self.bits >> 2) & 1) != 0)
124 }
125 #[inline(always)]
127 pub fn tef(&self) -> TEF_R {
128 TEF_R::new(((self.bits >> 8) & 1) != 0)
129 }
130 #[inline(always)]
132 pub fn tif(&self) -> TIF_R {
133 TIF_R::new(((self.bits >> 9) & 1) != 0)
134 }
135}
136impl core::fmt::Debug for R {
137 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
138 f.debug_struct("CSR")
139 .field("tpie", &self.tpie())
140 .field("tef", &self.tef())
141 .field("tif", &self.tif())
142 .finish()
143 }
144}
145impl W {
146 #[inline(always)]
148 pub fn cte(&mut self) -> CTE_W<CSRrs> {
149 CTE_W::new(self, 0)
150 }
151 #[inline(always)]
153 pub fn cti(&mut self) -> CTI_W<CSRrs> {
154 CTI_W::new(self, 1)
155 }
156 #[inline(always)]
158 pub fn tpie(&mut self) -> TPIE_W<CSRrs> {
159 TPIE_W::new(self, 2)
160 }
161}
162pub struct CSRrs;
168impl crate::RegisterSpec for CSRrs {
169 type Ux = u32;
170}
171impl crate::Readable for CSRrs {}
173impl crate::Writable for CSRrs {
175 type Safety = crate::Unsafe;
176}
177impl crate::Resettable for CSRrs {}