nrf5340_app_pac/tad_s/psel/
tracedata2.rs1#[doc = "Register `TRACEDATA2` reader"]
2pub struct R(crate::R<TRACEDATA2_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<TRACEDATA2_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<TRACEDATA2_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<TRACEDATA2_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `TRACEDATA2` writer"]
17pub struct W(crate::W<TRACEDATA2_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<TRACEDATA2_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<TRACEDATA2_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<TRACEDATA2_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `PIN` reader - Pin number"]
38pub type PIN_R = crate::FieldReader<u8, PIN_A>;
39#[doc = "Pin number\n\nValue on reset: 31"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41#[repr(u8)]
42pub enum PIN_A {
43 #[doc = "9: TRACEDATA2 pin"]
44 TRACEDATA2 = 9,
45}
46impl From<PIN_A> for u8 {
47 #[inline(always)]
48 fn from(variant: PIN_A) -> Self {
49 variant as _
50 }
51}
52impl PIN_R {
53 #[doc = "Get enumerated values variant"]
54 #[inline(always)]
55 pub fn variant(&self) -> Option<PIN_A> {
56 match self.bits {
57 9 => Some(PIN_A::TRACEDATA2),
58 _ => None,
59 }
60 }
61 #[doc = "Checks if the value of the field is `TRACEDATA2`"]
62 #[inline(always)]
63 pub fn is_tracedata2(&self) -> bool {
64 *self == PIN_A::TRACEDATA2
65 }
66}
67#[doc = "Field `PIN` writer - Pin number"]
68pub type PIN_W<'a, const O: u8> = crate::FieldWriter<'a, u32, TRACEDATA2_SPEC, u8, PIN_A, 5, O>;
69impl<'a, const O: u8> PIN_W<'a, O> {
70 #[doc = "TRACEDATA2 pin"]
71 #[inline(always)]
72 pub fn tracedata2(self) -> &'a mut W {
73 self.variant(PIN_A::TRACEDATA2)
74 }
75}
76#[doc = "Field `CONNECT` reader - Connection"]
77pub type CONNECT_R = crate::BitReader<CONNECT_A>;
78#[doc = "Connection\n\nValue on reset: 1"]
79#[derive(Clone, Copy, Debug, PartialEq)]
80pub enum CONNECT_A {
81 #[doc = "1: Disconnect"]
82 DISCONNECTED = 1,
83 #[doc = "0: Connect"]
84 CONNECTED = 0,
85}
86impl From<CONNECT_A> for bool {
87 #[inline(always)]
88 fn from(variant: CONNECT_A) -> Self {
89 variant as u8 != 0
90 }
91}
92impl CONNECT_R {
93 #[doc = "Get enumerated values variant"]
94 #[inline(always)]
95 pub fn variant(&self) -> CONNECT_A {
96 match self.bits {
97 true => CONNECT_A::DISCONNECTED,
98 false => CONNECT_A::CONNECTED,
99 }
100 }
101 #[doc = "Checks if the value of the field is `DISCONNECTED`"]
102 #[inline(always)]
103 pub fn is_disconnected(&self) -> bool {
104 *self == CONNECT_A::DISCONNECTED
105 }
106 #[doc = "Checks if the value of the field is `CONNECTED`"]
107 #[inline(always)]
108 pub fn is_connected(&self) -> bool {
109 *self == CONNECT_A::CONNECTED
110 }
111}
112#[doc = "Field `CONNECT` writer - Connection"]
113pub type CONNECT_W<'a, const O: u8> = crate::BitWriter<'a, u32, TRACEDATA2_SPEC, CONNECT_A, O>;
114impl<'a, const O: u8> CONNECT_W<'a, O> {
115 #[doc = "Disconnect"]
116 #[inline(always)]
117 pub fn disconnected(self) -> &'a mut W {
118 self.variant(CONNECT_A::DISCONNECTED)
119 }
120 #[doc = "Connect"]
121 #[inline(always)]
122 pub fn connected(self) -> &'a mut W {
123 self.variant(CONNECT_A::CONNECTED)
124 }
125}
126impl R {
127 #[doc = "Bits 0:4 - Pin number"]
128 #[inline(always)]
129 pub fn pin(&self) -> PIN_R {
130 PIN_R::new((self.bits & 0x1f) as u8)
131 }
132 #[doc = "Bit 31 - Connection"]
133 #[inline(always)]
134 pub fn connect(&self) -> CONNECT_R {
135 CONNECT_R::new(((self.bits >> 31) & 1) != 0)
136 }
137}
138impl W {
139 #[doc = "Bits 0:4 - Pin number"]
140 #[inline(always)]
141 pub fn pin(&mut self) -> PIN_W<0> {
142 PIN_W::new(self)
143 }
144 #[doc = "Bit 31 - Connection"]
145 #[inline(always)]
146 pub fn connect(&mut self) -> CONNECT_W<31> {
147 CONNECT_W::new(self)
148 }
149 #[doc = "Writes raw bits to the register."]
150 #[inline(always)]
151 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
152 self.0.bits(bits);
153 self
154 }
155}
156#[doc = "Pin configuration for TRACEDATA\\[2\\]\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 [tracedata2](index.html) module"]
157pub struct TRACEDATA2_SPEC;
158impl crate::RegisterSpec for TRACEDATA2_SPEC {
159 type Ux = u32;
160}
161#[doc = "`read()` method returns [tracedata2::R](R) reader structure"]
162impl crate::Readable for TRACEDATA2_SPEC {
163 type Reader = R;
164}
165#[doc = "`write(|w| ..)` method takes [tracedata2::W](W) writer structure"]
166impl crate::Writable for TRACEDATA2_SPEC {
167 type Writer = W;
168}
169#[doc = "`reset()` method sets TRACEDATA2 to value 0xffff_ffff"]
170impl crate::Resettable for TRACEDATA2_SPEC {
171 #[inline(always)]
172 fn reset_value() -> Self::Ux {
173 0xffff_ffff
174 }
175}