16
16
//! * Write enable
17
17
18
18
use crate :: gpio:: alt:: fsmc as alt;
19
- use crate :: gpio:: { PinSpeed , Speed } ;
20
19
21
20
use super :: sealed;
22
21
use super :: { Lcd , SubBank1 } ;
23
22
use crate :: fsmc_lcd:: { SubBank2 , SubBank3 , SubBank4 } ;
24
23
25
24
/// One, two, three, or four address pins
26
- pub trait AddressPins : sealed:: Sealed {
27
- fn set_high_speed ( & mut self ) ;
28
- }
25
+ pub trait AddressPins : sealed:: Sealed { }
29
26
30
27
// Implement AddressPins for one address pin and tuples of two, three, and four
31
- impl AddressPins for alt:: Address {
32
- #[ inline( always) ]
33
- fn set_high_speed ( & mut self ) {
34
- self . set_speed ( Speed :: VeryHigh ) ;
35
- }
36
- }
37
- impl AddressPins for ( alt:: Address , alt:: Address ) {
38
- #[ inline( always) ]
39
- fn set_high_speed ( & mut self ) {
40
- self . 0 . set_speed ( Speed :: VeryHigh ) ;
41
- self . 1 . set_speed ( Speed :: VeryHigh ) ;
42
- }
43
- }
28
+ impl AddressPins for alt:: Address { }
29
+ impl AddressPins for ( alt:: Address , alt:: Address ) { }
44
30
impl sealed:: Sealed for ( alt:: Address , alt:: Address ) { }
45
- impl AddressPins for ( alt:: Address , alt:: Address , alt:: Address ) {
46
- #[ inline( always) ]
47
- fn set_high_speed ( & mut self ) {
48
- self . 0 . set_speed ( Speed :: VeryHigh ) ;
49
- self . 1 . set_speed ( Speed :: VeryHigh ) ;
50
- self . 2 . set_speed ( Speed :: VeryHigh ) ;
51
- }
52
- }
31
+ impl AddressPins for ( alt:: Address , alt:: Address , alt:: Address ) { }
53
32
impl sealed:: Sealed for ( alt:: Address , alt:: Address , alt:: Address ) { }
54
- impl AddressPins for ( alt:: Address , alt:: Address , alt:: Address , alt:: Address ) {
55
- #[ inline( always) ]
56
- fn set_high_speed ( & mut self ) {
57
- self . 0 . set_speed ( Speed :: VeryHigh ) ;
58
- self . 1 . set_speed ( Speed :: VeryHigh ) ;
59
- self . 2 . set_speed ( Speed :: VeryHigh ) ;
60
- self . 3 . set_speed ( Speed :: VeryHigh ) ;
61
- }
62
- }
33
+ impl AddressPins for ( alt:: Address , alt:: Address , alt:: Address , alt:: Address ) { }
63
34
impl sealed:: Sealed for ( alt:: Address , alt:: Address , alt:: Address , alt:: Address ) { }
64
35
65
36
macro_rules! conjure {
@@ -118,7 +89,6 @@ pub trait ChipSelectPins: sealed::Sealed {
118
89
/// One, two, three, or four `Lcd<_>` objects associated with the sub-bank(s) that these pin(s)
119
90
/// control
120
91
type Lcds : sealed:: Conjure ;
121
- fn set_high_speed ( & mut self ) ;
122
92
}
123
93
124
94
// The set of 4 chip selects has 15 subsets (excluding the empty set):
@@ -143,13 +113,6 @@ macro_rules! chipselect {
143
113
$(
144
114
impl ChipSelectPins for ( $( alt:: $Ne) ,+) {
145
115
type Lcds = ( $( Lcd <$sb>) ,+) ;
146
-
147
- #[ inline( always) ]
148
- fn set_high_speed( & mut self ) {
149
- $(
150
- self . $i. set_speed( Speed :: VeryHigh ) ;
151
- ) +
152
- }
153
116
}
154
117
impl sealed:: Sealed for ( $( alt:: $Ne) ,+) { }
155
118
) +
@@ -158,35 +121,15 @@ macro_rules! chipselect {
158
121
159
122
impl ChipSelectPins for alt:: Ne1 {
160
123
type Lcds = Lcd < SubBank1 > ;
161
-
162
- #[ inline( always) ]
163
- fn set_high_speed ( & mut self ) {
164
- self . set_speed ( Speed :: VeryHigh ) ;
165
- }
166
124
}
167
125
impl ChipSelectPins for alt:: Ne2 {
168
126
type Lcds = Lcd < SubBank2 > ;
169
-
170
- #[ inline( always) ]
171
- fn set_high_speed ( & mut self ) {
172
- self . set_speed ( Speed :: VeryHigh ) ;
173
- }
174
127
}
175
128
impl ChipSelectPins for alt:: Ne3 {
176
129
type Lcds = Lcd < SubBank3 > ;
177
-
178
- #[ inline( always) ]
179
- fn set_high_speed ( & mut self ) {
180
- self . set_speed ( Speed :: VeryHigh ) ;
181
- }
182
130
}
183
131
impl ChipSelectPins for alt:: Ne4 {
184
132
type Lcds = Lcd < SubBank4 > ;
185
-
186
- #[ inline( always) ]
187
- fn set_high_speed ( & mut self ) {
188
- self . set_speed ( Speed :: VeryHigh ) ;
189
- }
190
133
}
191
134
chipselect ! {
192
135
[ SubBank1 , Ne1 , 0 ] , [ SubBank2 , Ne2 , 1 ] ;
@@ -206,9 +149,7 @@ chipselect! {
206
149
///
207
150
/// Currently this trait is only implemented for tuples of 16 data pins. In the future,
208
151
/// this driver may support 8-bit mode using 8 data pins.
209
- pub trait DataPins : sealed:: Sealed {
210
- fn set_high_speed ( & mut self ) ;
211
- }
152
+ pub trait DataPins : sealed:: Sealed { }
212
153
213
154
#[ allow( unused) ]
214
155
pub struct DataPins16 {
@@ -230,26 +171,7 @@ pub struct DataPins16 {
230
171
d15 : alt:: D15 ,
231
172
}
232
173
233
- impl DataPins for DataPins16 {
234
- #[ inline( always) ]
235
- fn set_high_speed ( & mut self ) {
236
- self . d0 . set_speed ( Speed :: VeryHigh ) ;
237
- self . d1 . set_speed ( Speed :: VeryHigh ) ;
238
- self . d2 . set_speed ( Speed :: VeryHigh ) ;
239
- self . d4 . set_speed ( Speed :: VeryHigh ) ;
240
- self . d5 . set_speed ( Speed :: VeryHigh ) ;
241
- self . d6 . set_speed ( Speed :: VeryHigh ) ;
242
- self . d7 . set_speed ( Speed :: VeryHigh ) ;
243
- self . d8 . set_speed ( Speed :: VeryHigh ) ;
244
- self . d9 . set_speed ( Speed :: VeryHigh ) ;
245
- self . d10 . set_speed ( Speed :: VeryHigh ) ;
246
- self . d11 . set_speed ( Speed :: VeryHigh ) ;
247
- self . d12 . set_speed ( Speed :: VeryHigh ) ;
248
- self . d13 . set_speed ( Speed :: VeryHigh ) ;
249
- self . d14 . set_speed ( Speed :: VeryHigh ) ;
250
- self . d15 . set_speed ( Speed :: VeryHigh ) ;
251
- }
252
- }
174
+ impl DataPins for DataPins16 { }
253
175
254
176
impl DataPins16 {
255
177
#[ inline( always) ]
@@ -317,24 +239,17 @@ where
317
239
NE : ChipSelectPins ,
318
240
{
319
241
pub fn new (
320
- mut data : D ,
321
- mut address : AD ,
242
+ data : D ,
243
+ address : AD ,
322
244
read_enable : impl Into < alt:: Noe > ,
323
245
write_enable : impl Into < alt:: Nwe > ,
324
- mut chip_select : NE ,
246
+ chip_select : NE ,
325
247
) -> Self {
326
- data. set_high_speed ( ) ;
327
- address. set_high_speed ( ) ;
328
- let mut read_enable = read_enable. into ( ) ;
329
- read_enable. set_speed ( Speed :: VeryHigh ) ;
330
- let mut write_enable = write_enable. into ( ) ;
331
- write_enable. set_speed ( Speed :: VeryHigh ) ;
332
- chip_select. set_high_speed ( ) ;
333
248
Self {
334
249
data,
335
250
address,
336
- read_enable,
337
- write_enable,
251
+ read_enable : read_enable . into ( ) ,
252
+ write_enable : write_enable . into ( ) ,
338
253
chip_select,
339
254
}
340
255
}
0 commit comments