msp432e4/pwm0/
_2_cmpb.rs

1#[doc = r"Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5#[doc = r"Value to write to the register"]
6pub struct W {
7    bits: u32,
8}
9impl super::_2_CMPB {
10    #[doc = r"Modifies the contents of the register"]
11    #[inline(always)]
12    pub fn modify<F>(&self, f: F)
13    where
14        for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15    {
16        let bits = self.register.get();
17        self.register.set(f(&R { bits }, &mut W { bits }).bits);
18    }
19    #[doc = r"Reads the contents of the register"]
20    #[inline(always)]
21    pub fn read(&self) -> R {
22        R {
23            bits: self.register.get(),
24        }
25    }
26    #[doc = r"Writes to the register"]
27    #[inline(always)]
28    pub fn write<F>(&self, f: F)
29    where
30        F: FnOnce(&mut W) -> &mut W,
31    {
32        self.register.set(
33            f(&mut W {
34                bits: Self::reset_value(),
35            })
36            .bits,
37        );
38    }
39    #[doc = r"Reset value of the register"]
40    #[inline(always)]
41    pub const fn reset_value() -> u32 {
42        0
43    }
44    #[doc = r"Writes the reset value to the register"]
45    #[inline(always)]
46    pub fn reset(&self) {
47        self.register.set(Self::reset_value())
48    }
49}
50#[doc = r"Value of the field"]
51pub struct PWM_2_CMPB_COMPBR {
52    bits: u16,
53}
54impl PWM_2_CMPB_COMPBR {
55    #[doc = r"Value of the field as raw bits"]
56    #[inline(always)]
57    pub fn bits(&self) -> u16 {
58        self.bits
59    }
60}
61#[doc = r"Proxy"]
62pub struct _PWM_2_CMPB_COMPBW<'a> {
63    w: &'a mut W,
64}
65impl<'a> _PWM_2_CMPB_COMPBW<'a> {
66    #[doc = r"Writes raw bits to the field"]
67    #[inline(always)]
68    pub unsafe fn bits(self, value: u16) -> &'a mut W {
69        self.w.bits &= !(65535 << 0);
70        self.w.bits |= ((value as u32) & 65535) << 0;
71        self.w
72    }
73}
74impl R {
75    #[doc = r"Value of the register as raw bits"]
76    #[inline(always)]
77    pub fn bits(&self) -> u32 {
78        self.bits
79    }
80    #[doc = "Bits 0:15 - Comparator B Value"]
81    #[inline(always)]
82    pub fn pwm_2_cmpb_compb(&self) -> PWM_2_CMPB_COMPBR {
83        let bits = ((self.bits >> 0) & 65535) as u16;
84        PWM_2_CMPB_COMPBR { bits }
85    }
86}
87impl W {
88    #[doc = r"Writes raw bits to the register"]
89    #[inline(always)]
90    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
91        self.bits = bits;
92        self
93    }
94    #[doc = "Bits 0:15 - Comparator B Value"]
95    #[inline(always)]
96    pub fn pwm_2_cmpb_compb(&mut self) -> _PWM_2_CMPB_COMPBW {
97        _PWM_2_CMPB_COMPBW { w: self }
98    }
99}