hal-common: require DerefMut for peripherals, not just Deref.

Otherwise you can create multiple drivers on the same singleton like this:

```rust
let mut input = Input::new(&pin, Pull::None);
let mut output = Output::new(&pin, Level::Low, Speed::Low);
input.is_high();
output.set_high();
input.is_high();
output.set_high();
```

Thanks @pennae for reporting.
This commit is contained in:
Dario Nieuwenhuis
2023-07-02 22:07:20 +02:00
parent ba43444292
commit c9b9be5b81
2 changed files with 3 additions and 3 deletions

View File

@ -161,7 +161,7 @@ pub trait Peripheral: Sized {
}
}
impl<'b, T: Deref> Peripheral for T
impl<'b, T: DerefMut> Peripheral for T
where
T::Target: Peripheral,
{