@@ -1651,58 +1651,44 @@ foreach_peripheral!(
16511651
16521652#[ cfg( feature = "embedded-sdmmc" ) ]
16531653mod sdmmc_rs {
1654- use core:: future:: Future ;
1655-
16561654 use embedded_sdmmc:: { Block , BlockCount , BlockDevice , BlockIdx } ;
16571655
16581656 use super :: * ;
16591657
16601658 impl < ' d , T : Instance , Dma : SdmmcDma < T > > BlockDevice for Sdmmc < ' d , T , Dma > {
16611659 type Error = Error ;
16621660
1663- type ReadFuture < ' a > = impl Future < Output = Result < ( ) , Self :: Error > > + ' a
1664- where
1665- Self : ' a ;
1666-
1667- type WriteFuture < ' a > = impl Future < Output = Result < ( ) , Self :: Error > > + ' a
1668- where
1669- Self : ' a ;
1670-
1671- fn read < ' a > (
1672- & ' a mut self ,
1673- blocks : & ' a mut [ Block ] ,
1661+ async fn read (
1662+ & mut self ,
1663+ blocks : & mut [ Block ] ,
16741664 start_block_idx : BlockIdx ,
16751665 _reason : & str ,
1676- ) -> Self :: ReadFuture < ' a > {
1677- async move {
1678- let mut address = start_block_idx. 0 ;
1666+ ) -> Result < ( ) , Self :: Error > {
1667+ let mut address = start_block_idx. 0 ;
16791668
1680- for block in blocks. iter_mut ( ) {
1681- let block: & mut [ u8 ; 512 ] = & mut block. contents ;
1669+ for block in blocks. iter_mut ( ) {
1670+ let block: & mut [ u8 ; 512 ] = & mut block. contents ;
16821671
1683- // NOTE(unsafe) Block uses align(4)
1684- let block = unsafe { & mut * ( block as * mut _ as * mut DataBlock ) } ;
1685- self . read_block ( address, block) . await ?;
1686- address += 1 ;
1687- }
1688- Ok ( ( ) )
1672+ // NOTE(unsafe) Block uses align(4)
1673+ let block = unsafe { & mut * ( block as * mut _ as * mut DataBlock ) } ;
1674+ self . read_block ( address, block) . await ?;
1675+ address += 1 ;
16891676 }
1677+ Ok ( ( ) )
16901678 }
16911679
1692- fn write < ' a > ( & ' a mut self , blocks : & ' a [ Block ] , start_block_idx : BlockIdx ) -> Self :: WriteFuture < ' a > {
1693- async move {
1694- let mut address = start_block_idx. 0 ;
1680+ async fn write ( & mut self , blocks : & [ Block ] , start_block_idx : BlockIdx ) -> Result < ( ) , Self :: Error > {
1681+ let mut address = start_block_idx. 0 ;
16951682
1696- for block in blocks. iter ( ) {
1697- let block: & [ u8 ; 512 ] = & block. contents ;
1683+ for block in blocks. iter ( ) {
1684+ let block: & [ u8 ; 512 ] = & block. contents ;
16981685
1699- // NOTE(unsafe) DataBlock uses align 4
1700- let block = unsafe { & * ( block as * const _ as * const DataBlock ) } ;
1701- self . write_block ( address, block) . await ?;
1702- address += 1 ;
1703- }
1704- Ok ( ( ) )
1686+ // NOTE(unsafe) DataBlock uses align 4
1687+ let block = unsafe { & * ( block as * const _ as * const DataBlock ) } ;
1688+ self . write_block ( address, block) . await ?;
1689+ address += 1 ;
17051690 }
1691+ Ok ( ( ) )
17061692 }
17071693
17081694 fn num_blocks ( & self ) -> Result < BlockCount , Self :: Error > {
0 commit comments