@@ -14,70 +14,14 @@ impl<const P: char, const N: u8, const A: u8> Pin<P, N, Alternate<A, PushPull>>
14
14
}
15
15
}
16
16
17
- impl < const P : char , const N : u8 , const A : u8 > From < Pin < P , N , Input > >
18
- for Pin < P , N , Alternate < A , PushPull > >
19
- {
20
- #[ inline( always) ]
21
- fn from ( f : Pin < P , N , Input > ) -> Self {
22
- f. into_alternate :: < A > ( )
23
- }
24
- }
25
-
26
- impl < const P : char , const N : u8 , const A : u8 , MODE > From < Pin < P , N , Output < MODE > > >
27
- for Pin < P , N , Alternate < A , PushPull > >
28
- where
29
- Output < MODE > : PinMode ,
30
- {
31
- #[ inline( always) ]
32
- fn from ( f : Pin < P , N , Output < MODE > > ) -> Self {
33
- f. into_alternate :: < A > ( )
34
- }
35
- }
36
-
37
- impl < const P : char , const N : u8 , const A : u8 > From < Pin < P , N , Analog > >
38
- for Pin < P , N , Alternate < A , PushPull > >
39
- {
40
- #[ inline( always) ]
41
- fn from ( f : Pin < P , N , Analog > ) -> Self {
42
- f. into_alternate :: < A > ( )
43
- }
44
- }
45
-
46
- impl < const P : char , const N : u8 , const A : u8 , const B : u8 > From < Pin < P , N , Alternate < B , OpenDrain > > >
47
- for Pin < P , N , Alternate < A , PushPull > >
48
- {
49
- #[ inline( always) ]
50
- fn from ( f : Pin < P , N , Alternate < B , OpenDrain > > ) -> Self {
51
- f. into_alternate :: < A > ( )
52
- }
53
- }
54
-
55
- impl < const P : char , const N : u8 , const A : u8 > From < Pin < P , N , Input > >
56
- for Pin < P , N , Alternate < A , OpenDrain > >
57
- {
58
- #[ inline( always) ]
59
- fn from ( f : Pin < P , N , Input > ) -> Self {
60
- f. into_alternate_open_drain :: < A > ( )
61
- }
62
- }
63
-
64
- impl < const P : char , const N : u8 , const A : u8 , MODE > From < Pin < P , N , Output < MODE > > >
65
- for Pin < P , N , Alternate < A , OpenDrain > >
17
+ impl < const P : char , const N : u8 , MODE : PinMode + sealed:: NotAlt , const A : u8 , Otype >
18
+ From < Pin < P , N , MODE > > for Pin < P , N , Alternate < A , Otype > >
66
19
where
67
- Output < MODE > : PinMode ,
20
+ Alternate < A , Otype > : PinMode ,
68
21
{
69
22
#[ inline( always) ]
70
- fn from ( f : Pin < P , N , Output < MODE > > ) -> Self {
71
- f. into_alternate_open_drain :: < A > ( )
72
- }
73
- }
74
-
75
- impl < const P : char , const N : u8 , const A : u8 > From < Pin < P , N , Analog > >
76
- for Pin < P , N , Alternate < A , OpenDrain > >
77
- {
78
- #[ inline( always) ]
79
- fn from ( f : Pin < P , N , Analog > ) -> Self {
80
- f. into_alternate_open_drain :: < A > ( )
23
+ fn from ( f : Pin < P , N , MODE > ) -> Self {
24
+ f. into_mode ( )
81
25
}
82
26
}
83
27
@@ -86,90 +30,65 @@ impl<const P: char, const N: u8, const A: u8, const B: u8> From<Pin<P, N, Altern
86
30
{
87
31
#[ inline( always) ]
88
32
fn from ( f : Pin < P , N , Alternate < B , PushPull > > ) -> Self {
89
- f. into_alternate_open_drain :: < A > ( )
33
+ f. into_mode ( )
90
34
}
91
35
}
92
36
93
- impl < const P : char , const N : u8 , MODE > From < Pin < P , N , Output < MODE > > > for Pin < P , N , Input >
37
+ impl < const P : char , const N : u8 , Otype > From < Pin < P , N , Output < Otype > > > for Pin < P , N , Input >
94
38
where
95
- Output < MODE > : PinMode ,
39
+ Output < Otype > : PinMode ,
96
40
{
97
41
#[ inline( always) ]
98
- fn from ( f : Pin < P , N , Output < MODE > > ) -> Self {
99
- f. into_input ( )
42
+ fn from ( f : Pin < P , N , Output < Otype > > ) -> Self {
43
+ f. into_mode ( )
100
44
}
101
45
}
102
46
103
47
impl < const P : char , const N : u8 > From < Pin < P , N , Analog > > for Pin < P , N , Input > {
104
48
#[ inline( always) ]
105
49
fn from ( f : Pin < P , N , Analog > ) -> Self {
106
- f. into_input ( )
50
+ f. into_mode ( )
107
51
}
108
52
}
109
53
110
- impl < const P : char , const N : u8 , const A : u8 > From < Pin < P , N , Alternate < A , PushPull > > >
111
- for Pin < P , N , Input >
54
+ impl < const P : char , const N : u8 , const A : u8 , Otype , MODE > From < Pin < P , N , Alternate < A , Otype > > >
55
+ for Pin < P , N , MODE >
56
+ where
57
+ Alternate < A , Otype > : PinMode ,
58
+ MODE : PinMode + sealed:: NotAlt ,
112
59
{
113
60
#[ inline( always) ]
114
- fn from ( f : Pin < P , N , Alternate < A , PushPull > > ) -> Self {
115
- f. into_input ( )
61
+ fn from ( f : Pin < P , N , Alternate < A , Otype > > ) -> Self {
62
+ f. into_mode ( )
116
63
}
117
64
}
118
65
119
- impl < const P : char , const N : u8 , const A : u8 > From < Pin < P , N , Alternate < A , OpenDrain > > >
120
- for Pin < P , N , Input >
66
+ impl < const P : char , const N : u8 , Otype > From < Pin < P , N , Input > > for Pin < P , N , Output < Otype > >
67
+ where
68
+ Output < Otype > : PinMode ,
121
69
{
122
- #[ inline( always) ]
123
- fn from ( f : Pin < P , N , Alternate < A , OpenDrain > > ) -> Self {
124
- f. into_input ( )
125
- }
126
- }
127
-
128
- impl < const P : char , const N : u8 > From < Pin < P , N , Input > > for Pin < P , N , Output < OpenDrain > > {
129
70
#[ inline( always) ]
130
71
fn from ( f : Pin < P , N , Input > ) -> Self {
131
- f. into_open_drain_output ( )
72
+ f. into_mode ( )
132
73
}
133
74
}
134
75
135
- impl < const P : char , const N : u8 > From < Pin < P , N , Output < PushPull > > >
136
- for Pin < P , N , Output < OpenDrain > >
76
+ impl < const P : char , const N : u8 , Otype > From < Pin < P , N , Analog > > for Pin < P , N , Output < Otype > >
77
+ where
78
+ Output < Otype > : PinMode ,
137
79
{
138
- #[ inline( always) ]
139
- fn from ( f : Pin < P , N , Output < PushPull > > ) -> Self {
140
- f. into_open_drain_output ( )
141
- }
142
- }
143
-
144
- impl < const P : char , const N : u8 > From < Pin < P , N , Analog > > for Pin < P , N , Output < OpenDrain > > {
145
80
#[ inline( always) ]
146
81
fn from ( f : Pin < P , N , Analog > ) -> Self {
147
- f. into_open_drain_output ( )
148
- }
149
- }
150
-
151
- impl < const P : char , const N : u8 , const A : u8 > From < Pin < P , N , Alternate < A , PushPull > > >
152
- for Pin < P , N , Output < OpenDrain > >
153
- {
154
- #[ inline( always) ]
155
- fn from ( f : Pin < P , N , Alternate < A , PushPull > > ) -> Self {
156
- f. into_open_drain_output ( )
82
+ f. into_mode ( )
157
83
}
158
84
}
159
85
160
- impl < const P : char , const N : u8 , const A : u8 > From < Pin < P , N , Alternate < A , OpenDrain > > >
86
+ impl < const P : char , const N : u8 > From < Pin < P , N , Output < PushPull > > >
161
87
for Pin < P , N , Output < OpenDrain > >
162
88
{
163
89
#[ inline( always) ]
164
- fn from ( f : Pin < P , N , Alternate < A , OpenDrain > > ) -> Self {
165
- f. into_open_drain_output ( )
166
- }
167
- }
168
-
169
- impl < const P : char , const N : u8 > From < Pin < P , N , Input > > for Pin < P , N , Output < PushPull > > {
170
- #[ inline( always) ]
171
- fn from ( f : Pin < P , N , Input > ) -> Self {
172
- f. into_push_pull_output ( )
90
+ fn from ( f : Pin < P , N , Output < PushPull > > ) -> Self {
91
+ f. into_mode ( )
173
92
}
174
93
}
175
94
@@ -178,67 +97,24 @@ impl<const P: char, const N: u8> From<Pin<P, N, Output<OpenDrain>>>
178
97
{
179
98
#[ inline( always) ]
180
99
fn from ( f : Pin < P , N , Output < OpenDrain > > ) -> Self {
181
- f. into_push_pull_output ( )
182
- }
183
- }
184
-
185
- impl < const P : char , const N : u8 > From < Pin < P , N , Analog > > for Pin < P , N , Output < PushPull > > {
186
- #[ inline( always) ]
187
- fn from ( f : Pin < P , N , Analog > ) -> Self {
188
- f. into_push_pull_output ( )
189
- }
190
- }
191
-
192
- impl < const P : char , const N : u8 , const A : u8 > From < Pin < P , N , Alternate < A , PushPull > > >
193
- for Pin < P , N , Output < PushPull > >
194
- {
195
- #[ inline( always) ]
196
- fn from ( f : Pin < P , N , Alternate < A , PushPull > > ) -> Self {
197
- f. into_push_pull_output ( )
198
- }
199
- }
200
-
201
- impl < const P : char , const N : u8 , const A : u8 > From < Pin < P , N , Alternate < A , OpenDrain > > >
202
- for Pin < P , N , Output < PushPull > >
203
- {
204
- #[ inline( always) ]
205
- fn from ( f : Pin < P , N , Alternate < A , OpenDrain > > ) -> Self {
206
- f. into_push_pull_output ( )
100
+ f. into_mode ( )
207
101
}
208
102
}
209
103
210
104
impl < const P : char , const N : u8 > From < Pin < P , N , Input > > for Pin < P , N , Analog > {
211
105
#[ inline( always) ]
212
106
fn from ( f : Pin < P , N , Input > ) -> Self {
213
- f. into_analog ( )
107
+ f. into_mode ( )
214
108
}
215
109
}
216
110
217
- impl < const P : char , const N : u8 , MODE > From < Pin < P , N , Output < MODE > > > for Pin < P , N , Analog >
111
+ impl < const P : char , const N : u8 , Otype > From < Pin < P , N , Output < Otype > > > for Pin < P , N , Analog >
218
112
where
219
- Output < MODE > : PinMode ,
220
- {
221
- #[ inline( always) ]
222
- fn from ( f : Pin < P , N , Output < MODE > > ) -> Self {
223
- f. into_analog ( )
224
- }
225
- }
226
-
227
- impl < const P : char , const N : u8 , const A : u8 > From < Pin < P , N , Alternate < A , PushPull > > >
228
- for Pin < P , N , Analog >
229
- {
230
- #[ inline( always) ]
231
- fn from ( f : Pin < P , N , Alternate < A , PushPull > > ) -> Self {
232
- f. into_analog ( )
233
- }
234
- }
235
-
236
- impl < const P : char , const N : u8 , const A : u8 > From < Pin < P , N , Alternate < A , OpenDrain > > >
237
- for Pin < P , N , Analog >
113
+ Output < Otype > : PinMode ,
238
114
{
239
115
#[ inline( always) ]
240
- fn from ( f : Pin < P , N , Alternate < A , OpenDrain > > ) -> Self {
241
- f. into_analog ( )
116
+ fn from ( f : Pin < P , N , Output < Otype > > ) -> Self {
117
+ f. into_mode ( )
242
118
}
243
119
}
244
120
0 commit comments