stm32/gpio: Add support for set_speed
for gpio v1
This commit is contained in:
parent
49ae26f384
commit
b230ac9c1a
@ -511,10 +511,20 @@ pub(crate) mod sealed {
|
|||||||
self.set_as_analog();
|
self.set_as_analog();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(gpio_v2)]
|
#[cfg(any(gpio_v1, gpio_v2))]
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn set_speed(&self, speed: Speed) {
|
unsafe fn set_speed(&self, speed: Speed) {
|
||||||
let pin = self._pin() as usize;
|
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()
|
self.block()
|
||||||
.ospeedr()
|
.ospeedr()
|
||||||
.modify(|w| w.set_ospeedr(pin, speed.into()));
|
.modify(|w| w.set_ospeedr(pin, speed.into()));
|
||||||
|
Loading…
Reference in New Issue
Block a user