Move Spi drop impl to mod
This commit is contained in:
parent
bd9e730024
commit
d76bc45e30
@ -339,6 +339,16 @@ impl<'d, T: Instance, Tx, Rx> Spi<'d, T, Tx, Rx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'d, T: Instance, Tx, Rx> Drop for Spi<'d, T, Tx, Rx> {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
self.sck.as_ref().map(|x| x.set_as_analog());
|
||||
self.mosi.as_ref().map(|x| x.set_as_analog());
|
||||
self.miso.as_ref().map(|x| x.set_as_analog());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trait RegsExt {
|
||||
fn tx_ptr<W>(&self) -> *mut W;
|
||||
fn rx_ptr<W>(&self) -> *mut W;
|
||||
|
@ -1,7 +1,6 @@
|
||||
#![macro_use]
|
||||
|
||||
use crate::dma::NoDma;
|
||||
use crate::gpio::sealed::Pin;
|
||||
use crate::spi::{Error, Instance, RegsExt, RxDmaChannel, TxDmaChannel, WordSize};
|
||||
use core::future::Future;
|
||||
use core::ptr;
|
||||
@ -156,16 +155,6 @@ impl<'d, T: Instance, Tx, Rx> Spi<'d, T, Tx, Rx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'d, T: Instance, Tx, Rx> Drop for Spi<'d, T, Tx, Rx> {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
self.sck.as_ref().map(|x| x.set_as_analog());
|
||||
self.mosi.as_ref().map(|x| x.set_as_analog());
|
||||
self.miso.as_ref().map(|x| x.set_as_analog());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'d, T: Instance> embedded_hal::blocking::spi::Write<u8> for Spi<'d, T, NoDma, NoDma> {
|
||||
type Error = Error;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#![macro_use]
|
||||
|
||||
use crate::dma::NoDma;
|
||||
use crate::gpio::sealed::Pin;
|
||||
use crate::spi::{Error, Instance, RegsExt, RxDmaChannel, TxDmaChannel, WordSize};
|
||||
use core::future::Future;
|
||||
use core::ptr;
|
||||
@ -175,16 +174,6 @@ impl<'d, T: Instance, Tx, Rx> Spi<'d, T, Tx, Rx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'d, T: Instance, Tx, Rx> Drop for Spi<'d, T, Tx, Rx> {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
self.sck.as_ref().map(|x| x.set_as_analog());
|
||||
self.mosi.as_ref().map(|x| x.set_as_analog());
|
||||
self.miso.as_ref().map(|x| x.set_as_analog());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trait Word {}
|
||||
|
||||
impl Word for u8 {}
|
||||
|
@ -1,7 +1,6 @@
|
||||
#![macro_use]
|
||||
|
||||
use crate::dma::NoDma;
|
||||
use crate::gpio::sealed::Pin;
|
||||
use crate::spi::{Error, Instance, RegsExt, RxDmaChannel, TxDmaChannel, WordSize};
|
||||
use core::future::Future;
|
||||
use core::ptr;
|
||||
@ -178,16 +177,6 @@ impl<'d, T: Instance, Tx, Rx> Spi<'d, T, Tx, Rx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'d, T: Instance, Tx, Rx> Drop for Spi<'d, T, Tx, Rx> {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
self.sck.as_ref().map(|x| x.set_as_analog());
|
||||
self.mosi.as_ref().map(|x| x.set_as_analog());
|
||||
self.miso.as_ref().map(|x| x.set_as_analog());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'d, T: Instance> embedded_hal::blocking::spi::Write<u8> for Spi<'d, T, NoDma, NoDma> {
|
||||
type Error = Error;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user