Update embassy
This commit is contained in:
@ -11,11 +11,10 @@ defmt-debug = []
|
||||
defmt-info = []
|
||||
defmt-warn = []
|
||||
defmt-error = []
|
||||
defmt = [ "dep:defmt", "smoltcp/defmt" ]
|
||||
|
||||
[dependencies]
|
||||
|
||||
defmt = { version = "0.1.3", optional = true }
|
||||
defmt = { version = "0.2.0", optional = true }
|
||||
log = { version = "0.4.11", optional = true }
|
||||
|
||||
embassy = { version = "0.1.0" }
|
||||
|
@ -1,13 +1,13 @@
|
||||
use embassy::util::Forever;
|
||||
use heapless::consts::*;
|
||||
use heapless::Vec;
|
||||
use smoltcp::dhcp::Dhcpv4Client;
|
||||
use smoltcp::socket::{RawPacketMetadata, RawSocketBuffer};
|
||||
use smoltcp::time::Instant;
|
||||
use smoltcp::wire::{Ipv4Address, Ipv4Cidr};
|
||||
use smoltcp::wire::Ipv4Address;
|
||||
|
||||
use super::*;
|
||||
use crate::{device::LinkState, fmt::*};
|
||||
use crate::device::LinkState;
|
||||
use crate::fmt::*;
|
||||
use crate::{Interface, SocketSet};
|
||||
|
||||
pub struct DhcpResources {
|
||||
|
@ -1,11 +1,11 @@
|
||||
use core::task::{Poll, Waker};
|
||||
use core::task::Waker;
|
||||
use smoltcp::phy::Device as SmolDevice;
|
||||
use smoltcp::phy::DeviceCapabilities;
|
||||
use smoltcp::time::Instant as SmolInstant;
|
||||
|
||||
use crate::fmt::*;
|
||||
use crate::{Packet, PacketBox, PacketBuf};
|
||||
use crate::Result;
|
||||
use crate::{Packet, PacketBox, PacketBuf};
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Copy)]
|
||||
pub enum LinkState {
|
||||
@ -21,7 +21,7 @@ pub trait Device {
|
||||
fn register_waker(&mut self, waker: &Waker);
|
||||
fn capabilities(&mut self) -> DeviceCapabilities;
|
||||
fn link_state(&mut self) -> LinkState;
|
||||
fn ethernet_address(&mut self) -> [u8;6];
|
||||
fn ethernet_address(&mut self) -> [u8; 6];
|
||||
}
|
||||
|
||||
pub struct DeviceAdapter {
|
||||
@ -92,7 +92,7 @@ pub struct TxToken<'a> {
|
||||
}
|
||||
|
||||
impl<'a> smoltcp::phy::TxToken for TxToken<'a> {
|
||||
fn consume<R, F>(mut self, _timestamp: SmolInstant, len: usize, f: F) -> Result<R>
|
||||
fn consume<R, F>(self, _timestamp: SmolInstant, len: usize, f: F) -> Result<R>
|
||||
where
|
||||
F: FnOnce(&mut [u8]) -> Result<R>,
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
use core::cell::RefCell;
|
||||
use core::future::Future;
|
||||
use core::task::Context;
|
||||
use core::task::Poll;
|
||||
use core::{cell::RefCell, future};
|
||||
use embassy::time::{Instant, Timer};
|
||||
use embassy::util::ThreadModeMutex;
|
||||
use embassy::util::{Forever, WakerRegistration};
|
||||
@ -110,7 +110,7 @@ impl Stack {
|
||||
self.waker.register(cx.waker());
|
||||
|
||||
let timestamp = instant_to_smoltcp(Instant::now());
|
||||
if let Err(e) = self.iface.poll(&mut self.sockets, timestamp) {
|
||||
if let Err(_) = self.iface.poll(&mut self.sockets, timestamp) {
|
||||
// If poll() returns error, it may not be done yet, so poll again later.
|
||||
cx.waker().wake_by_ref();
|
||||
return;
|
||||
@ -174,6 +174,9 @@ pub fn init(device: &'static mut dyn Device, configurator: &'static mut dyn Conf
|
||||
|
||||
let sockets = SocketSet::new(&mut res.sockets[..]);
|
||||
|
||||
let local_port = LOCAL_PORT_MIN;
|
||||
|
||||
/*
|
||||
let local_port = loop {
|
||||
let mut res = [0u8; 2];
|
||||
embassy::rand::rand(&mut res);
|
||||
@ -182,6 +185,7 @@ pub fn init(device: &'static mut dyn Device, configurator: &'static mut dyn Conf
|
||||
break port;
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
let stack = Stack {
|
||||
iface,
|
||||
|
@ -111,7 +111,7 @@ impl<'a> TcpSocket<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn to_ioerr(e: Error) -> io::Error {
|
||||
fn to_ioerr(_err: Error) -> io::Error {
|
||||
// todo
|
||||
io::Error::Other
|
||||
}
|
||||
|
Reference in New Issue
Block a user