Skip to main content

mcxa_pac/dac0/
pcr.rs

1#[doc = "Register `PCR` reader"]
2pub type R = crate::R<PcrSpec>;
3#[doc = "Register `PCR` writer"]
4pub type W = crate::W<PcrSpec>;
5#[doc = "Field `PTG_NUM` reader - Periodic Trigger Number"]
6pub type PtgNumR = crate::FieldReader<u16>;
7#[doc = "Field `PTG_NUM` writer - Periodic Trigger Number"]
8pub type PtgNumW<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
9#[doc = "Field `PTG_PERIOD` reader - Periodic Trigger Period Width"]
10pub type PtgPeriodR = crate::FieldReader<u16>;
11#[doc = "Field `PTG_PERIOD` writer - Periodic Trigger Period Width"]
12pub type PtgPeriodW<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
13impl R {
14    #[doc = "Bits 0:15 - Periodic Trigger Number"]
15    #[inline(always)]
16    pub fn ptg_num(&self) -> PtgNumR {
17        PtgNumR::new((self.bits & 0xffff) as u16)
18    }
19    #[doc = "Bits 16:31 - Periodic Trigger Period Width"]
20    #[inline(always)]
21    pub fn ptg_period(&self) -> PtgPeriodR {
22        PtgPeriodR::new(((self.bits >> 16) & 0xffff) as u16)
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("PCR")
29            .field("ptg_num", &self.ptg_num())
30            .field("ptg_period", &self.ptg_period())
31            .finish()
32    }
33}
34impl W {
35    #[doc = "Bits 0:15 - Periodic Trigger Number"]
36    #[inline(always)]
37    pub fn ptg_num(&mut self) -> PtgNumW<'_, PcrSpec> {
38        PtgNumW::new(self, 0)
39    }
40    #[doc = "Bits 16:31 - Periodic Trigger Period Width"]
41    #[inline(always)]
42    pub fn ptg_period(&mut self) -> PtgPeriodW<'_, PcrSpec> {
43        PtgPeriodW::new(self, 16)
44    }
45}
46#[doc = "Periodic Trigger Control\n\nYou can [`read`](crate::Reg::read) this register and get [`pcr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`pcr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
47pub struct PcrSpec;
48impl crate::RegisterSpec for PcrSpec {
49    type Ux = u32;
50}
51#[doc = "`read()` method returns [`pcr::R`](R) reader structure"]
52impl crate::Readable for PcrSpec {}
53#[doc = "`write(|w| ..)` method takes [`pcr::W`](W) writer structure"]
54impl crate::Writable for PcrSpec {
55    type Safety = crate::Unsafe;
56}
57#[doc = "`reset()` method sets PCR to value 0"]
58impl crate::Resettable for PcrSpec {}