msp432e4/sysctl/
scgcemac.rs1#[doc = r"Value read from the register"]
2pub struct R {
3 bits: u32,
4}
5#[doc = r"Value to write to the register"]
6pub struct W {
7 bits: u32,
8}
9impl super::SCGCEMAC {
10 #[doc = r"Modifies the contents of the register"]
11 #[inline(always)]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 self.register.set(f(&R { bits }, &mut W { bits }).bits);
18 }
19 #[doc = r"Reads the contents of the register"]
20 #[inline(always)]
21 pub fn read(&self) -> R {
22 R {
23 bits: self.register.get(),
24 }
25 }
26 #[doc = r"Writes to the register"]
27 #[inline(always)]
28 pub fn write<F>(&self, f: F)
29 where
30 F: FnOnce(&mut W) -> &mut W,
31 {
32 self.register.set(
33 f(&mut W {
34 bits: Self::reset_value(),
35 })
36 .bits,
37 );
38 }
39 #[doc = r"Reset value of the register"]
40 #[inline(always)]
41 pub const fn reset_value() -> u32 {
42 0
43 }
44 #[doc = r"Writes the reset value to the register"]
45 #[inline(always)]
46 pub fn reset(&self) {
47 self.register.set(Self::reset_value())
48 }
49}
50#[doc = r"Value of the field"]
51pub struct SYSCTL_SCGCEMAC_S0R {
52 bits: bool,
53}
54impl SYSCTL_SCGCEMAC_S0R {
55 #[doc = r"Value of the field as raw bits"]
56 #[inline(always)]
57 pub fn bit(&self) -> bool {
58 self.bits
59 }
60 #[doc = r"Returns `true` if the bit is clear (0)"]
61 #[inline(always)]
62 pub fn bit_is_clear(&self) -> bool {
63 !self.bit()
64 }
65 #[doc = r"Returns `true` if the bit is set (1)"]
66 #[inline(always)]
67 pub fn bit_is_set(&self) -> bool {
68 self.bit()
69 }
70}
71#[doc = r"Proxy"]
72pub struct _SYSCTL_SCGCEMAC_S0W<'a> {
73 w: &'a mut W,
74}
75impl<'a> _SYSCTL_SCGCEMAC_S0W<'a> {
76 #[doc = r"Sets the field bit"]
77 #[inline(always)]
78 pub fn set_bit(self) -> &'a mut W {
79 self.bit(true)
80 }
81 #[doc = r"Clears the field bit"]
82 #[inline(always)]
83 pub fn clear_bit(self) -> &'a mut W {
84 self.bit(false)
85 }
86 #[doc = r"Writes raw bits to the field"]
87 #[inline(always)]
88 pub fn bit(self, value: bool) -> &'a mut W {
89 self.w.bits &= !(1 << 0);
90 self.w.bits |= ((value as u32) & 1) << 0;
91 self.w
92 }
93}
94impl R {
95 #[doc = r"Value of the register as raw bits"]
96 #[inline(always)]
97 pub fn bits(&self) -> u32 {
98 self.bits
99 }
100 #[doc = "Bit 0 - Ethernet MAC Module 0 Sleep Mode Clock Gating Control"]
101 #[inline(always)]
102 pub fn sysctl_scgcemac_s0(&self) -> SYSCTL_SCGCEMAC_S0R {
103 let bits = ((self.bits >> 0) & 1) != 0;
104 SYSCTL_SCGCEMAC_S0R { bits }
105 }
106}
107impl W {
108 #[doc = r"Writes raw bits to the register"]
109 #[inline(always)]
110 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
111 self.bits = bits;
112 self
113 }
114 #[doc = "Bit 0 - Ethernet MAC Module 0 Sleep Mode Clock Gating Control"]
115 #[inline(always)]
116 pub fn sysctl_scgcemac_s0(&mut self) -> _SYSCTL_SCGCEMAC_S0W {
117 _SYSCTL_SCGCEMAC_S0W { w: self }
118 }
119}