diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-07-23 13:15:17 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-07-23 13:15:17 +0000 |
| commit | e61e36a8158073ec92df1a751cfdd7fce5004cf8 (patch) | |
| tree | 4a54aee47c0d3881b9e0bc809e075728cee8eeae /examples/stm32f4/src | |
| parent | 96f67671677d8bf7175f98e87c98954dc728286c (diff) | |
| parent | 709df0dc1dfff577fb79bbc2f67ea84670072456 (diff) | |
Merge #842
842: WIP: Make unborrow safe to use r=Dirbaio a=GrantM11235
The basic idea is that `Unborrow::unborrow` is now safe to call and returns an `Unborrowed<'a, T>` which impls `Deref` and `DerefMut`
```rust
/// This is essentially a `&mut T`, but it is the size of `T` not the size
/// of a pointer. This is useful if T is a zero sized type.
pub struct Unborrowed<'a, T> {
inner: T,
_lifetime: PhantomData<&'a mut T>,
}
```
## Todo
- [x] Update other crates
- [x] embassy-cortex-m
- [x] embassy-hal-common
- [x] embassy-lora
- [x] embassy-nrf
- [x] embassy-rp
- [x] embassy-stm32
- [x] Remove usage of the unsafe `into_inner` method if possible
- [x] Review and amend docs for `Unborrow` and `Unborrowed`
Co-authored-by: Grant Miller <[email protected]>
Co-authored-by: Dario Nieuwenhuis <[email protected]>
Diffstat (limited to 'examples/stm32f4/src')
| -rw-r--r-- | examples/stm32f4/src/bin/sdmmc.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/examples/stm32f4/src/bin/sdmmc.rs b/examples/stm32f4/src/bin/sdmmc.rs index 665670261..752ad57bf 100644 --- a/examples/stm32f4/src/bin/sdmmc.rs +++ b/examples/stm32f4/src/bin/sdmmc.rs | |||
| @@ -21,12 +21,17 @@ async fn main(_spawner: Spawner, p: Peripherals) -> ! { | |||
| 21 | 21 | ||
| 22 | let irq = interrupt::take!(SDIO); | 22 | let irq = interrupt::take!(SDIO); |
| 23 | 23 | ||
| 24 | let mut sdmmc = Sdmmc::new( | 24 | let mut sdmmc = Sdmmc::new_4bit( |
| 25 | p.SDIO, | 25 | p.SDIO, |
| 26 | (p.PC12, p.PD2, p.PC8, p.PC9, p.PC10, p.PC11), | ||
| 27 | irq, | 26 | irq, |
| 28 | Default::default(), | ||
| 29 | p.DMA2_CH3, | 27 | p.DMA2_CH3, |
| 28 | p.PC12, | ||
| 29 | p.PD2, | ||
| 30 | p.PC8, | ||
| 31 | p.PC9, | ||
| 32 | p.PC10, | ||
| 33 | p.PC11, | ||
| 34 | Default::default(), | ||
| 30 | ); | 35 | ); |
| 31 | 36 | ||
| 32 | // Should print 400kHz for initialization | 37 | // Should print 400kHz for initialization |
