Small adjustment to 'set_as_af' interface

Small adjustment to 'set_as_af' interface - v2
This commit is contained in:
Mariusz Ryndzionek
2021-09-24 18:39:07 +02:00
parent b6fc19182b
commit d371298a27
7 changed files with 45 additions and 25 deletions

View File

@ -4,7 +4,10 @@ use core::ops::{Deref, DerefMut};
use embassy::util::Unborrow;
use embassy_hal_common::unborrow;
use crate::gpio::Pin;
use crate::gpio::{
OutputType::{OpenDrain, PushPull},
Pin,
};
use crate::{peripherals, rcc::RccPeripheral};
pub use bxcan::*;
@ -23,8 +26,8 @@ impl<'d, T: Instance + bxcan::Instance> Can<'d, T> {
unborrow!(peri, rx, tx);
unsafe {
rx.set_as_af(rx.af_num());
tx.set_as_af(tx.af_num());
rx.set_as_af(rx.af_num(), OpenDrain);
tx.set_as_af(tx.af_num(), PushPull);
}
T::enable();