atsamv71n21/pwm0/pwm_cmp/
pwm_cmpvupd.rs1#[doc = "Register `PWM_CMPVUPD` writer"]
2pub struct W(crate::W<PWM_CMPVUPD_SPEC>);
3impl core::ops::Deref for W {
4 type Target = crate::W<PWM_CMPVUPD_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl core::ops::DerefMut for W {
11 #[inline(always)]
12 fn deref_mut(&mut self) -> &mut Self::Target {
13 &mut self.0
14 }
15}
16impl From<crate::W<PWM_CMPVUPD_SPEC>> for W {
17 #[inline(always)]
18 fn from(writer: crate::W<PWM_CMPVUPD_SPEC>) -> Self {
19 W(writer)
20 }
21}
22#[doc = "Field `CVUPD` writer - Comparison x Value Update"]
23pub struct CVUPD_W<'a> {
24 w: &'a mut W,
25}
26impl<'a> CVUPD_W<'a> {
27 #[doc = r"Writes raw bits to the field"]
28 #[inline(always)]
29 pub unsafe fn bits(self, value: u32) -> &'a mut W {
30 self.w.bits = (self.w.bits & !0x00ff_ffff) | (value as u32 & 0x00ff_ffff);
31 self.w
32 }
33}
34#[doc = "Field `CVMUPD` writer - Comparison x Value Mode Update"]
35pub struct CVMUPD_W<'a> {
36 w: &'a mut W,
37}
38impl<'a> CVMUPD_W<'a> {
39 #[doc = r"Sets the field bit"]
40 #[inline(always)]
41 pub fn set_bit(self) -> &'a mut W {
42 self.bit(true)
43 }
44 #[doc = r"Clears the field bit"]
45 #[inline(always)]
46 pub fn clear_bit(self) -> &'a mut W {
47 self.bit(false)
48 }
49 #[doc = r"Writes raw bits to the field"]
50 #[inline(always)]
51 pub fn bit(self, value: bool) -> &'a mut W {
52 self.w.bits = (self.w.bits & !(0x01 << 24)) | ((value as u32 & 0x01) << 24);
53 self.w
54 }
55}
56impl W {
57 #[doc = "Bits 0:23 - Comparison x Value Update"]
58 #[inline(always)]
59 pub fn cvupd(&mut self) -> CVUPD_W {
60 CVUPD_W { w: self }
61 }
62 #[doc = "Bit 24 - Comparison x Value Mode Update"]
63 #[inline(always)]
64 pub fn cvmupd(&mut self) -> CVMUPD_W {
65 CVMUPD_W { w: self }
66 }
67 #[doc = "Writes raw bits to the register."]
68 #[inline(always)]
69 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
70 self.0.bits(bits);
71 self
72 }
73}
74#[doc = "PWM Comparison 0 Value Update Register\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [pwm_cmpvupd](index.html) module"]
75pub struct PWM_CMPVUPD_SPEC;
76impl crate::RegisterSpec for PWM_CMPVUPD_SPEC {
77 type Ux = u32;
78}
79#[doc = "`write(|w| ..)` method takes [pwm_cmpvupd::W](W) writer structure"]
80impl crate::Writable for PWM_CMPVUPD_SPEC {
81 type Writer = W;
82}
83#[doc = "`reset()` method sets PWM_CMPVUPD to value 0"]
84impl crate::Resettable for PWM_CMPVUPD_SPEC {
85 #[inline(always)]
86 fn reset_value() -> Self::Ux {
87 0
88 }
89}