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::SMPH9 {
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 STATR {
56 bits: bool,
57}
58impl STATR {
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 _STATW<'a> {
77 w: &'a mut W,
78}
79impl<'a> _STATW<'a> {
80 #[doc = r" Sets the field bit"]
81 pub fn set_bit(self) -> &'a mut W {
82 self.bit(true)
83 }
84 #[doc = r" Clears the field bit"]
85 pub fn clear_bit(self) -> &'a mut W {
86 self.bit(false)
87 }
88 #[doc = r" Writes raw bits to the field"]
89 #[inline]
90 pub fn bit(self, value: bool) -> &'a mut W {
91 const MASK: bool = true;
92 const OFFSET: u8 = 0;
93 self.w.bits &= !((MASK as u32) << OFFSET);
94 self.w.bits |= ((value & MASK) as u32) << OFFSET;
95 self.w
96 }
97}
98impl R {
99 #[doc = r" Value of the register as raw bits"]
100 #[inline]
101 pub fn bits(&self) -> u32 {
102 self.bits
103 }
104 #[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."]
105 #[inline]
106 pub fn reserved1(&self) -> RESERVED1R {
107 let bits = {
108 const MASK: u32 = 2147483647;
109 const OFFSET: u8 = 1;
110 ((self.bits >> OFFSET) & MASK as u32) as u32
111 };
112 RESERVED1R { bits }
113 }
114 #[doc = "Bit 0 - Status when reading: 0: Semaphore is taken 1: Semaphore is available Reading the register causes it to change value to 0. Releasing the semaphore is done by writing 1."]
115 #[inline]
116 pub fn stat(&self) -> STATR {
117 let bits = {
118 const MASK: bool = true;
119 const OFFSET: u8 = 0;
120 ((self.bits >> OFFSET) & MASK as u32) != 0
121 };
122 STATR { bits }
123 }
124}
125impl W {
126 #[doc = r" Reset value of the register"]
127 #[inline]
128 pub fn reset_value() -> W {
129 W { bits: 0 }
130 }
131 #[doc = r" Writes raw bits to the register"]
132 #[inline]
133 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
134 self.bits = bits;
135 self
136 }
137 #[doc = "Bit 0 - Status when reading: 0: Semaphore is taken 1: Semaphore is available Reading the register causes it to change value to 0. Releasing the semaphore is done by writing 1."]
138 #[inline]
139 pub fn stat(&mut self) -> _STATW {
140 _STATW { w: self }
141 }
142}