smoltcp: bump to 0.7.0

nal_support
occheung 2021-01-22 10:21:07 +08:00
parent 0df7680d60
commit 1d6b32c320
2 changed files with 6 additions and 8 deletions

View File

@ -13,7 +13,7 @@ license = "BSD-2-Clause"
volatile-register = "0.2" volatile-register = "0.2"
aligned = "0.3" aligned = "0.3"
embedded-hal = "0.2" embedded-hal = "0.2"
smoltcp = { version = "0.6.0", default-features = false, features = ["proto-ipv4", "proto-ipv6", "socket-icmp", "socket-udp", "socket-tcp", "log", "verbose", "ethernet"], optional = true } smoltcp = { version = "0.7.0", default-features = false, features = ["proto-ipv4", "proto-ipv6", "socket-icmp", "socket-udp", "socket-tcp", "log", "verbose", "ethernet"], optional = true }
# Optional dependencies for building examples # Optional dependencies for building examples
stm32f4xx-hal = { version = "0.8", optional = true } stm32f4xx-hal = { version = "0.8", optional = true }
cortex-m = { version = "0.5", optional = true } cortex-m = { version = "0.5", optional = true }

View File

@ -21,35 +21,33 @@ pub enum NetworkError {
} }
pub type NetworkInterface<SPI, NSS, Delay> = net::iface::EthernetInterface< pub type NetworkInterface<SPI, NSS, Delay> = net::iface::EthernetInterface<
'static,
'static,
'static, 'static,
crate::smoltcp_phy::SmoltcpDevice< crate::smoltcp_phy::SmoltcpDevice<
crate::SpiEth<SPI, NSS, Delay> crate::SpiEth<SPI, NSS, Delay>
>, >,
>; >;
pub struct NetworkStack<'a, 'b, 'c, SPI, NSS, Delay> pub struct NetworkStack<'a, SPI, NSS, Delay>
where where
SPI: 'static + Transfer<u8>, SPI: 'static + Transfer<u8>,
NSS: 'static + OutputPin, NSS: 'static + OutputPin,
Delay: 'static + DelayUs<u16> Delay: 'static + DelayUs<u16>
{ {
network_interface: RefCell<NetworkInterface<SPI, NSS, Delay>>, network_interface: RefCell<NetworkInterface<SPI, NSS, Delay>>,
sockets: RefCell<net::socket::SocketSet<'a, 'b, 'c>>, sockets: RefCell<net::socket::SocketSet<'a>>,
next_port: RefCell<u16>, next_port: RefCell<u16>,
unused_handles: RefCell<Vec<net::socket::SocketHandle, consts::U16>>, unused_handles: RefCell<Vec<net::socket::SocketHandle, consts::U16>>,
time_ms: RefCell<u32>, time_ms: RefCell<u32>,
last_update_instant: RefCell<Option<Instant>>, last_update_instant: RefCell<Option<Instant>>,
} }
impl<'a, 'b, 'c, SPI, NSS, Delay> NetworkStack<'a, 'b, 'c, SPI, NSS, Delay> impl<'a, SPI, NSS, Delay> NetworkStack<'a, SPI, NSS, Delay>
where where
SPI: Transfer<u8>, SPI: Transfer<u8>,
NSS: OutputPin, NSS: OutputPin,
Delay: DelayUs<u16> Delay: DelayUs<u16>
{ {
pub fn new(interface: NetworkInterface<SPI, NSS, Delay>, sockets: net::socket::SocketSet<'a, 'b, 'c>) -> Self { pub fn new(interface: NetworkInterface<SPI, NSS, Delay>, sockets: net::socket::SocketSet<'a>) -> Self {
let mut unused_handles: Vec<net::socket::SocketHandle, consts::U16> = Vec::new(); let mut unused_handles: Vec<net::socket::SocketHandle, consts::U16> = Vec::new();
for socket in sockets.iter() { for socket in sockets.iter() {
unused_handles.push(socket.handle()).unwrap(); unused_handles.push(socket.handle()).unwrap();
@ -115,7 +113,7 @@ where
} }
} }
impl<'a, 'b, 'c, SPI, NSS, Delay> nal::TcpStack for NetworkStack<'a, 'b, 'c, SPI, NSS, Delay> impl<'a, SPI, NSS, Delay> nal::TcpStack for NetworkStack<'a, SPI, NSS, Delay>
where where
SPI: Transfer<u8>, SPI: Transfer<u8>,
NSS: OutputPin, NSS: OutputPin,