bl602_pac/pwm/
pwm4_config.rs

1#[doc = "Register `pwm4_config` reader"]
2pub struct R(crate::R<PWM4_CONFIG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PWM4_CONFIG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PWM4_CONFIG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PWM4_CONFIG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `pwm4_config` writer"]
17pub struct W(crate::W<PWM4_CONFIG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PWM4_CONFIG_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<PWM4_CONFIG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PWM4_CONFIG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `reg_clk_sel` reader - "]
38pub type REG_CLK_SEL_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `reg_clk_sel` writer - "]
40pub type REG_CLK_SEL_W<'a, const O: u8> =
41    crate::FieldWriter<'a, u32, PWM4_CONFIG_SPEC, u8, u8, 2, O>;
42#[doc = "Field `pwm_out_inv` reader - "]
43pub type PWM_OUT_INV_R = crate::BitReader<bool>;
44#[doc = "Field `pwm_out_inv` writer - "]
45pub type PWM_OUT_INV_W<'a, const O: u8> = crate::BitWriter<'a, u32, PWM4_CONFIG_SPEC, bool, O>;
46#[doc = "Field `pwm_stop_mode` reader - "]
47pub type PWM_STOP_MODE_R = crate::BitReader<bool>;
48#[doc = "Field `pwm_stop_mode` writer - "]
49pub type PWM_STOP_MODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, PWM4_CONFIG_SPEC, bool, O>;
50#[doc = "Field `pwm_sw_force_val` reader - "]
51pub type PWM_SW_FORCE_VAL_R = crate::BitReader<bool>;
52#[doc = "Field `pwm_sw_force_val` writer - "]
53pub type PWM_SW_FORCE_VAL_W<'a, const O: u8> = crate::BitWriter<'a, u32, PWM4_CONFIG_SPEC, bool, O>;
54#[doc = "Field `pwm_sw_mode` reader - "]
55pub type PWM_SW_MODE_R = crate::BitReader<bool>;
56#[doc = "Field `pwm_sw_mode` writer - "]
57pub type PWM_SW_MODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, PWM4_CONFIG_SPEC, bool, O>;
58#[doc = "Field `pwm_stop_en` reader - "]
59pub type PWM_STOP_EN_R = crate::BitReader<bool>;
60#[doc = "Field `pwm_stop_en` writer - "]
61pub type PWM_STOP_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, PWM4_CONFIG_SPEC, bool, O>;
62#[doc = "Field `pwm_sts_top` reader - "]
63pub type PWM_STS_TOP_R = crate::BitReader<bool>;
64impl R {
65    #[doc = "Bits 0:1"]
66    #[inline(always)]
67    pub fn reg_clk_sel(&self) -> REG_CLK_SEL_R {
68        REG_CLK_SEL_R::new((self.bits & 3) as u8)
69    }
70    #[doc = "Bit 2"]
71    #[inline(always)]
72    pub fn pwm_out_inv(&self) -> PWM_OUT_INV_R {
73        PWM_OUT_INV_R::new(((self.bits >> 2) & 1) != 0)
74    }
75    #[doc = "Bit 3"]
76    #[inline(always)]
77    pub fn pwm_stop_mode(&self) -> PWM_STOP_MODE_R {
78        PWM_STOP_MODE_R::new(((self.bits >> 3) & 1) != 0)
79    }
80    #[doc = "Bit 4"]
81    #[inline(always)]
82    pub fn pwm_sw_force_val(&self) -> PWM_SW_FORCE_VAL_R {
83        PWM_SW_FORCE_VAL_R::new(((self.bits >> 4) & 1) != 0)
84    }
85    #[doc = "Bit 5"]
86    #[inline(always)]
87    pub fn pwm_sw_mode(&self) -> PWM_SW_MODE_R {
88        PWM_SW_MODE_R::new(((self.bits >> 5) & 1) != 0)
89    }
90    #[doc = "Bit 6"]
91    #[inline(always)]
92    pub fn pwm_stop_en(&self) -> PWM_STOP_EN_R {
93        PWM_STOP_EN_R::new(((self.bits >> 6) & 1) != 0)
94    }
95    #[doc = "Bit 7"]
96    #[inline(always)]
97    pub fn pwm_sts_top(&self) -> PWM_STS_TOP_R {
98        PWM_STS_TOP_R::new(((self.bits >> 7) & 1) != 0)
99    }
100}
101impl W {
102    #[doc = "Bits 0:1"]
103    #[inline(always)]
104    #[must_use]
105    pub fn reg_clk_sel(&mut self) -> REG_CLK_SEL_W<0> {
106        REG_CLK_SEL_W::new(self)
107    }
108    #[doc = "Bit 2"]
109    #[inline(always)]
110    #[must_use]
111    pub fn pwm_out_inv(&mut self) -> PWM_OUT_INV_W<2> {
112        PWM_OUT_INV_W::new(self)
113    }
114    #[doc = "Bit 3"]
115    #[inline(always)]
116    #[must_use]
117    pub fn pwm_stop_mode(&mut self) -> PWM_STOP_MODE_W<3> {
118        PWM_STOP_MODE_W::new(self)
119    }
120    #[doc = "Bit 4"]
121    #[inline(always)]
122    #[must_use]
123    pub fn pwm_sw_force_val(&mut self) -> PWM_SW_FORCE_VAL_W<4> {
124        PWM_SW_FORCE_VAL_W::new(self)
125    }
126    #[doc = "Bit 5"]
127    #[inline(always)]
128    #[must_use]
129    pub fn pwm_sw_mode(&mut self) -> PWM_SW_MODE_W<5> {
130        PWM_SW_MODE_W::new(self)
131    }
132    #[doc = "Bit 6"]
133    #[inline(always)]
134    #[must_use]
135    pub fn pwm_stop_en(&mut self) -> PWM_STOP_EN_W<6> {
136        PWM_STOP_EN_W::new(self)
137    }
138    #[doc = "Writes raw bits to the register."]
139    #[inline(always)]
140    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
141        self.0.bits(bits);
142        self
143    }
144}
145#[doc = "pwm4_config.\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 [pwm4_config](index.html) module"]
146pub struct PWM4_CONFIG_SPEC;
147impl crate::RegisterSpec for PWM4_CONFIG_SPEC {
148    type Ux = u32;
149}
150#[doc = "`read()` method returns [pwm4_config::R](R) reader structure"]
151impl crate::Readable for PWM4_CONFIG_SPEC {
152    type Reader = R;
153}
154#[doc = "`write(|w| ..)` method takes [pwm4_config::W](W) writer structure"]
155impl crate::Writable for PWM4_CONFIG_SPEC {
156    type Writer = W;
157    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
158    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
159}
160#[doc = "`reset()` method sets pwm4_config to value 0x08"]
161impl crate::Resettable for PWM4_CONFIG_SPEC {
162    const RESET_VALUE: Self::Ux = 0x08;
163}