atsams70n21/usart0/
us_lonl2hdr.rs1#[doc = "Register `US_LONL2HDR` reader"]
2pub struct R(crate::R<US_LONL2HDR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<US_LONL2HDR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<US_LONL2HDR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<US_LONL2HDR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `US_LONL2HDR` writer"]
17pub struct W(crate::W<US_LONL2HDR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<US_LONL2HDR_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<US_LONL2HDR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<US_LONL2HDR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `BLI` reader - LON Backlog Increment"]
38pub struct BLI_R(crate::FieldReader<u8, u8>);
39impl BLI_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: u8) -> Self {
42 BLI_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for BLI_R {
46 type Target = crate::FieldReader<u8, u8>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `BLI` writer - LON Backlog Increment"]
53pub struct BLI_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> BLI_W<'a> {
57 #[doc = r"Writes raw bits to the field"]
58 #[inline(always)]
59 pub unsafe fn bits(self, value: u8) -> &'a mut W {
60 self.w.bits = (self.w.bits & !0x3f) | (value as u32 & 0x3f);
61 self.w
62 }
63}
64#[doc = "Field `ALTP` reader - LON Alternate Path Bit"]
65pub struct ALTP_R(crate::FieldReader<bool, bool>);
66impl ALTP_R {
67 #[inline(always)]
68 pub(crate) fn new(bits: bool) -> Self {
69 ALTP_R(crate::FieldReader::new(bits))
70 }
71}
72impl core::ops::Deref for ALTP_R {
73 type Target = crate::FieldReader<bool, bool>;
74 #[inline(always)]
75 fn deref(&self) -> &Self::Target {
76 &self.0
77 }
78}
79#[doc = "Field `ALTP` writer - LON Alternate Path Bit"]
80pub struct ALTP_W<'a> {
81 w: &'a mut W,
82}
83impl<'a> ALTP_W<'a> {
84 #[doc = r"Sets the field bit"]
85 #[inline(always)]
86 pub fn set_bit(self) -> &'a mut W {
87 self.bit(true)
88 }
89 #[doc = r"Clears the field bit"]
90 #[inline(always)]
91 pub fn clear_bit(self) -> &'a mut W {
92 self.bit(false)
93 }
94 #[doc = r"Writes raw bits to the field"]
95 #[inline(always)]
96 pub fn bit(self, value: bool) -> &'a mut W {
97 self.w.bits = (self.w.bits & !(0x01 << 6)) | ((value as u32 & 0x01) << 6);
98 self.w
99 }
100}
101#[doc = "Field `PB` reader - LON Priority Bit"]
102pub struct PB_R(crate::FieldReader<bool, bool>);
103impl PB_R {
104 #[inline(always)]
105 pub(crate) fn new(bits: bool) -> Self {
106 PB_R(crate::FieldReader::new(bits))
107 }
108}
109impl core::ops::Deref for PB_R {
110 type Target = crate::FieldReader<bool, bool>;
111 #[inline(always)]
112 fn deref(&self) -> &Self::Target {
113 &self.0
114 }
115}
116#[doc = "Field `PB` writer - LON Priority Bit"]
117pub struct PB_W<'a> {
118 w: &'a mut W,
119}
120impl<'a> PB_W<'a> {
121 #[doc = r"Sets the field bit"]
122 #[inline(always)]
123 pub fn set_bit(self) -> &'a mut W {
124 self.bit(true)
125 }
126 #[doc = r"Clears the field bit"]
127 #[inline(always)]
128 pub fn clear_bit(self) -> &'a mut W {
129 self.bit(false)
130 }
131 #[doc = r"Writes raw bits to the field"]
132 #[inline(always)]
133 pub fn bit(self, value: bool) -> &'a mut W {
134 self.w.bits = (self.w.bits & !(0x01 << 7)) | ((value as u32 & 0x01) << 7);
135 self.w
136 }
137}
138impl R {
139 #[doc = "Bits 0:5 - LON Backlog Increment"]
140 #[inline(always)]
141 pub fn bli(&self) -> BLI_R {
142 BLI_R::new((self.bits & 0x3f) as u8)
143 }
144 #[doc = "Bit 6 - LON Alternate Path Bit"]
145 #[inline(always)]
146 pub fn altp(&self) -> ALTP_R {
147 ALTP_R::new(((self.bits >> 6) & 0x01) != 0)
148 }
149 #[doc = "Bit 7 - LON Priority Bit"]
150 #[inline(always)]
151 pub fn pb(&self) -> PB_R {
152 PB_R::new(((self.bits >> 7) & 0x01) != 0)
153 }
154}
155impl W {
156 #[doc = "Bits 0:5 - LON Backlog Increment"]
157 #[inline(always)]
158 pub fn bli(&mut self) -> BLI_W {
159 BLI_W { w: self }
160 }
161 #[doc = "Bit 6 - LON Alternate Path Bit"]
162 #[inline(always)]
163 pub fn altp(&mut self) -> ALTP_W {
164 ALTP_W { w: self }
165 }
166 #[doc = "Bit 7 - LON Priority Bit"]
167 #[inline(always)]
168 pub fn pb(&mut self) -> PB_W {
169 PB_W { w: self }
170 }
171 #[doc = "Writes raw bits to the register."]
172 #[inline(always)]
173 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
174 self.0.bits(bits);
175 self
176 }
177}
178#[doc = "LON L2HDR Register\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 [us_lonl2hdr](index.html) module"]
179pub struct US_LONL2HDR_SPEC;
180impl crate::RegisterSpec for US_LONL2HDR_SPEC {
181 type Ux = u32;
182}
183#[doc = "`read()` method returns [us_lonl2hdr::R](R) reader structure"]
184impl crate::Readable for US_LONL2HDR_SPEC {
185 type Reader = R;
186}
187#[doc = "`write(|w| ..)` method takes [us_lonl2hdr::W](W) writer structure"]
188impl crate::Writable for US_LONL2HDR_SPEC {
189 type Writer = W;
190}
191#[doc = "`reset()` method sets US_LONL2HDR to value 0"]
192impl crate::Resettable for US_LONL2HDR_SPEC {
193 #[inline(always)]
194 fn reset_value() -> Self::Ux {
195 0
196 }
197}