Compare commits
3 Commits
3ba8b99084
...
51913f2e2f
Author | SHA1 | Date |
---|---|---|
linuswck | 51913f2e2f | |
linuswck | c86d67b15c | |
linuswck | 3d2294a90c |
|
@ -878,7 +878,6 @@ dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"heapless 0.8.0",
|
"heapless 0.8.0",
|
||||||
"log",
|
|
||||||
"managed",
|
"managed",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -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"] }
|
stm32f4xx-hal = { version = "0.20.0", features = ["stm32f407", "otg-fs", "usb_fs"] }
|
||||||
stm32-eth = { version = "0.6.0", features = ["stm32f407", "smoltcp-phy", "smoltcp"] }
|
stm32-eth = { version = "0.6.0", features = ["stm32f407", "smoltcp-phy", "smoltcp"] }
|
||||||
ieee802_3_miim = "0.8.0"
|
ieee802_3_miim = "0.8.0"
|
||||||
smoltcp = { version = "0.11.0", default-features = false, features = ["proto-ipv4", "socket-tcp", "log", "medium-ethernet", "iface-neighbor-cache-count-16"] }
|
smoltcp = { version = "0.11.0", default-features = false, features = ["proto-ipv4", "socket-tcp", "medium-ethernet", "iface-neighbor-cache-count-16"] }
|
||||||
uom = { version = "0.30", default-features = false, features = ["autoconvert", "si", "f32", "use_serde"] }
|
uom = { version = "0.30", default-features = false, features = ["autoconvert", "si", "f32", "use_serde"] }
|
||||||
num-traits = { version = "0.2.15", default-features = false, features = ["libm"] }
|
num-traits = { version = "0.2.15", default-features = false, features = ["libm"] }
|
||||||
usb-device = "0.3.2"
|
usb-device = "0.3.2"
|
||||||
|
|
|
@ -835,11 +835,15 @@ class Kirdy:
|
||||||
self._connected_sig.emit(True)
|
self._connected_sig.emit(True)
|
||||||
|
|
||||||
async def _read_response(self, buffer_size=16384):
|
async def _read_response(self, buffer_size=16384):
|
||||||
raw_response = await self._reader.read(buffer_size)
|
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 = raw_response.decode('utf-8', errors='ignore').split("\n")
|
||||||
response.reverse()
|
response = response[:-1]
|
||||||
|
|
||||||
items = []
|
items = []
|
||||||
for item in response[1:]:
|
for item in response:
|
||||||
items.append(json.loads(item))
|
items.append(json.loads(item))
|
||||||
return items
|
return items
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,9 @@ impl ServerHandle {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn poll_iface(&mut self) {
|
pub fn poll_iface(&mut self) {
|
||||||
self.iface.poll(now_fn(), &mut &mut self.dma, &mut self.socket_set);
|
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> {
|
pub fn poll_at_iface(&mut self) -> Option<Instant> {
|
||||||
|
@ -246,8 +248,7 @@ impl ServerHandle {
|
||||||
if num_bytes > 0 {
|
if num_bytes > 0 {
|
||||||
match socket.send_slice(&buffer[..num_bytes]) {
|
match socket.send_slice(&buffer[..num_bytes]) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
self.poll_iface();
|
info!("Enqueued {} bytes.", num_bytes);
|
||||||
info!("Sent {} bytes.", num_bytes);
|
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
info!("Bytes cannot be sent. Error: {:?}", err)
|
info!("Bytes cannot be sent. Error: {:?}", err)
|
||||||
|
@ -515,11 +516,9 @@ pub fn for_each<F: FnMut(SocketHandle, usize)>(mut callback: F) {
|
||||||
#[interrupt]
|
#[interrupt]
|
||||||
fn ETH() {
|
fn ETH() {
|
||||||
let interrupt_reason = stm32_eth::eth_interrupt_handler();
|
let interrupt_reason = stm32_eth::eth_interrupt_handler();
|
||||||
cortex_m::interrupt::free(|_| {
|
if interrupt_reason.rx {
|
||||||
if interrupt_reason.rx {
|
eth_poll_iface();
|
||||||
eth_poll_iface();
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
debug!("Ethernet Interrupt{:?}", interrupt_reason);
|
debug!("Ethernet Interrupt{:?}", interrupt_reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue