Merge #760
760: stm32/gpio: Add support for `set_speed` for gpio v1 r=Dirbaio a=GrantM11235 Co-authored-by: Grant Miller <GrantM11235@gmail.com>
This commit is contained in:
commit
e9ab960ebf
1 changed files with 10 additions and 1 deletions
|
@ -511,10 +511,19 @@ pub(crate) mod sealed {
|
|||
self.set_as_analog();
|
||||
}
|
||||
|
||||
#[cfg(gpio_v2)]
|
||||
#[inline]
|
||||
unsafe fn set_speed(&self, speed: Speed) {
|
||||
let pin = self._pin() as usize;
|
||||
|
||||
#[cfg(gpio_v1)]
|
||||
{
|
||||
let crlh = if pin < 8 { 0 } else { 1 };
|
||||
self.block().cr(crlh).modify(|w| {
|
||||
w.set_mode(pin % 8, speed.into());
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(gpio_v2)]
|
||||
self.block()
|
||||
.ospeedr()
|
||||
.modify(|w| w.set_ospeedr(pin, speed.into()));
|
||||
|
|
Loading…
Reference in a new issue