mcxa_pac/spc0/
sramretldo_cntrl.rs1#[doc = "Register `SRAMRETLDO_CNTRL` reader"]
2pub type R = crate::R<SramretldoCntrlSpec>;
3#[doc = "Register `SRAMRETLDO_CNTRL` writer"]
4pub type W = crate::W<SramretldoCntrlSpec>;
5#[doc = "SRAM LDO Regulator Enable\n\nValue on reset: 1"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum SramldoOn {
9 #[doc = "0: Disable"]
10 Disable = 0,
11 #[doc = "1: Enable"]
12 Enable = 1,
13}
14impl From<SramldoOn> for bool {
15 #[inline(always)]
16 fn from(variant: SramldoOn) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `SRAMLDO_ON` reader - SRAM LDO Regulator Enable"]
21pub type SramldoOnR = crate::BitReader<SramldoOn>;
22impl SramldoOnR {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> SramldoOn {
26 match self.bits {
27 false => SramldoOn::Disable,
28 true => SramldoOn::Enable,
29 }
30 }
31 #[doc = "Disable"]
32 #[inline(always)]
33 pub fn is_disable(&self) -> bool {
34 *self == SramldoOn::Disable
35 }
36 #[doc = "Enable"]
37 #[inline(always)]
38 pub fn is_enable(&self) -> bool {
39 *self == SramldoOn::Enable
40 }
41}
42#[doc = "Field `SRAMLDO_ON` writer - SRAM LDO Regulator Enable"]
43pub type SramldoOnW<'a, REG> = crate::BitWriter<'a, REG, SramldoOn>;
44impl<'a, REG> SramldoOnW<'a, REG>
45where
46 REG: crate::Writable + crate::RegisterSpec,
47{
48 #[doc = "Disable"]
49 #[inline(always)]
50 pub fn disable(self) -> &'a mut crate::W<REG> {
51 self.variant(SramldoOn::Disable)
52 }
53 #[doc = "Enable"]
54 #[inline(always)]
55 pub fn enable(self) -> &'a mut crate::W<REG> {
56 self.variant(SramldoOn::Enable)
57 }
58}
59#[doc = "Field `SRAM_RET_EN` reader - SRAM Retention"]
60pub type SramRetEnR = crate::FieldReader;
61#[doc = "Field `SRAM_RET_EN` writer - SRAM Retention"]
62pub type SramRetEnW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
63impl R {
64 #[doc = "Bit 0 - SRAM LDO Regulator Enable"]
65 #[inline(always)]
66 pub fn sramldo_on(&self) -> SramldoOnR {
67 SramldoOnR::new((self.bits & 1) != 0)
68 }
69 #[doc = "Bits 8:11 - SRAM Retention"]
70 #[inline(always)]
71 pub fn sram_ret_en(&self) -> SramRetEnR {
72 SramRetEnR::new(((self.bits >> 8) & 0x0f) as u8)
73 }
74}
75#[cfg(feature = "debug")]
76impl core::fmt::Debug for R {
77 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
78 f.debug_struct("SRAMRETLDO_CNTRL")
79 .field("sramldo_on", &self.sramldo_on())
80 .field("sram_ret_en", &self.sram_ret_en())
81 .finish()
82 }
83}
84impl W {
85 #[doc = "Bit 0 - SRAM LDO Regulator Enable"]
86 #[inline(always)]
87 pub fn sramldo_on(&mut self) -> SramldoOnW<'_, SramretldoCntrlSpec> {
88 SramldoOnW::new(self, 0)
89 }
90 #[doc = "Bits 8:11 - SRAM Retention"]
91 #[inline(always)]
92 pub fn sram_ret_en(&mut self) -> SramRetEnW<'_, SramretldoCntrlSpec> {
93 SramRetEnW::new(self, 8)
94 }
95}
96#[doc = "SRAM Retention LDO Control\n\nYou can [`read`](crate::Reg::read) this register and get [`sramretldo_cntrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sramretldo_cntrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
97pub struct SramretldoCntrlSpec;
98impl crate::RegisterSpec for SramretldoCntrlSpec {
99 type Ux = u32;
100}
101#[doc = "`read()` method returns [`sramretldo_cntrl::R`](R) reader structure"]
102impl crate::Readable for SramretldoCntrlSpec {}
103#[doc = "`write(|w| ..)` method takes [`sramretldo_cntrl::W`](W) writer structure"]
104impl crate::Writable for SramretldoCntrlSpec {
105 type Safety = crate::Unsafe;
106}
107#[doc = "`reset()` method sets SRAMRETLDO_CNTRL to value 0x0f01"]
108impl crate::Resettable for SramretldoCntrlSpec {
109 const RESET_VALUE: u32 = 0x0f01;
110}