mcxa_pac/flexpwm0/
mask.rs

1#[doc = "Register `MASK` reader"]
2pub type R = crate::R<MaskSpec>;
3#[doc = "Register `MASK` writer"]
4pub type W = crate::W<MaskSpec>;
5#[doc = "Field `MASKX` reader - PWM_X Masks"]
6pub type MaskxR = crate::FieldReader;
7#[doc = "Field `MASKX` writer - PWM_X Masks"]
8pub type MaskxW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
9#[doc = "Field `MASKB` reader - PWM_B Masks"]
10pub type MaskbR = crate::FieldReader;
11#[doc = "Field `MASKB` writer - PWM_B Masks"]
12pub type MaskbW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
13#[doc = "Field `MASKA` reader - PWM_A Masks"]
14pub type MaskaR = crate::FieldReader;
15#[doc = "Field `MASKA` writer - PWM_A Masks"]
16pub type MaskaW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
17#[doc = "Field `UPDATE_MASK` writer - Update Mask Bits Immediately"]
18pub type UpdateMaskW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
19impl R {
20    #[doc = "Bits 0:3 - PWM_X Masks"]
21    #[inline(always)]
22    pub fn maskx(&self) -> MaskxR {
23        MaskxR::new((self.bits & 0x0f) as u8)
24    }
25    #[doc = "Bits 4:7 - PWM_B Masks"]
26    #[inline(always)]
27    pub fn maskb(&self) -> MaskbR {
28        MaskbR::new(((self.bits >> 4) & 0x0f) as u8)
29    }
30    #[doc = "Bits 8:11 - PWM_A Masks"]
31    #[inline(always)]
32    pub fn maska(&self) -> MaskaR {
33        MaskaR::new(((self.bits >> 8) & 0x0f) as u8)
34    }
35}
36#[cfg(feature = "debug")]
37impl core::fmt::Debug for R {
38    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
39        f.debug_struct("MASK")
40            .field("maskx", &self.maskx())
41            .field("maskb", &self.maskb())
42            .field("maska", &self.maska())
43            .finish()
44    }
45}
46impl W {
47    #[doc = "Bits 0:3 - PWM_X Masks"]
48    #[inline(always)]
49    pub fn maskx(&mut self) -> MaskxW<'_, MaskSpec> {
50        MaskxW::new(self, 0)
51    }
52    #[doc = "Bits 4:7 - PWM_B Masks"]
53    #[inline(always)]
54    pub fn maskb(&mut self) -> MaskbW<'_, MaskSpec> {
55        MaskbW::new(self, 4)
56    }
57    #[doc = "Bits 8:11 - PWM_A Masks"]
58    #[inline(always)]
59    pub fn maska(&mut self) -> MaskaW<'_, MaskSpec> {
60        MaskaW::new(self, 8)
61    }
62    #[doc = "Bits 12:15 - Update Mask Bits Immediately"]
63    #[inline(always)]
64    pub fn update_mask(&mut self) -> UpdateMaskW<'_, MaskSpec> {
65        UpdateMaskW::new(self, 12)
66    }
67}
68#[doc = "Mask Register\n\nYou can [`read`](crate::Reg::read) this register and get [`mask::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`mask::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
69pub struct MaskSpec;
70impl crate::RegisterSpec for MaskSpec {
71    type Ux = u16;
72}
73#[doc = "`read()` method returns [`mask::R`](R) reader structure"]
74impl crate::Readable for MaskSpec {}
75#[doc = "`write(|w| ..)` method takes [`mask::W`](W) writer structure"]
76impl crate::Writable for MaskSpec {
77    type Safety = crate::Unsafe;
78}
79#[doc = "`reset()` method sets MASK to value 0"]
80impl crate::Resettable for MaskSpec {}