esp-hosted: fix warnings.

This commit is contained in:
Dario Nieuwenhuis 2023-06-21 19:08:09 +02:00
parent 764b43e82c
commit 1ed909ea74
4 changed files with 7 additions and 17 deletions

View file

@ -16,6 +16,7 @@ pub struct Control<'a> {
shared: &'a Shared,
}
#[allow(unused)]
enum WifiMode {
None = 0,
Sta = 1,
@ -34,6 +35,7 @@ impl<'a> Control<'a> {
debug!("set wifi mode");
self.set_wifi_mode(WifiMode::Sta as _).await;
let mac_addr = self.get_mac_addr().await;
debug!("mac addr: {:02x}", mac_addr);
self.state_ch.set_ethernet_address(mac_addr);
@ -91,18 +93,6 @@ impl<'a> Control<'a> {
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) {
let req = proto::CtrlMsg {
msg_id: proto::CtrlMsgId::ReqSetWifiMode as _,

View file

@ -1,6 +1,6 @@
use core::cell::{Cell, RefCell};
use core::cell::RefCell;
use core::future::poll_fn;
use core::task::{Poll, Waker};
use core::task::Poll;
use embassy_sync::waitqueue::WakerRegistration;

View file

@ -83,6 +83,7 @@ struct PayloadHeader {
}
impl_bytes!(PayloadHeader);
#[allow(unused)]
#[repr(u8)]
enum InterfaceType {
Sta = 0,
@ -276,7 +277,7 @@ where
return;
}
let isEvent = match &payload[..12] {
let is_event = match &payload[..12] {
b"\x01\x08\x00ctrlResp\x02" => false,
b"\x01\x08\x00ctrlEvnt\x02" => true,
_ => {
@ -292,7 +293,7 @@ where
}
let data = &payload[14..][..len];
if isEvent {
if is_event {
self.handle_event(data);
} else {
self.shared.ioctl_done(data);

View file

@ -10,7 +10,6 @@ use embassy_nrf::gpio::{AnyPin, Input, Level, Output, OutputDrive, Pin, Pull};
use embassy_nrf::rng::Rng;
use embassy_nrf::spim::{self, Spim};
use embassy_nrf::{bind_interrupts, peripherals};
use embassy_time::{Duration, Timer};
use embedded_hal_async::spi::ExclusiveDevice;
use embedded_io::asynch::Write;
use static_cell::make_static;