1#[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::I2CCLKGR {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
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 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R { bits: self.register.get() }
26 }
27 #[doc = r" Writes to the register"]
28 #[inline]
29 pub fn write<F>(&self, f: F)
30 where
31 F: FnOnce(&mut W) -> &mut W,
32 {
33 let mut w = W::reset_value();
34 f(&mut w);
35 self.register.set(w.bits);
36 }
37 #[doc = r" Writes the reset value to the register"]
38 #[inline]
39 pub fn reset(&self) {
40 self.write(|w| w)
41 }
42}
43#[doc = r" Value of the field"]
44pub struct RESERVED1R {
45 bits: u32,
46}
47impl RESERVED1R {
48 #[doc = r" Value of the field as raw bits"]
49 #[inline]
50 pub fn bits(&self) -> u32 {
51 self.bits
52 }
53}
54#[doc = r" Value of the field"]
55pub struct CLK_ENR {
56 bits: bool,
57}
58impl CLK_ENR {
59 #[doc = r" Value of the field as raw bits"]
60 #[inline]
61 pub fn bit(&self) -> bool {
62 self.bits
63 }
64 #[doc = r" Returns `true` if the bit is clear (0)"]
65 #[inline]
66 pub fn bit_is_clear(&self) -> bool {
67 !self.bit()
68 }
69 #[doc = r" Returns `true` if the bit is set (1)"]
70 #[inline]
71 pub fn bit_is_set(&self) -> bool {
72 self.bit()
73 }
74}
75#[doc = r" Proxy"]
76pub struct _RESERVED1W<'a> {
77 w: &'a mut W,
78}
79impl<'a> _RESERVED1W<'a> {
80 #[doc = r" Writes raw bits to the field"]
81 #[inline]
82 pub unsafe fn bits(self, value: u32) -> &'a mut W {
83 const MASK: u32 = 2147483647;
84 const OFFSET: u8 = 1;
85 self.w.bits &= !((MASK as u32) << OFFSET);
86 self.w.bits |= ((value & MASK) as u32) << OFFSET;
87 self.w
88 }
89}
90#[doc = r" Proxy"]
91pub struct _CLK_ENW<'a> {
92 w: &'a mut W,
93}
94impl<'a> _CLK_ENW<'a> {
95 #[doc = r" Sets the field bit"]
96 pub fn set_bit(self) -> &'a mut W {
97 self.bit(true)
98 }
99 #[doc = r" Clears the field bit"]
100 pub fn clear_bit(self) -> &'a mut W {
101 self.bit(false)
102 }
103 #[doc = r" Writes raw bits to the field"]
104 #[inline]
105 pub fn bit(self, value: bool) -> &'a mut W {
106 const MASK: bool = true;
107 const OFFSET: u8 = 0;
108 self.w.bits &= !((MASK as u32) << OFFSET);
109 self.w.bits |= ((value & MASK) as u32) << OFFSET;
110 self.w
111 }
112}
113impl R {
114 #[doc = r" Value of the register as raw bits"]
115 #[inline]
116 pub fn bits(&self) -> u32 {
117 self.bits
118 }
119 #[doc = "Bits 1:31 - Software should not rely on the value of a reserved. Writing any other value than the reset value may result in undefined behavior."]
120 #[inline]
121 pub fn reserved1(&self) -> RESERVED1R {
122 let bits = {
123 const MASK: u32 = 2147483647;
124 const OFFSET: u8 = 1;
125 ((self.bits >> OFFSET) & MASK as u32) as u32
126 };
127 RESERVED1R { bits }
128 }
129 #[doc = "Bit 0 - 0: Disable clock 1: Enable clock For changes to take effect, CLKLOADCTL.LOAD needs to be written"]
130 #[inline]
131 pub fn clk_en(&self) -> CLK_ENR {
132 let bits = {
133 const MASK: bool = true;
134 const OFFSET: u8 = 0;
135 ((self.bits >> OFFSET) & MASK as u32) != 0
136 };
137 CLK_ENR { bits }
138 }
139}
140impl W {
141 #[doc = r" Reset value of the register"]
142 #[inline]
143 pub fn reset_value() -> W {
144 W { bits: 0 }
145 }
146 #[doc = r" Writes raw bits to the register"]
147 #[inline]
148 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
149 self.bits = bits;
150 self
151 }
152 #[doc = "Bits 1:31 - Software should not rely on the value of a reserved. Writing any other value than the reset value may result in undefined behavior."]
153 #[inline]
154 pub fn reserved1(&mut self) -> _RESERVED1W {
155 _RESERVED1W { w: self }
156 }
157 #[doc = "Bit 0 - 0: Disable clock 1: Enable clock For changes to take effect, CLKLOADCTL.LOAD needs to be written"]
158 #[inline]
159 pub fn clk_en(&mut self) -> _CLK_ENW {
160 _CLK_ENW { w: self }
161 }
162}