Refactor drivers

This commit is contained in:
Yuke Peng
2023-11-20 20:37:51 +08:00
committed by Tate, Hongliang Tian
parent d809eca81d
commit edd808bd3d
12 changed files with 87 additions and 67 deletions

View File

@ -3,10 +3,10 @@ use smoltcp::{phy, time::Instant};
use crate::{
buffer::{RxBuffer, TxBuffer},
NetworkDevice,
AnyNetworkDevice,
};
impl phy::Device for dyn NetworkDevice {
impl phy::Device for dyn AnyNetworkDevice {
type RxToken<'a> = RxToken;
type TxToken<'a> = TxToken<'a>;
@ -43,7 +43,7 @@ impl phy::RxToken for RxToken {
}
}
pub struct TxToken<'a>(&'a mut dyn NetworkDevice);
pub struct TxToken<'a>(&'a mut dyn AnyNetworkDevice);
impl<'a> phy::TxToken for TxToken<'a> {
fn consume<R, F>(self, len: usize, f: F) -> R