mcxa_pac/fmc0/
remap.rs

1#[doc = "Register `REMAP` reader"]
2pub type R = crate::R<RemapSpec>;
3#[doc = "Register `REMAP` writer"]
4pub type W = crate::W<RemapSpec>;
5#[doc = "Remap Lock Enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Remaplk {
9    #[doc = "0: Lock disabled: can write to REMAP"]
10    LockDisabled = 0,
11    #[doc = "1: Lock enabled: cannot write to REMAP"]
12    LockEnabled = 1,
13}
14impl From<Remaplk> for bool {
15    #[inline(always)]
16    fn from(variant: Remaplk) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `REMAPLK` reader - Remap Lock Enable"]
21pub type RemaplkR = crate::BitReader<Remaplk>;
22impl RemaplkR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Remaplk {
26        match self.bits {
27            false => Remaplk::LockDisabled,
28            true => Remaplk::LockEnabled,
29        }
30    }
31    #[doc = "Lock disabled: can write to REMAP"]
32    #[inline(always)]
33    pub fn is_lock_disabled(&self) -> bool {
34        *self == Remaplk::LockDisabled
35    }
36    #[doc = "Lock enabled: cannot write to REMAP"]
37    #[inline(always)]
38    pub fn is_lock_enabled(&self) -> bool {
39        *self == Remaplk::LockEnabled
40    }
41}
42#[doc = "Field `REMAPLK` writer - Remap Lock Enable"]
43pub type RemaplkW<'a, REG> = crate::BitWriter<'a, REG, Remaplk>;
44impl<'a, REG> RemaplkW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "Lock disabled: can write to REMAP"]
49    #[inline(always)]
50    pub fn lock_disabled(self) -> &'a mut crate::W<REG> {
51        self.variant(Remaplk::LockDisabled)
52    }
53    #[doc = "Lock enabled: cannot write to REMAP"]
54    #[inline(always)]
55    pub fn lock_enabled(self) -> &'a mut crate::W<REG> {
56        self.variant(Remaplk::LockEnabled)
57    }
58}
59#[doc = "Field `LIM` reader - LIM Remapping Address"]
60pub type LimR = crate::FieldReader;
61#[doc = "Field `LIM` writer - LIM Remapping Address"]
62pub type LimW<'a, REG> = crate::FieldWriter<'a, REG, 7>;
63#[doc = "Field `LIMDP` reader - LIMDP Remapping Address"]
64pub type LimdpR = crate::FieldReader;
65#[doc = "Field `LIMDP` writer - LIMDP Remapping Address"]
66pub type LimdpW<'a, REG> = crate::FieldWriter<'a, REG, 7>;
67impl R {
68    #[doc = "Bit 0 - Remap Lock Enable"]
69    #[inline(always)]
70    pub fn remaplk(&self) -> RemaplkR {
71        RemaplkR::new((self.bits & 1) != 0)
72    }
73    #[doc = "Bits 16:22 - LIM Remapping Address"]
74    #[inline(always)]
75    pub fn lim(&self) -> LimR {
76        LimR::new(((self.bits >> 16) & 0x7f) as u8)
77    }
78    #[doc = "Bits 24:30 - LIMDP Remapping Address"]
79    #[inline(always)]
80    pub fn limdp(&self) -> LimdpR {
81        LimdpR::new(((self.bits >> 24) & 0x7f) as u8)
82    }
83}
84#[cfg(feature = "debug")]
85impl core::fmt::Debug for R {
86    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
87        f.debug_struct("REMAP")
88            .field("remaplk", &self.remaplk())
89            .field("lim", &self.lim())
90            .field("limdp", &self.limdp())
91            .finish()
92    }
93}
94impl W {
95    #[doc = "Bit 0 - Remap Lock Enable"]
96    #[inline(always)]
97    pub fn remaplk(&mut self) -> RemaplkW<'_, RemapSpec> {
98        RemaplkW::new(self, 0)
99    }
100    #[doc = "Bits 16:22 - LIM Remapping Address"]
101    #[inline(always)]
102    pub fn lim(&mut self) -> LimW<'_, RemapSpec> {
103        LimW::new(self, 16)
104    }
105    #[doc = "Bits 24:30 - LIMDP Remapping Address"]
106    #[inline(always)]
107    pub fn limdp(&mut self) -> LimdpW<'_, RemapSpec> {
108        LimdpW::new(self, 24)
109    }
110}
111#[doc = "Data Remap\n\nYou can [`read`](crate::Reg::read) this register and get [`remap::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`remap::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
112pub struct RemapSpec;
113impl crate::RegisterSpec for RemapSpec {
114    type Ux = u32;
115}
116#[doc = "`read()` method returns [`remap::R`](R) reader structure"]
117impl crate::Readable for RemapSpec {}
118#[doc = "`write(|w| ..)` method takes [`remap::W`](W) writer structure"]
119impl crate::Writable for RemapSpec {
120    type Safety = crate::Unsafe;
121}
122#[doc = "`reset()` method sets REMAP to value 0"]
123impl crate::Resettable for RemapSpec {}