1#[doc = "Register `SARU%s` reader"]
2pub struct R(crate::R<SARU_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<SARU_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<SARU_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<SARU_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `SARU%s` writer"]
17pub struct W(crate::W<SARU_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<SARU_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<SARU_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<SARU_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `FS` reader - 7-Bit/10-Bit Address Format Selection"]
38pub type FS_R = crate::BitReader<FS_A>;
39#[doc = "7-Bit/10-Bit Address Format Selection\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum FS_A {
42 #[doc = "0: The 7-bit address format is selected."]
43 _0 = 0,
44 #[doc = "1: The 10-bit address format is selected."]
45 _1 = 1,
46}
47impl From<FS_A> for bool {
48 #[inline(always)]
49 fn from(variant: FS_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl FS_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> FS_A {
57 match self.bits {
58 false => FS_A::_0,
59 true => FS_A::_1,
60 }
61 }
62 #[doc = "Checks if the value of the field is `_0`"]
63 #[inline(always)]
64 pub fn is_0(&self) -> bool {
65 *self == FS_A::_0
66 }
67 #[doc = "Checks if the value of the field is `_1`"]
68 #[inline(always)]
69 pub fn is_1(&self) -> bool {
70 *self == FS_A::_1
71 }
72}
73#[doc = "Field `FS` writer - 7-Bit/10-Bit Address Format Selection"]
74pub type FS_W<'a, const O: u8> = crate::BitWriter<'a, u8, SARU_SPEC, FS_A, O>;
75impl<'a, const O: u8> FS_W<'a, O> {
76 #[doc = "The 7-bit address format is selected."]
77 #[inline(always)]
78 pub fn _0(self) -> &'a mut W {
79 self.variant(FS_A::_0)
80 }
81 #[doc = "The 10-bit address format is selected."]
82 #[inline(always)]
83 pub fn _1(self) -> &'a mut W {
84 self.variant(FS_A::_1)
85 }
86}
87#[doc = "Field `SVA8` reader - 10-Bit Address(bit8)"]
88pub type SVA8_R = crate::BitReader<bool>;
89#[doc = "Field `SVA8` writer - 10-Bit Address(bit8)"]
90pub type SVA8_W<'a, const O: u8> = crate::BitWriter<'a, u8, SARU_SPEC, bool, O>;
91#[doc = "Field `SVA9` reader - 10-Bit Address(bit9)"]
92pub type SVA9_R = crate::BitReader<bool>;
93#[doc = "Field `SVA9` writer - 10-Bit Address(bit9)"]
94pub type SVA9_W<'a, const O: u8> = crate::BitWriter<'a, u8, SARU_SPEC, bool, O>;
95impl R {
96 #[doc = "Bit 0 - 7-Bit/10-Bit Address Format Selection"]
97 #[inline(always)]
98 pub fn fs(&self) -> FS_R {
99 FS_R::new((self.bits & 1) != 0)
100 }
101 #[doc = "Bit 1 - 10-Bit Address(bit8)"]
102 #[inline(always)]
103 pub fn sva8(&self) -> SVA8_R {
104 SVA8_R::new(((self.bits >> 1) & 1) != 0)
105 }
106 #[doc = "Bit 2 - 10-Bit Address(bit9)"]
107 #[inline(always)]
108 pub fn sva9(&self) -> SVA9_R {
109 SVA9_R::new(((self.bits >> 2) & 1) != 0)
110 }
111}
112impl W {
113 #[doc = "Bit 0 - 7-Bit/10-Bit Address Format Selection"]
114 #[inline(always)]
115 #[must_use]
116 pub fn fs(&mut self) -> FS_W<0> {
117 FS_W::new(self)
118 }
119 #[doc = "Bit 1 - 10-Bit Address(bit8)"]
120 #[inline(always)]
121 #[must_use]
122 pub fn sva8(&mut self) -> SVA8_W<1> {
123 SVA8_W::new(self)
124 }
125 #[doc = "Bit 2 - 10-Bit Address(bit9)"]
126 #[inline(always)]
127 #[must_use]
128 pub fn sva9(&mut self) -> SVA9_W<2> {
129 SVA9_W::new(self)
130 }
131 #[doc = "Writes raw bits to the register."]
132 #[inline(always)]
133 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
134 self.0.bits(bits);
135 self
136 }
137}
138#[doc = "Slave Address Register U%s\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [saru](index.html) module"]
139pub struct SARU_SPEC;
140impl crate::RegisterSpec for SARU_SPEC {
141 type Ux = u8;
142}
143#[doc = "`read()` method returns [saru::R](R) reader structure"]
144impl crate::Readable for SARU_SPEC {
145 type Reader = R;
146}
147#[doc = "`write(|w| ..)` method takes [saru::W](W) writer structure"]
148impl crate::Writable for SARU_SPEC {
149 type Writer = W;
150 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
151 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
152}
153#[doc = "`reset()` method sets SARU%s to value 0"]
154impl crate::Resettable for SARU_SPEC {
155 const RESET_VALUE: Self::Ux = 0;
156}