@@ -119,6 +119,8 @@ pub mod size;
119
119
#[ doc( hidden) ]
120
120
pub mod test_helpers;
121
121
122
+ use core:: convert:: Infallible ;
123
+
122
124
pub use crate :: i2c_interface:: I2CDisplayInterface ;
123
125
use crate :: mode:: BasicMode ;
124
126
use brightness:: Brightness ;
@@ -412,43 +414,43 @@ where
412
414
// SPI-only reset
413
415
impl < SPI , DC , SIZE , MODE > Ssd1306 < SPIInterfaceNoCS < SPI , DC > , SIZE , MODE > {
414
416
/// Reset the display.
415
- pub fn reset < RST , DELAY , PinE > (
417
+ pub fn reset < RST , DELAY > (
416
418
& mut self ,
417
419
rst : & mut RST ,
418
420
delay : & mut DELAY ,
419
- ) -> Result < ( ) , Error < ( ) , PinE > >
421
+ ) -> Result < ( ) , Error < Infallible , RST :: Error > >
420
422
where
421
- RST : OutputPin < Error = PinE > ,
423
+ RST : OutputPin ,
422
424
DELAY : DelayMs < u8 > ,
423
425
{
424
- inner_reset ( rst, delay)
426
+ inner_reset ( rst, delay) . map_err ( Error :: Pin )
425
427
}
426
428
}
427
429
428
430
// SPI-only reset
429
431
impl < SPI , DC , CS , SIZE , MODE > Ssd1306 < SPIInterface < SPI , DC , CS > , SIZE , MODE > {
430
432
/// Reset the display.
431
- pub fn reset < RST , DELAY , PinE > (
433
+ pub fn reset < RST , DELAY > (
432
434
& mut self ,
433
435
rst : & mut RST ,
434
436
delay : & mut DELAY ,
435
- ) -> Result < ( ) , Error < ( ) , PinE > >
437
+ ) -> Result < ( ) , Error < Infallible , RST :: Error > >
436
438
where
437
- RST : OutputPin < Error = PinE > ,
439
+ RST : OutputPin ,
438
440
DELAY : DelayMs < u8 > ,
439
441
{
440
- inner_reset ( rst, delay)
442
+ inner_reset ( rst, delay) . map_err ( Error :: Pin )
441
443
}
442
444
}
443
445
444
- fn inner_reset < RST , DELAY , PinE > ( rst : & mut RST , delay : & mut DELAY ) -> Result < ( ) , Error < ( ) , PinE > >
446
+ fn inner_reset < RST , DELAY > ( rst : & mut RST , delay : & mut DELAY ) -> Result < ( ) , RST :: Error >
445
447
where
446
- RST : OutputPin < Error = PinE > ,
448
+ RST : OutputPin ,
447
449
DELAY : DelayMs < u8 > ,
448
450
{
449
- rst. set_high ( ) . map_err ( Error :: Pin ) ?;
451
+ rst. set_high ( ) ?;
450
452
delay. delay_ms ( 1 ) ;
451
- rst. set_low ( ) . map_err ( Error :: Pin ) ?;
453
+ rst. set_low ( ) ?;
452
454
delay. delay_ms ( 10 ) ;
453
- rst. set_high ( ) . map_err ( Error :: Pin )
455
+ rst. set_high ( )
454
456
}
0 commit comments