swm341_pac/pwm0/
brkcr.rs

1#[doc = "Register `BRKCR` reader"]
2pub struct R(crate::R<BRKCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<BRKCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<BRKCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<BRKCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `BRKCR` writer"]
17pub struct W(crate::W<BRKCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<BRKCR_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<BRKCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<BRKCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `OUTA` reader - OUTA field"]
38pub type OUTA_R = crate::BitReader<bool>;
39#[doc = "Field `OUTA` writer - OUTA field"]
40pub type OUTA_W<'a, const O: u8> = crate::BitWriter<'a, u32, BRKCR_SPEC, bool, O>;
41#[doc = "Field `OFFA` reader - OFFA field"]
42pub type OFFA_R = crate::BitReader<bool>;
43#[doc = "Field `OFFA` writer - OFFA field"]
44pub type OFFA_W<'a, const O: u8> = crate::BitWriter<'a, u32, BRKCR_SPEC, bool, O>;
45#[doc = "Field `OUTB` reader - OUTB field"]
46pub type OUTB_R = crate::BitReader<bool>;
47#[doc = "Field `OUTB` writer - OUTB field"]
48pub type OUTB_W<'a, const O: u8> = crate::BitWriter<'a, u32, BRKCR_SPEC, bool, O>;
49#[doc = "Field `OFFB` reader - OFFB field"]
50pub type OFFB_R = crate::BitReader<bool>;
51#[doc = "Field `OFFB` writer - OFFB field"]
52pub type OFFB_W<'a, const O: u8> = crate::BitWriter<'a, u32, BRKCR_SPEC, bool, O>;
53#[doc = "Field `OUTAN` reader - OUTAN field"]
54pub type OUTAN_R = crate::BitReader<bool>;
55#[doc = "Field `OUTAN` writer - OUTAN field"]
56pub type OUTAN_W<'a, const O: u8> = crate::BitWriter<'a, u32, BRKCR_SPEC, bool, O>;
57#[doc = "Field `OUTBN` reader - OUTBN field"]
58pub type OUTBN_R = crate::BitReader<bool>;
59#[doc = "Field `OUTBN` writer - OUTBN field"]
60pub type OUTBN_W<'a, const O: u8> = crate::BitWriter<'a, u32, BRKCR_SPEC, bool, O>;
61#[doc = "Field `STPCNT` reader - STPCNT field"]
62pub type STPCNT_R = crate::BitReader<bool>;
63#[doc = "Field `STPCNT` writer - STPCNT field"]
64pub type STPCNT_W<'a, const O: u8> = crate::BitWriter<'a, u32, BRKCR_SPEC, bool, O>;
65#[doc = "Field `ACTIVE` reader - ACTIVE field"]
66pub type ACTIVE_R = crate::BitReader<bool>;
67#[doc = "Field `ACTIVE` writer - ACTIVE field"]
68pub type ACTIVE_W<'a, const O: u8> = crate::BitWriter<'a, u32, BRKCR_SPEC, bool, O>;
69impl R {
70    #[doc = "Bit 0 - OUTA field"]
71    #[inline(always)]
72    pub fn outa(&self) -> OUTA_R {
73        OUTA_R::new((self.bits & 1) != 0)
74    }
75    #[doc = "Bit 1 - OFFA field"]
76    #[inline(always)]
77    pub fn offa(&self) -> OFFA_R {
78        OFFA_R::new(((self.bits >> 1) & 1) != 0)
79    }
80    #[doc = "Bit 4 - OUTB field"]
81    #[inline(always)]
82    pub fn outb(&self) -> OUTB_R {
83        OUTB_R::new(((self.bits >> 4) & 1) != 0)
84    }
85    #[doc = "Bit 5 - OFFB field"]
86    #[inline(always)]
87    pub fn offb(&self) -> OFFB_R {
88        OFFB_R::new(((self.bits >> 5) & 1) != 0)
89    }
90    #[doc = "Bit 8 - OUTAN field"]
91    #[inline(always)]
92    pub fn outan(&self) -> OUTAN_R {
93        OUTAN_R::new(((self.bits >> 8) & 1) != 0)
94    }
95    #[doc = "Bit 9 - OUTBN field"]
96    #[inline(always)]
97    pub fn outbn(&self) -> OUTBN_R {
98        OUTBN_R::new(((self.bits >> 9) & 1) != 0)
99    }
100    #[doc = "Bit 10 - STPCNT field"]
101    #[inline(always)]
102    pub fn stpcnt(&self) -> STPCNT_R {
103        STPCNT_R::new(((self.bits >> 10) & 1) != 0)
104    }
105    #[doc = "Bit 17 - ACTIVE field"]
106    #[inline(always)]
107    pub fn active(&self) -> ACTIVE_R {
108        ACTIVE_R::new(((self.bits >> 17) & 1) != 0)
109    }
110}
111impl W {
112    #[doc = "Bit 0 - OUTA field"]
113    #[inline(always)]
114    pub fn outa(&mut self) -> OUTA_W<0> {
115        OUTA_W::new(self)
116    }
117    #[doc = "Bit 1 - OFFA field"]
118    #[inline(always)]
119    pub fn offa(&mut self) -> OFFA_W<1> {
120        OFFA_W::new(self)
121    }
122    #[doc = "Bit 4 - OUTB field"]
123    #[inline(always)]
124    pub fn outb(&mut self) -> OUTB_W<4> {
125        OUTB_W::new(self)
126    }
127    #[doc = "Bit 5 - OFFB field"]
128    #[inline(always)]
129    pub fn offb(&mut self) -> OFFB_W<5> {
130        OFFB_W::new(self)
131    }
132    #[doc = "Bit 8 - OUTAN field"]
133    #[inline(always)]
134    pub fn outan(&mut self) -> OUTAN_W<8> {
135        OUTAN_W::new(self)
136    }
137    #[doc = "Bit 9 - OUTBN field"]
138    #[inline(always)]
139    pub fn outbn(&mut self) -> OUTBN_W<9> {
140        OUTBN_W::new(self)
141    }
142    #[doc = "Bit 10 - STPCNT field"]
143    #[inline(always)]
144    pub fn stpcnt(&mut self) -> STPCNT_W<10> {
145        STPCNT_W::new(self)
146    }
147    #[doc = "Bit 17 - ACTIVE field"]
148    #[inline(always)]
149    pub fn active(&mut self) -> ACTIVE_W<17> {
150        ACTIVE_W::new(self)
151    }
152    #[doc = "Writes raw bits to the register."]
153    #[inline(always)]
154    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
155        self.0.bits(bits);
156        self
157    }
158}
159#[doc = "BRKCR register\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 [brkcr](index.html) module"]
160pub struct BRKCR_SPEC;
161impl crate::RegisterSpec for BRKCR_SPEC {
162    type Ux = u32;
163}
164#[doc = "`read()` method returns [brkcr::R](R) reader structure"]
165impl crate::Readable for BRKCR_SPEC {
166    type Reader = R;
167}
168#[doc = "`write(|w| ..)` method takes [brkcr::W](W) writer structure"]
169impl crate::Writable for BRKCR_SPEC {
170    type Writer = W;
171}
172#[doc = "`reset()` method sets BRKCR to value 0"]
173impl crate::Resettable for BRKCR_SPEC {
174    #[inline(always)]
175    fn reset_value() -> Self::Ux {
176        0
177    }
178}