Compare commits

..

No commits in common. "51913f2e2f45d4c3e266e9ab9b1345d301221956" and "3ba8b99084a0f5fbac07cb9a6b6b822228dcfb39" have entirely different histories.

4 changed files with 13 additions and 15 deletions

1
Cargo.lock generated
View File

@ -878,6 +878,7 @@ dependencies = [
"byteorder",
"cfg-if",
"heapless 0.8.0",
"log",
"managed",
]

View File

@ -25,7 +25,7 @@ cortex-m-log = { version = "0.7.0", features = ["log-integration", "semihosting"
stm32f4xx-hal = { version = "0.20.0", features = ["stm32f407", "otg-fs", "usb_fs"] }
stm32-eth = { version = "0.6.0", features = ["stm32f407", "smoltcp-phy", "smoltcp"] }
ieee802_3_miim = "0.8.0"
smoltcp = { version = "0.11.0", default-features = false, features = ["proto-ipv4", "socket-tcp", "medium-ethernet", "iface-neighbor-cache-count-16"] }
smoltcp = { version = "0.11.0", default-features = false, features = ["proto-ipv4", "socket-tcp", "log", "medium-ethernet", "iface-neighbor-cache-count-16"] }
uom = { version = "0.30", default-features = false, features = ["autoconvert", "si", "f32", "use_serde"] }
num-traits = { version = "0.2.15", default-features = false, features = ["libm"] }
usb-device = "0.3.2"

View File

@ -835,15 +835,11 @@ class Kirdy:
self._connected_sig.emit(True)
async def _read_response(self, buffer_size=16384):
raw_response = b''
while len(raw_response) == 0:
# Ignore 0 size packet
raw_response = await self._reader.read(buffer_size)
response = raw_response.decode('utf-8', errors='ignore').split("\n")
response = response[:-1]
response.reverse()
items = []
for item in response:
for item in response[1:]:
items.append(json.loads(item))
return items

View File

@ -220,9 +220,7 @@ impl ServerHandle {
}
pub fn poll_iface(&mut self) {
cortex_m::interrupt::free(|_| {
self.iface.poll(now_fn(), &mut &mut self.dma, &mut self.socket_set);
});
}
pub fn poll_at_iface(&mut self) -> Option<Instant> {
@ -248,7 +246,8 @@ impl ServerHandle {
if num_bytes > 0 {
match socket.send_slice(&buffer[..num_bytes]) {
Ok(_) => {
info!("Enqueued {} bytes.", num_bytes);
self.poll_iface();
info!("Sent {} bytes.", num_bytes);
}
Err(err) => {
info!("Bytes cannot be sent. Error: {:?}", err)
@ -516,9 +515,11 @@ pub fn for_each<F: FnMut(SocketHandle, usize)>(mut callback: F) {
#[interrupt]
fn ETH() {
let interrupt_reason = stm32_eth::eth_interrupt_handler();
cortex_m::interrupt::free(|_| {
if interrupt_reason.rx {
eth_poll_iface();
}
});
debug!("Ethernet Interrupt{:?}", interrupt_reason);
}