mcxa_pac/cmc/
rpc.rs

1#[doc = "Register `RPC` reader"]
2pub type R = crate::R<RpcSpec>;
3#[doc = "Register `RPC` writer"]
4pub type W = crate::W<RpcSpec>;
5#[doc = "Field `FILTCFG` reader - Reset Filter Configuration"]
6pub type FiltcfgR = crate::FieldReader;
7#[doc = "Field `FILTCFG` writer - Reset Filter Configuration"]
8pub type FiltcfgW<'a, REG> = crate::FieldWriter<'a, REG, 5>;
9#[doc = "Filter Enable\n\nValue on reset: 0"]
10#[cfg_attr(feature = "defmt", derive(defmt::Format))]
11#[derive(Clone, Copy, Debug, PartialEq, Eq)]
12pub enum Filten {
13    #[doc = "0: Disables"]
14    Disabled = 0,
15    #[doc = "1: Enables"]
16    Enabled = 1,
17}
18impl From<Filten> for bool {
19    #[inline(always)]
20    fn from(variant: Filten) -> Self {
21        variant as u8 != 0
22    }
23}
24#[doc = "Field `FILTEN` reader - Filter Enable"]
25pub type FiltenR = crate::BitReader<Filten>;
26impl FiltenR {
27    #[doc = "Get enumerated values variant"]
28    #[inline(always)]
29    pub const fn variant(&self) -> Filten {
30        match self.bits {
31            false => Filten::Disabled,
32            true => Filten::Enabled,
33        }
34    }
35    #[doc = "Disables"]
36    #[inline(always)]
37    pub fn is_disabled(&self) -> bool {
38        *self == Filten::Disabled
39    }
40    #[doc = "Enables"]
41    #[inline(always)]
42    pub fn is_enabled(&self) -> bool {
43        *self == Filten::Enabled
44    }
45}
46#[doc = "Field `FILTEN` writer - Filter Enable"]
47pub type FiltenW<'a, REG> = crate::BitWriter<'a, REG, Filten>;
48impl<'a, REG> FiltenW<'a, REG>
49where
50    REG: crate::Writable + crate::RegisterSpec,
51{
52    #[doc = "Disables"]
53    #[inline(always)]
54    pub fn disabled(self) -> &'a mut crate::W<REG> {
55        self.variant(Filten::Disabled)
56    }
57    #[doc = "Enables"]
58    #[inline(always)]
59    pub fn enabled(self) -> &'a mut crate::W<REG> {
60        self.variant(Filten::Enabled)
61    }
62}
63#[doc = "Low-Power Filter Enable\n\nValue on reset: 0"]
64#[cfg_attr(feature = "defmt", derive(defmt::Format))]
65#[derive(Clone, Copy, Debug, PartialEq, Eq)]
66pub enum Lpfen {
67    #[doc = "0: Disables"]
68    Disabled = 0,
69    #[doc = "1: Enables"]
70    Enabled = 1,
71}
72impl From<Lpfen> for bool {
73    #[inline(always)]
74    fn from(variant: Lpfen) -> Self {
75        variant as u8 != 0
76    }
77}
78#[doc = "Field `LPFEN` reader - Low-Power Filter Enable"]
79pub type LpfenR = crate::BitReader<Lpfen>;
80impl LpfenR {
81    #[doc = "Get enumerated values variant"]
82    #[inline(always)]
83    pub const fn variant(&self) -> Lpfen {
84        match self.bits {
85            false => Lpfen::Disabled,
86            true => Lpfen::Enabled,
87        }
88    }
89    #[doc = "Disables"]
90    #[inline(always)]
91    pub fn is_disabled(&self) -> bool {
92        *self == Lpfen::Disabled
93    }
94    #[doc = "Enables"]
95    #[inline(always)]
96    pub fn is_enabled(&self) -> bool {
97        *self == Lpfen::Enabled
98    }
99}
100#[doc = "Field `LPFEN` writer - Low-Power Filter Enable"]
101pub type LpfenW<'a, REG> = crate::BitWriter<'a, REG, Lpfen>;
102impl<'a, REG> LpfenW<'a, REG>
103where
104    REG: crate::Writable + crate::RegisterSpec,
105{
106    #[doc = "Disables"]
107    #[inline(always)]
108    pub fn disabled(self) -> &'a mut crate::W<REG> {
109        self.variant(Lpfen::Disabled)
110    }
111    #[doc = "Enables"]
112    #[inline(always)]
113    pub fn enabled(self) -> &'a mut crate::W<REG> {
114        self.variant(Lpfen::Enabled)
115    }
116}
117impl R {
118    #[doc = "Bits 0:4 - Reset Filter Configuration"]
119    #[inline(always)]
120    pub fn filtcfg(&self) -> FiltcfgR {
121        FiltcfgR::new((self.bits & 0x1f) as u8)
122    }
123    #[doc = "Bit 8 - Filter Enable"]
124    #[inline(always)]
125    pub fn filten(&self) -> FiltenR {
126        FiltenR::new(((self.bits >> 8) & 1) != 0)
127    }
128    #[doc = "Bit 9 - Low-Power Filter Enable"]
129    #[inline(always)]
130    pub fn lpfen(&self) -> LpfenR {
131        LpfenR::new(((self.bits >> 9) & 1) != 0)
132    }
133}
134#[cfg(feature = "debug")]
135impl core::fmt::Debug for R {
136    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
137        f.debug_struct("RPC")
138            .field("filtcfg", &self.filtcfg())
139            .field("filten", &self.filten())
140            .field("lpfen", &self.lpfen())
141            .finish()
142    }
143}
144impl W {
145    #[doc = "Bits 0:4 - Reset Filter Configuration"]
146    #[inline(always)]
147    pub fn filtcfg(&mut self) -> FiltcfgW<'_, RpcSpec> {
148        FiltcfgW::new(self, 0)
149    }
150    #[doc = "Bit 8 - Filter Enable"]
151    #[inline(always)]
152    pub fn filten(&mut self) -> FiltenW<'_, RpcSpec> {
153        FiltenW::new(self, 8)
154    }
155    #[doc = "Bit 9 - Low-Power Filter Enable"]
156    #[inline(always)]
157    pub fn lpfen(&mut self) -> LpfenW<'_, RpcSpec> {
158        LpfenW::new(self, 9)
159    }
160}
161#[doc = "Reset Pin Control\n\nYou can [`read`](crate::Reg::read) this register and get [`rpc::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`rpc::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
162pub struct RpcSpec;
163impl crate::RegisterSpec for RpcSpec {
164    type Ux = u32;
165}
166#[doc = "`read()` method returns [`rpc::R`](R) reader structure"]
167impl crate::Readable for RpcSpec {}
168#[doc = "`write(|w| ..)` method takes [`rpc::W`](W) writer structure"]
169impl crate::Writable for RpcSpec {
170    type Safety = crate::Unsafe;
171}
172#[doc = "`reset()` method sets RPC to value 0"]
173impl crate::Resettable for RpcSpec {}