bl616_pac/pwm/group/
dead_time.rs

1#[doc = "Register `dead_time` reader"]
2pub struct R(crate::R<DEAD_TIME_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<DEAD_TIME_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<DEAD_TIME_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<DEAD_TIME_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `dead_time` writer"]
17pub struct W(crate::W<DEAD_TIME_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<DEAD_TIME_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<DEAD_TIME_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<DEAD_TIME_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `channel[0-3]` reader - Dead time for each channel in cycles"]
38pub type CHANNEL_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `channel[0-3]` writer - Dead time for each channel in cycles"]
40pub type CHANNEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, DEAD_TIME_SPEC, u8, u8, 8, O>;
41impl R {
42    #[doc = "Dead time for each channel in cycles"]
43    #[inline(always)]
44    pub unsafe fn channel(&self, n: u8) -> CHANNEL_R {
45        CHANNEL_R::new(((self.bits >> (n * 8)) & 0xff) as u8)
46    }
47    #[doc = "Bits 0:7 - Dead time for each channel in cycles"]
48    #[inline(always)]
49    pub fn channel0(&self) -> CHANNEL_R {
50        CHANNEL_R::new((self.bits & 0xff) as u8)
51    }
52    #[doc = "Bits 8:15 - Dead time for each channel in cycles"]
53    #[inline(always)]
54    pub fn channel1(&self) -> CHANNEL_R {
55        CHANNEL_R::new(((self.bits >> 8) & 0xff) as u8)
56    }
57    #[doc = "Bits 16:23 - Dead time for each channel in cycles"]
58    #[inline(always)]
59    pub fn channel2(&self) -> CHANNEL_R {
60        CHANNEL_R::new(((self.bits >> 16) & 0xff) as u8)
61    }
62    #[doc = "Bits 24:31 - Dead time for each channel in cycles"]
63    #[inline(always)]
64    pub fn channel3(&self) -> CHANNEL_R {
65        CHANNEL_R::new(((self.bits >> 24) & 0xff) as u8)
66    }
67}
68impl W {
69    #[doc = "Dead time for each channel in cycles"]
70    #[inline(always)]
71    #[must_use]
72    pub unsafe fn channel<const O: u8>(&mut self) -> CHANNEL_W<O> {
73        CHANNEL_W::new(self)
74    }
75    #[doc = "Bits 0:7 - Dead time for each channel in cycles"]
76    #[inline(always)]
77    #[must_use]
78    pub fn channel0(&mut self) -> CHANNEL_W<0> {
79        CHANNEL_W::new(self)
80    }
81    #[doc = "Bits 8:15 - Dead time for each channel in cycles"]
82    #[inline(always)]
83    #[must_use]
84    pub fn channel1(&mut self) -> CHANNEL_W<8> {
85        CHANNEL_W::new(self)
86    }
87    #[doc = "Bits 16:23 - Dead time for each channel in cycles"]
88    #[inline(always)]
89    #[must_use]
90    pub fn channel2(&mut self) -> CHANNEL_W<16> {
91        CHANNEL_W::new(self)
92    }
93    #[doc = "Bits 24:31 - Dead time for each channel in cycles"]
94    #[inline(always)]
95    #[must_use]
96    pub fn channel3(&mut self) -> CHANNEL_W<24> {
97        CHANNEL_W::new(self)
98    }
99    #[doc = "Writes raw bits to the register."]
100    #[inline(always)]
101    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
102        self.0.bits(bits);
103        self
104    }
105}
106#[doc = "Dead time for each channel\n\nThis 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).\n\nFor information about available fields see [dead_time](index.html) module"]
107pub struct DEAD_TIME_SPEC;
108impl crate::RegisterSpec for DEAD_TIME_SPEC {
109    type Ux = u32;
110}
111#[doc = "`read()` method returns [dead_time::R](R) reader structure"]
112impl crate::Readable for DEAD_TIME_SPEC {
113    type Reader = R;
114}
115#[doc = "`write(|w| ..)` method takes [dead_time::W](W) writer structure"]
116impl crate::Writable for DEAD_TIME_SPEC {
117    type Writer = W;
118    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
119    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
120}
121#[doc = "`reset()` method sets dead_time to value 0"]
122impl crate::Resettable for DEAD_TIME_SPEC {
123    const RESET_VALUE: Self::Ux = 0;
124}