stm32wb_pac/tim1/
ccr5.rs

1#[doc = "Reader of register CCR5"]
2pub type R = crate::R<u32, super::CCR5>;
3#[doc = "Writer for register CCR5"]
4pub type W = crate::W<u32, super::CCR5>;
5#[doc = "Register CCR5 `reset()`'s with value 0"]
6impl crate::ResetValue for super::CCR5 {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `CCR5`"]
14pub type CCR5_R = crate::R<u16, u16>;
15#[doc = "Write proxy for field `CCR5`"]
16pub struct CCR5_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> CCR5_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u16) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0xffff) | ((value as u32) & 0xffff);
24        self.w
25    }
26}
27#[doc = "Reader of field `GC5C1`"]
28pub type GC5C1_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `GC5C1`"]
30pub struct GC5C1_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> GC5C1_W<'a> {
34    #[doc = r"Sets the field bit"]
35    #[inline(always)]
36    pub fn set_bit(self) -> &'a mut W {
37        self.bit(true)
38    }
39    #[doc = r"Clears the field bit"]
40    #[inline(always)]
41    pub fn clear_bit(self) -> &'a mut W {
42        self.bit(false)
43    }
44    #[doc = r"Writes raw bits to the field"]
45    #[inline(always)]
46    pub fn bit(self, value: bool) -> &'a mut W {
47        self.w.bits = (self.w.bits & !(0x01 << 29)) | (((value as u32) & 0x01) << 29);
48        self.w
49    }
50}
51#[doc = "Reader of field `GC5C2`"]
52pub type GC5C2_R = crate::R<bool, bool>;
53#[doc = "Write proxy for field `GC5C2`"]
54pub struct GC5C2_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> GC5C2_W<'a> {
58    #[doc = r"Sets the field bit"]
59    #[inline(always)]
60    pub fn set_bit(self) -> &'a mut W {
61        self.bit(true)
62    }
63    #[doc = r"Clears the field bit"]
64    #[inline(always)]
65    pub fn clear_bit(self) -> &'a mut W {
66        self.bit(false)
67    }
68    #[doc = r"Writes raw bits to the field"]
69    #[inline(always)]
70    pub fn bit(self, value: bool) -> &'a mut W {
71        self.w.bits = (self.w.bits & !(0x01 << 30)) | (((value as u32) & 0x01) << 30);
72        self.w
73    }
74}
75#[doc = "Reader of field `GC5C3`"]
76pub type GC5C3_R = crate::R<bool, bool>;
77#[doc = "Write proxy for field `GC5C3`"]
78pub struct GC5C3_W<'a> {
79    w: &'a mut W,
80}
81impl<'a> GC5C3_W<'a> {
82    #[doc = r"Sets the field bit"]
83    #[inline(always)]
84    pub fn set_bit(self) -> &'a mut W {
85        self.bit(true)
86    }
87    #[doc = r"Clears the field bit"]
88    #[inline(always)]
89    pub fn clear_bit(self) -> &'a mut W {
90        self.bit(false)
91    }
92    #[doc = r"Writes raw bits to the field"]
93    #[inline(always)]
94    pub fn bit(self, value: bool) -> &'a mut W {
95        self.w.bits = (self.w.bits & !(0x01 << 31)) | (((value as u32) & 0x01) << 31);
96        self.w
97    }
98}
99impl R {
100    #[doc = "Bits 0:15 - Capture/Compare value"]
101    #[inline(always)]
102    pub fn ccr5(&self) -> CCR5_R {
103        CCR5_R::new((self.bits & 0xffff) as u16)
104    }
105    #[doc = "Bit 29 - Group Channel 5 and Channel 1"]
106    #[inline(always)]
107    pub fn gc5c1(&self) -> GC5C1_R {
108        GC5C1_R::new(((self.bits >> 29) & 0x01) != 0)
109    }
110    #[doc = "Bit 30 - Group Channel 5 and Channel 2"]
111    #[inline(always)]
112    pub fn gc5c2(&self) -> GC5C2_R {
113        GC5C2_R::new(((self.bits >> 30) & 0x01) != 0)
114    }
115    #[doc = "Bit 31 - Group Channel 5 and Channel 3"]
116    #[inline(always)]
117    pub fn gc5c3(&self) -> GC5C3_R {
118        GC5C3_R::new(((self.bits >> 31) & 0x01) != 0)
119    }
120}
121impl W {
122    #[doc = "Bits 0:15 - Capture/Compare value"]
123    #[inline(always)]
124    pub fn ccr5(&mut self) -> CCR5_W {
125        CCR5_W { w: self }
126    }
127    #[doc = "Bit 29 - Group Channel 5 and Channel 1"]
128    #[inline(always)]
129    pub fn gc5c1(&mut self) -> GC5C1_W {
130        GC5C1_W { w: self }
131    }
132    #[doc = "Bit 30 - Group Channel 5 and Channel 2"]
133    #[inline(always)]
134    pub fn gc5c2(&mut self) -> GC5C2_W {
135        GC5C2_W { w: self }
136    }
137    #[doc = "Bit 31 - Group Channel 5 and Channel 3"]
138    #[inline(always)]
139    pub fn gc5c3(&mut self) -> GC5C3_W {
140        GC5C3_W { w: self }
141    }
142}