File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 88use super :: sdmmc_proto:: * ;
99use super :: { Block , BlockCount , BlockDevice , BlockIdx } ;
1010use core:: cell:: RefCell ;
11+ use core:: ops:: Deref ;
1112
1213#[ cfg( feature = "log" ) ]
1314use log:: { debug, trace, warn} ;
@@ -487,6 +488,27 @@ where
487488 }
488489}
489490
491+ impl < U : BlockDevice , T : Deref < Target = U > > BlockDevice for T {
492+ type Error = U :: Error ;
493+ fn read (
494+ & self ,
495+ blocks : & mut [ Block ] ,
496+ start_block_idx : BlockIdx ,
497+ _reason : & str ,
498+ ) -> Result < ( ) , Self :: Error > {
499+ self . deref ( ) . read ( blocks, start_block_idx, _reason)
500+ }
501+
502+ /// Write one or more blocks, starting at the given block index.
503+ fn write ( & self , blocks : & [ Block ] , start_block_idx : BlockIdx ) -> Result < ( ) , Self :: Error > {
504+ self . deref ( ) . write ( blocks, start_block_idx)
505+ }
506+
507+ fn num_blocks ( & self ) -> Result < BlockCount , Self :: Error > {
508+ self . deref ( ) . num_blocks ( )
509+ }
510+ }
511+
490512impl < SPI , CS > BlockDevice for BlockSpi < ' _ , SPI , CS >
491513where
492514 SPI : embedded_hal:: blocking:: spi:: Transfer < u8 > ,
You can’t perform that action at this time.
0 commit comments