1
0
Fork 0
This commit is contained in:
linuswck 2024-03-04 16:13:52 +08:00
parent a3885c365e
commit 111d9a4226
2 changed files with 1 additions and 30 deletions

View File

@ -105,10 +105,6 @@ impl LdDrive{
self.ld_short();
}
pub fn get_ld_drive_current(&mut self) -> ElectricCurrent{
self.settings.ld_drive_current
}
pub fn set_ld_drive_current_limit(&mut self, i_limit: ElectricCurrent){
self.settings.ld_drive_current_limit = i_limit.min(Settings::LD_CURRENT_MAX);
}
@ -167,10 +163,6 @@ impl LdDrive{
LdPwrExcProtector::set_calibrated_vdda(val_cal)
}
pub fn pd_mon_status(&mut self) -> ld_pwr_exc_protector::Status {
LdPwrExcProtector::get_status()
}
pub fn pd_mon_clear_alarm(&mut self) {
LdPwrExcProtector::clear_alarm_status();
}

View File

@ -1,7 +1,7 @@
use crate::device::sys_timer;
use core::cell::RefCell;
use cortex_m::interrupt::{CriticalSection, Mutex};
use log::{debug, info, warn};
use log::{debug, info};
use smoltcp::{
iface::{
self, Interface, SocketHandle, SocketSet, SocketStorage
@ -40,7 +40,6 @@ const ADDRESS: (IpAddress, u16) = (
/// Interrupt pending flag: set by the `ETH` interrupt handler, should
/// be cleared before polling the interface.
static NET_PENDING: Mutex<RefCell<bool>> = Mutex::new(RefCell::new(false));
static mut INCOMING_BYTE: [u8; 512] = [0; 512];
pub struct ServerHandle {
socket_handle: SocketHandle,
@ -172,26 +171,6 @@ impl ServerHandle {
}
}
pub fn echo(&mut self, buffer: &mut [u8]) {
self.iface.poll(now_fn(), &mut &mut self.dma, &mut self.socket_set);
let socket = self.socket_set.get_mut::<Socket>(self.socket_handle);
if let Ok(recv_bytes) = socket.recv_slice(buffer) {
if recv_bytes > 0 {
socket.send_slice(&buffer[..recv_bytes]).ok();
info!("Echoed {} bytes.", recv_bytes);
}
}
if !socket.is_listening() && !socket.is_open() || socket.state() == State::CloseWait {
socket.abort();
socket.listen(ADDRESS).ok();
warn!("Disconnected... Reopening listening socket.");
}
self.iface.poll(now_fn(), &mut &mut self.dma, &mut self.socket_set);
}
pub fn recv(&mut self, buffer: &mut [u8])-> Result<usize, smoltcp::socket::tcp::RecvError> {
self.iface.poll(now_fn(), &mut &mut self.dma, &mut self.socket_set);
let socket = self.socket_set.get_mut::<Socket>(self.socket_handle);