efm32pg12_pac/emu/
ram0ctrl.rs1#[doc = "Reader of register RAM0CTRL"]
2pub type R = crate::R<u32, super::RAM0CTRL>;
3#[doc = "Writer for register RAM0CTRL"]
4pub type W = crate::W<u32, super::RAM0CTRL>;
5#[doc = "Register RAM0CTRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::RAM0CTRL {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "RAM0 Blockset Power-down\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum RAMPOWERDOWN_A {
17 #[doc = "0: None of the RAM blocks powered down"]
18 NONE = 0,
19 #[doc = "8: Power down RAM blocks 4 and above"]
20 BLK4 = 8,
21 #[doc = "12: Power down RAM blocks 3 and above"]
22 BLK3TO4 = 12,
23 #[doc = "14: Power down RAM blocks 2 and above"]
24 BLK2TO4 = 14,
25 #[doc = "15: Power down RAM blocks 1 and above"]
26 BLK1TO4 = 15,
27}
28impl From<RAMPOWERDOWN_A> for u8 {
29 #[inline(always)]
30 fn from(variant: RAMPOWERDOWN_A) -> Self {
31 variant as _
32 }
33}
34#[doc = "Reader of field `RAMPOWERDOWN`"]
35pub type RAMPOWERDOWN_R = crate::R<u8, RAMPOWERDOWN_A>;
36impl RAMPOWERDOWN_R {
37 #[doc = r"Get enumerated values variant"]
38 #[inline(always)]
39 pub fn variant(&self) -> crate::Variant<u8, RAMPOWERDOWN_A> {
40 use crate::Variant::*;
41 match self.bits {
42 0 => Val(RAMPOWERDOWN_A::NONE),
43 8 => Val(RAMPOWERDOWN_A::BLK4),
44 12 => Val(RAMPOWERDOWN_A::BLK3TO4),
45 14 => Val(RAMPOWERDOWN_A::BLK2TO4),
46 15 => Val(RAMPOWERDOWN_A::BLK1TO4),
47 i => Res(i),
48 }
49 }
50 #[doc = "Checks if the value of the field is `NONE`"]
51 #[inline(always)]
52 pub fn is_none(&self) -> bool {
53 *self == RAMPOWERDOWN_A::NONE
54 }
55 #[doc = "Checks if the value of the field is `BLK4`"]
56 #[inline(always)]
57 pub fn is_blk4(&self) -> bool {
58 *self == RAMPOWERDOWN_A::BLK4
59 }
60 #[doc = "Checks if the value of the field is `BLK3TO4`"]
61 #[inline(always)]
62 pub fn is_blk3to4(&self) -> bool {
63 *self == RAMPOWERDOWN_A::BLK3TO4
64 }
65 #[doc = "Checks if the value of the field is `BLK2TO4`"]
66 #[inline(always)]
67 pub fn is_blk2to4(&self) -> bool {
68 *self == RAMPOWERDOWN_A::BLK2TO4
69 }
70 #[doc = "Checks if the value of the field is `BLK1TO4`"]
71 #[inline(always)]
72 pub fn is_blk1to4(&self) -> bool {
73 *self == RAMPOWERDOWN_A::BLK1TO4
74 }
75}
76#[doc = "Write proxy for field `RAMPOWERDOWN`"]
77pub struct RAMPOWERDOWN_W<'a> {
78 w: &'a mut W,
79}
80impl<'a> RAMPOWERDOWN_W<'a> {
81 #[doc = r"Writes `variant` to the field"]
82 #[inline(always)]
83 pub fn variant(self, variant: RAMPOWERDOWN_A) -> &'a mut W {
84 unsafe { self.bits(variant.into()) }
85 }
86 #[doc = "None of the RAM blocks powered down"]
87 #[inline(always)]
88 pub fn none(self) -> &'a mut W {
89 self.variant(RAMPOWERDOWN_A::NONE)
90 }
91 #[doc = "Power down RAM blocks 4 and above"]
92 #[inline(always)]
93 pub fn blk4(self) -> &'a mut W {
94 self.variant(RAMPOWERDOWN_A::BLK4)
95 }
96 #[doc = "Power down RAM blocks 3 and above"]
97 #[inline(always)]
98 pub fn blk3to4(self) -> &'a mut W {
99 self.variant(RAMPOWERDOWN_A::BLK3TO4)
100 }
101 #[doc = "Power down RAM blocks 2 and above"]
102 #[inline(always)]
103 pub fn blk2to4(self) -> &'a mut W {
104 self.variant(RAMPOWERDOWN_A::BLK2TO4)
105 }
106 #[doc = "Power down RAM blocks 1 and above"]
107 #[inline(always)]
108 pub fn blk1to4(self) -> &'a mut W {
109 self.variant(RAMPOWERDOWN_A::BLK1TO4)
110 }
111 #[doc = r"Writes raw bits to the field"]
112 #[inline(always)]
113 pub unsafe fn bits(self, value: u8) -> &'a mut W {
114 self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
115 self.w
116 }
117}
118impl R {
119 #[doc = "Bits 0:3 - RAM0 Blockset Power-down"]
120 #[inline(always)]
121 pub fn rampowerdown(&self) -> RAMPOWERDOWN_R {
122 RAMPOWERDOWN_R::new((self.bits & 0x0f) as u8)
123 }
124}
125impl W {
126 #[doc = "Bits 0:3 - RAM0 Blockset Power-down"]
127 #[inline(always)]
128 pub fn rampowerdown(&mut self) -> RAMPOWERDOWN_W {
129 RAMPOWERDOWN_W { w: self }
130 }
131}