esp-hosted: fix warnings.
This commit is contained in:
parent
764b43e82c
commit
1ed909ea74
@ -16,6 +16,7 @@ pub struct Control<'a> {
|
|||||||
shared: &'a Shared,
|
shared: &'a Shared,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
enum WifiMode {
|
enum WifiMode {
|
||||||
None = 0,
|
None = 0,
|
||||||
Sta = 1,
|
Sta = 1,
|
||||||
@ -34,6 +35,7 @@ impl<'a> Control<'a> {
|
|||||||
|
|
||||||
debug!("set wifi mode");
|
debug!("set wifi mode");
|
||||||
self.set_wifi_mode(WifiMode::Sta as _).await;
|
self.set_wifi_mode(WifiMode::Sta as _).await;
|
||||||
|
|
||||||
let mac_addr = self.get_mac_addr().await;
|
let mac_addr = self.get_mac_addr().await;
|
||||||
debug!("mac addr: {:02x}", mac_addr);
|
debug!("mac addr: {:02x}", mac_addr);
|
||||||
self.state_ch.set_ethernet_address(mac_addr);
|
self.state_ch.set_ethernet_address(mac_addr);
|
||||||
@ -91,18 +93,6 @@ impl<'a> Control<'a> {
|
|||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_wifi_mode(&mut self) -> u32 {
|
|
||||||
let req = proto::CtrlMsg {
|
|
||||||
msg_id: proto::CtrlMsgId::ReqGetWifiMode as _,
|
|
||||||
msg_type: proto::CtrlMsgType::Req as _,
|
|
||||||
payload: Some(proto::CtrlMsgPayload::ReqGetWifiMode(proto::CtrlMsgReqGetMode {})),
|
|
||||||
};
|
|
||||||
let resp = self.ioctl(req).await;
|
|
||||||
let proto::CtrlMsgPayload::RespGetWifiMode(resp) = resp.payload.unwrap() else { panic!("unexpected resp") };
|
|
||||||
assert_eq!(resp.resp, 0);
|
|
||||||
resp.mode
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn set_wifi_mode(&mut self, mode: u32) {
|
async fn set_wifi_mode(&mut self, mode: u32) {
|
||||||
let req = proto::CtrlMsg {
|
let req = proto::CtrlMsg {
|
||||||
msg_id: proto::CtrlMsgId::ReqSetWifiMode as _,
|
msg_id: proto::CtrlMsgId::ReqSetWifiMode as _,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use core::cell::{Cell, RefCell};
|
use core::cell::RefCell;
|
||||||
use core::future::poll_fn;
|
use core::future::poll_fn;
|
||||||
use core::task::{Poll, Waker};
|
use core::task::Poll;
|
||||||
|
|
||||||
use embassy_sync::waitqueue::WakerRegistration;
|
use embassy_sync::waitqueue::WakerRegistration;
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ struct PayloadHeader {
|
|||||||
}
|
}
|
||||||
impl_bytes!(PayloadHeader);
|
impl_bytes!(PayloadHeader);
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
enum InterfaceType {
|
enum InterfaceType {
|
||||||
Sta = 0,
|
Sta = 0,
|
||||||
@ -276,7 +277,7 @@ where
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let isEvent = match &payload[..12] {
|
let is_event = match &payload[..12] {
|
||||||
b"\x01\x08\x00ctrlResp\x02" => false,
|
b"\x01\x08\x00ctrlResp\x02" => false,
|
||||||
b"\x01\x08\x00ctrlEvnt\x02" => true,
|
b"\x01\x08\x00ctrlEvnt\x02" => true,
|
||||||
_ => {
|
_ => {
|
||||||
@ -292,7 +293,7 @@ where
|
|||||||
}
|
}
|
||||||
let data = &payload[14..][..len];
|
let data = &payload[14..][..len];
|
||||||
|
|
||||||
if isEvent {
|
if is_event {
|
||||||
self.handle_event(data);
|
self.handle_event(data);
|
||||||
} else {
|
} else {
|
||||||
self.shared.ioctl_done(data);
|
self.shared.ioctl_done(data);
|
||||||
|
@ -10,7 +10,6 @@ use embassy_nrf::gpio::{AnyPin, Input, Level, Output, OutputDrive, Pin, Pull};
|
|||||||
use embassy_nrf::rng::Rng;
|
use embassy_nrf::rng::Rng;
|
||||||
use embassy_nrf::spim::{self, Spim};
|
use embassy_nrf::spim::{self, Spim};
|
||||||
use embassy_nrf::{bind_interrupts, peripherals};
|
use embassy_nrf::{bind_interrupts, peripherals};
|
||||||
use embassy_time::{Duration, Timer};
|
|
||||||
use embedded_hal_async::spi::ExclusiveDevice;
|
use embedded_hal_async::spi::ExclusiveDevice;
|
||||||
use embedded_io::asynch::Write;
|
use embedded_io::asynch::Write;
|
||||||
use static_cell::make_static;
|
use static_cell::make_static;
|
||||||
|
Loading…
Reference in New Issue
Block a user