py32f0/py32f003/tim16/
bdtr.rs

1///Register `BDTR` reader
2pub struct R(crate::R<BDTR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<BDTR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<BDTR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<BDTR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16///Register `BDTR` writer
17pub struct W(crate::W<BDTR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<BDTR_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<BDTR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<BDTR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37///Field `DTG` reader - Dead-time generator setup
38pub type DTG_R = crate::FieldReader<u8, u8>;
39///Field `DTG` writer - Dead-time generator setup
40pub type DTG_W<'a, const O: u8> = crate::FieldWriter<'a, u32, BDTR_SPEC, u8, u8, 8, O>;
41///Field `LOCK` reader - Lock configuration
42pub type LOCK_R = crate::FieldReader<u8, u8>;
43///Field `LOCK` writer - Lock configuration
44pub type LOCK_W<'a, const O: u8> = crate::FieldWriter<'a, u32, BDTR_SPEC, u8, u8, 2, O>;
45///Field `OSSI` reader - Off-state selection for Idle mode
46pub type OSSI_R = crate::BitReader<bool>;
47///Field `OSSI` writer - Off-state selection for Idle mode
48pub type OSSI_W<'a, const O: u8> = crate::BitWriter<'a, u32, BDTR_SPEC, bool, O>;
49///Field `OSSR` reader - Off-state selection for Run mode
50pub type OSSR_R = crate::BitReader<bool>;
51///Field `OSSR` writer - Off-state selection for Run mode
52pub type OSSR_W<'a, const O: u8> = crate::BitWriter<'a, u32, BDTR_SPEC, bool, O>;
53///Field `BKE` reader - Break enable
54pub type BKE_R = crate::BitReader<bool>;
55///Field `BKE` writer - Break enable
56pub type BKE_W<'a, const O: u8> = crate::BitWriter<'a, u32, BDTR_SPEC, bool, O>;
57///Field `BKP` reader - Break polarity
58pub type BKP_R = crate::BitReader<bool>;
59///Field `BKP` writer - Break polarity
60pub type BKP_W<'a, const O: u8> = crate::BitWriter<'a, u32, BDTR_SPEC, bool, O>;
61///Field `AOE` reader - Automatic output enable
62pub type AOE_R = crate::BitReader<bool>;
63///Field `AOE` writer - Automatic output enable
64pub type AOE_W<'a, const O: u8> = crate::BitWriter<'a, u32, BDTR_SPEC, bool, O>;
65///Field `MOE` reader - Main output enable
66pub type MOE_R = crate::BitReader<bool>;
67///Field `MOE` writer - Main output enable
68pub type MOE_W<'a, const O: u8> = crate::BitWriter<'a, u32, BDTR_SPEC, bool, O>;
69impl R {
70    ///Bits 0:7 - Dead-time generator setup
71    #[inline(always)]
72    pub fn dtg(&self) -> DTG_R {
73        DTG_R::new((self.bits & 0xff) as u8)
74    }
75    ///Bits 8:9 - Lock configuration
76    #[inline(always)]
77    pub fn lock(&self) -> LOCK_R {
78        LOCK_R::new(((self.bits >> 8) & 3) as u8)
79    }
80    ///Bit 10 - Off-state selection for Idle mode
81    #[inline(always)]
82    pub fn ossi(&self) -> OSSI_R {
83        OSSI_R::new(((self.bits >> 10) & 1) != 0)
84    }
85    ///Bit 11 - Off-state selection for Run mode
86    #[inline(always)]
87    pub fn ossr(&self) -> OSSR_R {
88        OSSR_R::new(((self.bits >> 11) & 1) != 0)
89    }
90    ///Bit 12 - Break enable
91    #[inline(always)]
92    pub fn bke(&self) -> BKE_R {
93        BKE_R::new(((self.bits >> 12) & 1) != 0)
94    }
95    ///Bit 13 - Break polarity
96    #[inline(always)]
97    pub fn bkp(&self) -> BKP_R {
98        BKP_R::new(((self.bits >> 13) & 1) != 0)
99    }
100    ///Bit 14 - Automatic output enable
101    #[inline(always)]
102    pub fn aoe(&self) -> AOE_R {
103        AOE_R::new(((self.bits >> 14) & 1) != 0)
104    }
105    ///Bit 15 - Main output enable
106    #[inline(always)]
107    pub fn moe(&self) -> MOE_R {
108        MOE_R::new(((self.bits >> 15) & 1) != 0)
109    }
110}
111impl W {
112    ///Bits 0:7 - Dead-time generator setup
113    #[inline(always)]
114    #[must_use]
115    pub fn dtg(&mut self) -> DTG_W<0> {
116        DTG_W::new(self)
117    }
118    ///Bits 8:9 - Lock configuration
119    #[inline(always)]
120    #[must_use]
121    pub fn lock(&mut self) -> LOCK_W<8> {
122        LOCK_W::new(self)
123    }
124    ///Bit 10 - Off-state selection for Idle mode
125    #[inline(always)]
126    #[must_use]
127    pub fn ossi(&mut self) -> OSSI_W<10> {
128        OSSI_W::new(self)
129    }
130    ///Bit 11 - Off-state selection for Run mode
131    #[inline(always)]
132    #[must_use]
133    pub fn ossr(&mut self) -> OSSR_W<11> {
134        OSSR_W::new(self)
135    }
136    ///Bit 12 - Break enable
137    #[inline(always)]
138    #[must_use]
139    pub fn bke(&mut self) -> BKE_W<12> {
140        BKE_W::new(self)
141    }
142    ///Bit 13 - Break polarity
143    #[inline(always)]
144    #[must_use]
145    pub fn bkp(&mut self) -> BKP_W<13> {
146        BKP_W::new(self)
147    }
148    ///Bit 14 - Automatic output enable
149    #[inline(always)]
150    #[must_use]
151    pub fn aoe(&mut self) -> AOE_W<14> {
152        AOE_W::new(self)
153    }
154    ///Bit 15 - Main output enable
155    #[inline(always)]
156    #[must_use]
157    pub fn moe(&mut self) -> MOE_W<15> {
158        MOE_W::new(self)
159    }
160    ///Writes raw bits to the register.
161    #[inline(always)]
162    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
163        self.0.bits(bits);
164        self
165    }
166}
167/**break and dead-time register
168
169This register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).
170
171For information about available fields see [bdtr](index.html) module*/
172pub struct BDTR_SPEC;
173impl crate::RegisterSpec for BDTR_SPEC {
174    type Ux = u32;
175}
176///`read()` method returns [bdtr::R](R) reader structure
177impl crate::Readable for BDTR_SPEC {
178    type Reader = R;
179}
180///`write(|w| ..)` method takes [bdtr::W](W) writer structure
181impl crate::Writable for BDTR_SPEC {
182    type Writer = W;
183    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
184    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
185}
186///`reset()` method sets BDTR to value 0
187impl crate::Resettable for BDTR_SPEC {
188    const RESET_VALUE: Self::Ux = 0;
189}