Derive SPI v1 and v3 clocks automatically
This commit is contained in:
parent
5e1b0a5398
commit
531093f281
@ -29,7 +29,6 @@ pub struct Spi<'d, T: Instance> {
|
||||
|
||||
impl<'d, T: Instance> Spi<'d, T> {
|
||||
pub fn new<F>(
|
||||
pclk: Hertz,
|
||||
_peri: impl Unborrow<Target = T> + 'd,
|
||||
sck: impl Unborrow<Target = impl SckPin<T>>,
|
||||
mosi: impl Unborrow<Target = impl MosiPin<T>>,
|
||||
@ -58,6 +57,7 @@ impl<'d, T: Instance> Spi<'d, T> {
|
||||
});
|
||||
}
|
||||
|
||||
let pclk = T::frequency();
|
||||
let br = Self::compute_baud_rate(pclk, freq.into());
|
||||
|
||||
unsafe {
|
||||
|
@ -37,7 +37,6 @@ pub struct Spi<'d, T: Instance> {
|
||||
|
||||
impl<'d, T: Instance> Spi<'d, T> {
|
||||
pub fn new<F>(
|
||||
pclk: Hertz,
|
||||
_peri: impl Unborrow<Target = T> + 'd,
|
||||
sck: impl Unborrow<Target = impl SckPin<T>>,
|
||||
mosi: impl Unborrow<Target = impl MosiPin<T>>,
|
||||
@ -62,6 +61,7 @@ impl<'d, T: Instance> Spi<'d, T> {
|
||||
let mosi = mosi.degrade();
|
||||
let miso = miso.degrade();
|
||||
|
||||
let pclk = T::frequency();
|
||||
let br = Self::compute_baud_rate(pclk, freq.into());
|
||||
unsafe {
|
||||
T::enable();
|
||||
|
Loading…
Reference in New Issue
Block a user