mcxa_pac/flexpwm0/
sm2captfiltx.rs

1#[doc = "Register `SM2CAPTFILTX` reader"]
2pub type R = crate::R<Sm2captfiltxSpec>;
3#[doc = "Register `SM2CAPTFILTX` writer"]
4pub type W = crate::W<Sm2captfiltxSpec>;
5#[doc = "Field `CAPTX_FILT_PER` reader - Input Capture Filter Period"]
6pub type CaptxFiltPerR = crate::FieldReader;
7#[doc = "Field `CAPTX_FILT_PER` writer - Input Capture Filter Period"]
8pub type CaptxFiltPerW<'a, REG> = crate::FieldWriter<'a, REG, 8>;
9#[doc = "Field `CAPTX_FILT_CNT` reader - Input Capture Filter Count"]
10pub type CaptxFiltCntR = crate::FieldReader;
11#[doc = "Field `CAPTX_FILT_CNT` writer - Input Capture Filter Count"]
12pub type CaptxFiltCntW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
13impl R {
14    #[doc = "Bits 0:7 - Input Capture Filter Period"]
15    #[inline(always)]
16    pub fn captx_filt_per(&self) -> CaptxFiltPerR {
17        CaptxFiltPerR::new((self.bits & 0xff) as u8)
18    }
19    #[doc = "Bits 8:10 - Input Capture Filter Count"]
20    #[inline(always)]
21    pub fn captx_filt_cnt(&self) -> CaptxFiltCntR {
22        CaptxFiltCntR::new(((self.bits >> 8) & 7) as u8)
23    }
24}
25#[cfg(feature = "debug")]
26impl core::fmt::Debug for R {
27    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
28        f.debug_struct("SM2CAPTFILTX")
29            .field("captx_filt_per", &self.captx_filt_per())
30            .field("captx_filt_cnt", &self.captx_filt_cnt())
31            .finish()
32    }
33}
34impl W {
35    #[doc = "Bits 0:7 - Input Capture Filter Period"]
36    #[inline(always)]
37    pub fn captx_filt_per(&mut self) -> CaptxFiltPerW<'_, Sm2captfiltxSpec> {
38        CaptxFiltPerW::new(self, 0)
39    }
40    #[doc = "Bits 8:10 - Input Capture Filter Count"]
41    #[inline(always)]
42    pub fn captx_filt_cnt(&mut self) -> CaptxFiltCntW<'_, Sm2captfiltxSpec> {
43        CaptxFiltCntW::new(self, 8)
44    }
45}
46#[doc = "Capture PWM_X Input Filter Register\n\nYou can [`read`](crate::Reg::read) this register and get [`sm2captfiltx::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sm2captfiltx::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
47pub struct Sm2captfiltxSpec;
48impl crate::RegisterSpec for Sm2captfiltxSpec {
49    type Ux = u16;
50}
51#[doc = "`read()` method returns [`sm2captfiltx::R`](R) reader structure"]
52impl crate::Readable for Sm2captfiltxSpec {}
53#[doc = "`write(|w| ..)` method takes [`sm2captfiltx::W`](W) writer structure"]
54impl crate::Writable for Sm2captfiltxSpec {
55    type Safety = crate::Unsafe;
56}
57#[doc = "`reset()` method sets SM2CAPTFILTX to value 0"]
58impl crate::Resettable for Sm2captfiltxSpec {}